Procházet zdrojové kódy

修改文件名显示

处理消息发送失败之后的问题
master
zdc před 5 roky
rodič
revize
cfded50a7c
6 změnil soubory, kde provedl 26 přidání a 26 odebrání
  1. +4
    -1
      lib/chat/file_msg_item.dart
  2. +1
    -1
      lib/home/group_item_widget.dart
  3. +1
    -1
      lib/home/last_chat_item.dart
  4. +17
    -21
      lib/home/send_msg_state.dart
  5. +2
    -2
      lib/utils/HttpUtil.dart
  6. +1
    -0
      lib/utils/upload_util.dart

+ 4
- 1
lib/chat/file_msg_item.dart Zobrazit soubor

@@ -92,7 +92,10 @@ class FileMsgItem extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
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),


+ 1
- 1
lib/home/group_item_widget.dart Zobrazit soubor

@@ -141,7 +141,7 @@ class _GroupItemState extends State<GroupItem> {
: SendMsgState(
sessionId:
widget.groupInfoModel.lastMsg.sessionId,
time: widget.groupInfoModel.lastMsg.updateAt),
time: widget.groupInfoModel.lastMsg.updateAt,isGroup: true,),
widget.groupInfoModel.lastMsg == null
? Container()
: Row(


+ 1
- 1
lib/home/last_chat_item.dart Zobrazit soubor

@@ -130,7 +130,7 @@ class _LastChatItemState extends State<LastChatItem> {
children: <Widget>[
SendMsgState(
sessionId: lastMessageModel.sessionId,
time: lastMessageModel.updateAt),
time: lastMessageModel.updateAt,isGroup: false,),
Container(
constraints:
BoxConstraints(maxWidth: Screen.width - 130),


+ 17
- 21
lib/home/send_msg_state.dart Zobrazit soubor

@@ -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<SendMsgState> {
@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);
}
}
}

+ 2
- 2
lib/utils/HttpUtil.dart Zobrazit soubor

@@ -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) {


+ 1
- 0
lib/utils/upload_util.dart Zobrazit soubor

@@ -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);


Načítá se…
Zrušit
Uložit