@@ -1,4 +1,5 @@ | |||||
import 'dart:convert'; | import 'dart:convert'; | ||||
import 'dart:io'; | |||||
import 'dart:math'; | import 'dart:math'; | ||||
import 'dart:typed_data'; | import 'dart:typed_data'; | ||||
@@ -483,6 +484,7 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
_imgMsg(List<int> imgData) { | _imgMsg(List<int> imgData) { | ||||
var imgSize = _getImgSize(); | var imgSize = _getImgSize(); | ||||
ImageProvider provider = MemoryImage(widget.msg.localFile==null?Uint8List.fromList(imgData):File(widget.msg.localFile).readAsBytesSync()); | |||||
return GestureDetector( | return GestureDetector( | ||||
child: ClipRRect( | child: ClipRRect( | ||||
@@ -494,7 +496,7 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
width: imgSize.width, | width: imgSize.width, | ||||
child: Image( | child: Image( | ||||
fit: BoxFit.contain, | fit: BoxFit.contain, | ||||
image: MemoryImage(Uint8List.fromList(imgData)), | |||||
image: provider, | |||||
), | ), | ||||
)), | )), | ||||
borderRadius: BorderRadius.circular(5), | borderRadius: BorderRadius.circular(5), | ||||
@@ -1031,7 +1033,8 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
} | } | ||||
_receiveImg(BuildContext context, List<int> imgData, {String downloadData}) { | _receiveImg(BuildContext context, List<int> imgData, {String downloadData}) { | ||||
ImageProvider provider = MemoryImage(Uint8List.fromList(imgData)); | |||||
ImageProvider provider = MemoryImage(widget.msg.localFile==null?Uint8List.fromList(imgData):File(widget.msg.localFile).readAsBytesSync()); | |||||
var imgSize = _getImgSize(); | var imgSize = _getImgSize(); | ||||
@@ -56,8 +56,9 @@ class _PhotoPageState extends State<PhotoPage> | |||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
Uint8List fileData; | Uint8List fileData; | ||||
if (widget.msg.localFile != null) { | if (widget.msg.localFile != null) { | ||||
print('本地了'); | |||||
fileData = File(widget.msg.localFile).readAsBytesSync(); | fileData = File(widget.msg.localFile).readAsBytesSync(); | ||||
// print('本地了${fileData.lengthInBytes}'); | |||||
} else { | } else { | ||||
fileData = Uint8List.fromList(widget.msg.msgContent); | fileData = Uint8List.fromList(widget.msg.msgContent); | ||||
} | } | ||||
@@ -472,6 +472,7 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
_imgMsg(List<int> imgData) { | _imgMsg(List<int> imgData) { | ||||
var imgSize = _getImgSize(); | var imgSize = _getImgSize(); | ||||
ImageProvider provider = MemoryImage(widget.msg.localFile==null?Uint8List.fromList(imgData):File(widget.msg.localFile).readAsBytesSync()); | |||||
return GestureDetector( | return GestureDetector( | ||||
child: ClipRRect( | child: ClipRRect( | ||||
@@ -483,7 +484,7 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
width: imgSize.width, | width: imgSize.width, | ||||
child: Image( | child: Image( | ||||
fit: BoxFit.contain, | fit: BoxFit.contain, | ||||
image: MemoryImage(Uint8List.fromList(imgData)), | |||||
image:provider, | |||||
), | ), | ||||
)), | )), | ||||
borderRadius: BorderRadius.circular(5), | borderRadius: BorderRadius.circular(5), | ||||
@@ -1041,7 +1042,8 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
} | } | ||||
_receiveImg(BuildContext context, List<int> imgData, {String downloadData}) { | _receiveImg(BuildContext context, List<int> imgData, {String downloadData}) { | ||||
ImageProvider provider = MemoryImage(Uint8List.fromList(imgData)); | |||||
// ImageProvider provider = MemoryImage(Uint8List.fromList(imgData)); | |||||
ImageProvider provider = MemoryImage(widget.msg.localFile==null?Uint8List.fromList(imgData):File(widget.msg.localFile).readAsBytesSync()); | |||||
var imgSize = _getImgSize(); | var imgSize = _getImgSize(); | ||||
@@ -44,9 +44,9 @@ class HttpUtil { | |||||
//static const String BaseUrl = 'http://192.168.0.223:7001/'; | //static const String BaseUrl = 'http://192.168.0.223:7001/'; | ||||
//static const String BaseUrl = 'http://192.168.0.207:9080/'; | //static const String BaseUrl = 'http://192.168.0.207:9080/'; | ||||
static const String BaseUrl = 'http://120.79.107.63:9080/'; | |||||
// static const String BaseUrl = 'http://120.79.107.63:9080/'; | |||||
//static const String BaseUrl = 'http://192.168.0.177:9016/'; | //static const String BaseUrl = 'http://192.168.0.177:9016/'; | ||||
// static const String BaseUrl = 'https://datasm.chengyouhd.com/'; | |||||
static const String BaseUrl = 'https://datasm.chengyouhd.com/'; | |||||
static HttpUtil _getInstance() { | static HttpUtil _getInstance() { | ||||
if (_instance == null) { | if (_instance == null) { | ||||
@@ -1,7 +1,7 @@ | |||||
name: chat | name: chat | ||||
description: A new Flutter project. | description: A new Flutter project. | ||||
#修改版本号后get-clean | #修改版本号后get-clean | ||||
version: 1.0.5+6 | |||||
version: 1.0.9+13 | |||||
environment: | environment: | ||||
sdk: ">=2.1.0 <3.0.0" | sdk: ">=2.1.0 <3.0.0" | ||||