@@ -92,7 +92,10 @@ class FileMsgItem extends StatelessWidget { | |||||
crossAxisAlignment: CrossAxisAlignment.start, | crossAxisAlignment: CrossAxisAlignment.start, | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Container( | Container( | ||||
child: fixedText(name, fontSize: 13), | |||||
child: Text(name, | |||||
textScaleFactor: 1.0, | |||||
overflow: TextOverflow.ellipsis, | |||||
style: TextStyle(fontSize: 13.0)), | |||||
padding: EdgeInsets.only(bottom: 2), | padding: EdgeInsets.only(bottom: 2), | ||||
constraints: BoxConstraints( | constraints: BoxConstraints( | ||||
maxWidth: Screen.width - 120 - 122, maxHeight: 50), | maxWidth: Screen.width - 120 - 122, maxHeight: 50), | ||||
@@ -141,7 +141,7 @@ class _GroupItemState extends State<GroupItem> { | |||||
: SendMsgState( | : SendMsgState( | ||||
sessionId: | sessionId: | ||||
widget.groupInfoModel.lastMsg.sessionId, | widget.groupInfoModel.lastMsg.sessionId, | ||||
time: widget.groupInfoModel.lastMsg.updateAt), | |||||
time: widget.groupInfoModel.lastMsg.updateAt,isGroup: true,), | |||||
widget.groupInfoModel.lastMsg == null | widget.groupInfoModel.lastMsg == null | ||||
? Container() | ? Container() | ||||
: Row( | : Row( | ||||
@@ -130,7 +130,7 @@ class _LastChatItemState extends State<LastChatItem> { | |||||
children: <Widget>[ | children: <Widget>[ | ||||
SendMsgState( | SendMsgState( | ||||
sessionId: lastMessageModel.sessionId, | sessionId: lastMessageModel.sessionId, | ||||
time: lastMessageModel.updateAt), | |||||
time: lastMessageModel.updateAt,isGroup: false,), | |||||
Container( | Container( | ||||
constraints: | constraints: | ||||
BoxConstraints(maxWidth: Screen.width - 130), | BoxConstraints(maxWidth: Screen.width - 130), | ||||
@@ -1,3 +1,4 @@ | |||||
import 'package:chat/data/chat_data_mgr.dart'; | |||||
import 'package:chat/data/constants.dart'; | import 'package:chat/data/constants.dart'; | ||||
import 'package:chat/models/ChatMsg.dart'; | import 'package:chat/models/ChatMsg.dart'; | ||||
import 'package:chat/utils/msgHandler.dart'; | import 'package:chat/utils/msgHandler.dart'; | ||||
@@ -6,7 +7,8 @@ import 'package:flutter/material.dart'; | |||||
class SendMsgState extends StatefulWidget { | class SendMsgState extends StatefulWidget { | ||||
final int sessionId; | final int sessionId; | ||||
final int time; | final int time; | ||||
SendMsgState({this.sessionId,this.time}); | |||||
final bool isGroup; | |||||
SendMsgState({this.sessionId, this.time, this.isGroup}); | |||||
@override | @override | ||||
_SendMsgStateState createState() => _SendMsgStateState(); | _SendMsgStateState createState() => _SendMsgStateState(); | ||||
} | } | ||||
@@ -14,27 +16,21 @@ class SendMsgState extends StatefulWidget { | |||||
class _SendMsgStateState extends State<SendMsgState> { | class _SendMsgStateState extends State<SendMsgState> { | ||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
var sendCache = MsgHandler.sendCache; | |||||
for (var msg in sendCache) { | |||||
if (msg.sessionId == widget.sessionId && | |||||
msg.time == widget.time) { | |||||
if (msg.state == MsgState.SendingFailed) { | |||||
return Padding( | |||||
padding: EdgeInsets.only(right: 5), | |||||
child: Icon(Icons.error_outline, | |||||
size: 12, color: Colors.red)); | |||||
} else if (msg.state <= MsgState.Sending) { | |||||
return Padding( | |||||
padding: EdgeInsets.only(right: 5), | |||||
child: Icon( | |||||
IconData(0xe657, fontFamily: Constants.IconFontFamily), | |||||
size: 12, | |||||
color: Color(0xFFc0c0c0))); | |||||
} | |||||
} | |||||
var msg = | |||||
ChatDataMgr().getMsgBy(widget.sessionId, widget.time, widget.isGroup); | |||||
if (msg.state == MsgState.SendingFailed || | |||||
msg.state == MsgState.UploadFailed) { | |||||
return Padding( | |||||
padding: EdgeInsets.only(right: 5), | |||||
child: Icon(Icons.error_outline, size: 12, color: Colors.red)); | |||||
} else if (msg.state <= MsgState.Sending) { | |||||
return Padding( | |||||
padding: EdgeInsets.only(right: 5), | |||||
child: Icon(IconData(0xe657, fontFamily: Constants.IconFontFamily), | |||||
size: 12, color: Color(0xFFc0c0c0))); | |||||
} | } | ||||
return SizedBox(width: 0); | return SizedBox(width: 0); | ||||
} | } | ||||
} | |||||
} |
@@ -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) { | ||||
@@ -150,6 +150,7 @@ class UploadUtil { | |||||
var streamController = getStream(msg.extraFile); | var streamController = getStream(msg.extraFile); | ||||
var cancelToken = getCancelToken(msg.extraFile); | var cancelToken = getCancelToken(msg.extraFile); | ||||
print(formData); | |||||
response = await dio.post(uploadUrl + 'uploadchatfile', data: formData, | response = await dio.post(uploadUrl + 'uploadchatfile', data: formData, | ||||
onSendProgress: (int progress, int total) { | onSendProgress: (int progress, int total) { | ||||
streamController.sink.add(progress / total); | streamController.sink.add(progress / total); | ||||