diff --git a/lib/chat/file_msg_item.dart b/lib/chat/file_msg_item.dart index 131273c..2746503 100644 --- a/lib/chat/file_msg_item.dart +++ b/lib/chat/file_msg_item.dart @@ -92,7 +92,10 @@ class FileMsgItem extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ 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), constraints: BoxConstraints( maxWidth: Screen.width - 120 - 122, maxHeight: 50), diff --git a/lib/home/group_item_widget.dart b/lib/home/group_item_widget.dart index 04fa4d3..35d0f91 100644 --- a/lib/home/group_item_widget.dart +++ b/lib/home/group_item_widget.dart @@ -141,7 +141,7 @@ class _GroupItemState extends State { : SendMsgState( sessionId: widget.groupInfoModel.lastMsg.sessionId, - time: widget.groupInfoModel.lastMsg.updateAt), + time: widget.groupInfoModel.lastMsg.updateAt,isGroup: true,), widget.groupInfoModel.lastMsg == null ? Container() : Row( diff --git a/lib/home/last_chat_item.dart b/lib/home/last_chat_item.dart index ec07732..2db5b7c 100644 --- a/lib/home/last_chat_item.dart +++ b/lib/home/last_chat_item.dart @@ -130,7 +130,7 @@ class _LastChatItemState extends State { children: [ SendMsgState( sessionId: lastMessageModel.sessionId, - time: lastMessageModel.updateAt), + time: lastMessageModel.updateAt,isGroup: false,), Container( constraints: BoxConstraints(maxWidth: Screen.width - 130), diff --git a/lib/home/send_msg_state.dart b/lib/home/send_msg_state.dart index f3036aa..85d8953 100644 --- a/lib/home/send_msg_state.dart +++ b/lib/home/send_msg_state.dart @@ -1,3 +1,4 @@ +import 'package:chat/data/chat_data_mgr.dart'; import 'package:chat/data/constants.dart'; import 'package:chat/models/ChatMsg.dart'; import 'package:chat/utils/msgHandler.dart'; @@ -6,7 +7,8 @@ import 'package:flutter/material.dart'; class SendMsgState extends StatefulWidget { final int sessionId; final int time; - SendMsgState({this.sessionId,this.time}); + final bool isGroup; + SendMsgState({this.sessionId, this.time, this.isGroup}); @override _SendMsgStateState createState() => _SendMsgStateState(); } @@ -14,27 +16,21 @@ class SendMsgState extends StatefulWidget { class _SendMsgStateState extends State { @override 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); } -} \ No newline at end of file +} diff --git a/lib/utils/HttpUtil.dart b/lib/utils/HttpUtil.dart index 7006d36..257431c 100644 --- a/lib/utils/HttpUtil.dart +++ b/lib/utils/HttpUtil.dart @@ -44,9 +44,9 @@ class HttpUtil { //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://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 = 'https://datasm.chengyouhd.com/'; + static const String BaseUrl = 'https://datasm.chengyouhd.com/'; static HttpUtil _getInstance() { if (_instance == null) { diff --git a/lib/utils/upload_util.dart b/lib/utils/upload_util.dart index 4bbe1ae..9a3a24c 100644 --- a/lib/utils/upload_util.dart +++ b/lib/utils/upload_util.dart @@ -150,6 +150,7 @@ class UploadUtil { var streamController = getStream(msg.extraFile); var cancelToken = getCancelToken(msg.extraFile); + print(formData); response = await dio.post(uploadUrl + 'uploadchatfile', data: formData, onSendProgress: (int progress, int total) { streamController.sink.add(progress / total);