@@ -56,9 +56,9 @@ android { | |||||
// manifestPlaceholders = [ | // manifestPlaceholders = [ | ||||
// AMAP_KEY : "1fd4e93e3b4b13747da41f484c955fe2", /// 高德地图key | // AMAP_KEY : "1fd4e93e3b4b13747da41f484c955fe2", /// 高德地图key | ||||
// ] | // ] | ||||
ndk { | |||||
abiFilters 'armeabi-v7a' | |||||
} | |||||
// ndk { | |||||
// abiFilters 'armeabi-v7a' | |||||
// } | |||||
multiDexEnabled true | multiDexEnabled true | ||||
manifestPlaceholders = [ | manifestPlaceholders = [ | ||||
JPUSH_PKGNAME : 'com.cyhd.henhoandroid', | JPUSH_PKGNAME : 'com.cyhd.henhoandroid', | ||||
@@ -385,7 +385,7 @@ class _ChatPageState extends State<ChatPage> { | |||||
]), | ]), | ||||
], | ], | ||||
)); | )); | ||||
actions.add(TranslateSateWidget(friendId: friendInfo.userId)); | |||||
//actions.add(TranslateSateWidget(friendId: friendInfo.userId)); | |||||
actions.add(Container( | actions.add(Container( | ||||
margin: EdgeInsets.only(top: 1), | margin: EdgeInsets.only(top: 1), | ||||
child: myPop.PopupMenuButton( | child: myPop.PopupMenuButton( | ||||
@@ -715,7 +715,9 @@ class _ChatPageState extends State<ChatPage> { | |||||
return Container( | return Container( | ||||
padding: EdgeInsets.fromLTRB(10, 10, 10, 10), | padding: EdgeInsets.fromLTRB(10, 10, 10, 10), | ||||
decoration: BoxDecoration(color: Colors.white,border: Border(bottom: BorderSide(color: Colors.grey, width: .3))), | |||||
decoration: BoxDecoration( | |||||
color: Colors.white, | |||||
border: Border(bottom: BorderSide(color: Colors.grey, width: .3))), | |||||
child: Row( | child: Row( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
ClipRRect( | ClipRRect( | ||||
@@ -877,7 +879,11 @@ class _ChatPageState extends State<ChatPage> { | |||||
} | } | ||||
_deleteItem(msg) { | _deleteItem(msg) { | ||||
MessageMgr().emit('Cancel Request', msg); | |||||
if (msg.state == MsgState.Uploading) { | |||||
print('取消上传'); | |||||
UploadUtil().cancelSendMsg(msg); | |||||
} | |||||
print('#### 开始删除--'); | print('#### 开始删除--'); | ||||
msgList.remove(msg); | msgList.remove(msg); | ||||
setState(() {}); | setState(() {}); | ||||
@@ -13,6 +13,7 @@ import 'package:chat/chat/redbag_widget.dart'; | |||||
import 'package:chat/chat/upload_item.dart'; | import 'package:chat/chat/upload_item.dart'; | ||||
import 'package:chat/chat/video_view.dart'; | import 'package:chat/chat/video_view.dart'; | ||||
import 'package:chat/data/UserData.dart'; | import 'package:chat/data/UserData.dart'; | ||||
import 'package:chat/data/chat_data_mgr.dart'; | |||||
import 'package:chat/data/constants.dart'; | import 'package:chat/data/constants.dart'; | ||||
import 'package:chat/generated/i18n.dart'; | import 'package:chat/generated/i18n.dart'; | ||||
import 'package:chat/models/ChatMsg.dart'; | import 'package:chat/models/ChatMsg.dart'; | ||||
@@ -31,6 +32,7 @@ import 'package:chat/utils/file_cache_mgr.dart'; | |||||
import 'package:chat/utils/msgHandler.dart'; | import 'package:chat/utils/msgHandler.dart'; | ||||
import 'package:chat/utils/screen.dart'; | import 'package:chat/utils/screen.dart'; | ||||
import 'package:chat/utils/sound_util.dart'; | import 'package:chat/utils/sound_util.dart'; | ||||
import 'package:chat/utils/sql_util.dart'; | |||||
import 'package:chat/utils/upload_util.dart'; | import 'package:chat/utils/upload_util.dart'; | ||||
import 'package:chat/utils/video_anim.dart'; | import 'package:chat/utils/video_anim.dart'; | ||||
import 'package:chat/utils/wpop/w_popup_menu.dart'; | import 'package:chat/utils/wpop/w_popup_menu.dart'; | ||||
@@ -86,8 +88,6 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
String curSoundUrl; | String curSoundUrl; | ||||
CancelToken _cancelToken = CancelToken(); | |||||
bool isLongPressed = false; | bool isLongPressed = false; | ||||
double maxWidth = Screen.width - 140; | double maxWidth = Screen.width - 140; | ||||
@@ -105,28 +105,14 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
textList = widget.msg.getTransTextList(); | textList = widget.msg.getTransTextList(); | ||||
MessageMgr().on('Update Translate Message', updateTranslateMsg); | MessageMgr().on('Update Translate Message', updateTranslateMsg); | ||||
MessageMgr().on('Cancel Request', _deleteItem); | |||||
MessageMgr().on('Cancel Request', _deleteItem); | |||||
} | } | ||||
@override | @override | ||||
void dispose() { | void dispose() { | ||||
MessageMgr().off('Cancel Request', _deleteItem); | |||||
MessageMgr().off('Update Translate Message', updateTranslateMsg); | MessageMgr().off('Update Translate Message', updateTranslateMsg); | ||||
super.dispose(); | super.dispose(); | ||||
} | } | ||||
_deleteItem(msg) { | |||||
if (msg == widget.msg) { | |||||
print(widget.msg.state); | |||||
if (widget.msg.state == MsgState.Uploading) { | |||||
print('取消上传'); | |||||
UploadUtil().cancelRequests(_cancelToken); | |||||
} | |||||
} | |||||
} | |||||
updateTextList() { | updateTextList() { | ||||
textList.clear(); | textList.clear(); | ||||
curTextType = 0; | curTextType = 0; | ||||
@@ -616,7 +602,6 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
child: ClipRRect( | child: ClipRRect( | ||||
child: UploadImgItem( | child: UploadImgItem( | ||||
msg: widget.msg, | msg: widget.msg, | ||||
cancelToken: _cancelToken, | |||||
child: Container( | child: Container( | ||||
height: imgSize.height, | height: imgSize.height, | ||||
width: imgSize.width, | width: imgSize.width, | ||||
@@ -641,7 +626,6 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
UploadImgItem( | UploadImgItem( | ||||
msg: widget.msg, | msg: widget.msg, | ||||
cancelToken: _cancelToken, | |||||
child: Container( | child: Container( | ||||
width: imgSize.width, | width: imgSize.width, | ||||
height: imgSize.height, | height: imgSize.height, | ||||
@@ -702,7 +686,6 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
Widget _fileMsgItem() { | Widget _fileMsgItem() { | ||||
return UploadImgItem( | return UploadImgItem( | ||||
msg: widget.msg, | msg: widget.msg, | ||||
cancelToken: _cancelToken, | |||||
child: Container( | child: Container( | ||||
height: 100, | height: 100, | ||||
constraints: BoxConstraints(maxWidth: Screen.width - 120), | constraints: BoxConstraints(maxWidth: Screen.width - 120), | ||||
@@ -1083,7 +1066,8 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
print('请求人工翻译成功,进行扣费'); | print('请求人工翻译成功,进行扣费'); | ||||
setState(() { | setState(() { | ||||
widget.msg.transTag = 2; | widget.msg.transTag = 2; | ||||
SqlUtil().updateUserTranslateState(widget.msg.sessionId, | |||||
widget.msg.time, widget.msg.transTag); | |||||
//优先扣券 | //优先扣券 | ||||
if (voucher > 0) { | if (voucher > 0) { | ||||
int costQuan = min(voucher, needMoney); | int costQuan = min(voucher, needMoney); | ||||
@@ -1402,13 +1386,13 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
double width = 130; | double width = 130; | ||||
double minWidth = 0; | double minWidth = 0; | ||||
if (textList.length > 0 && textList[curTextType].length>0) { | |||||
if (textList.length > 0 && textList[curTextType].length > 0) { | |||||
print('textList哒哒哒哒哒 ${textList[curTextType]}'); | print('textList哒哒哒哒哒 ${textList[curTextType]}'); | ||||
width = _getTextWidth(textList[curTextType]) + 20; | width = _getTextWidth(textList[curTextType]) + 20; | ||||
width = min(width, Screen.width - 120); | width = min(width, Screen.width - 120); | ||||
if(width<130){ | |||||
width=130; | |||||
if (width < 130) { | |||||
width = 130; | |||||
} | } | ||||
showMsg.add(Padding( | showMsg.add(Padding( | ||||
@@ -14,6 +14,7 @@ import 'package:chat/chat/video_view.dart'; | |||||
import 'package:chat/data/UserData.dart'; | import 'package:chat/data/UserData.dart'; | ||||
import 'package:chat/data/constants.dart'; | import 'package:chat/data/constants.dart'; | ||||
import 'package:chat/utils/friend_list_mgr.dart'; | import 'package:chat/utils/friend_list_mgr.dart'; | ||||
import 'package:chat/utils/sql_util.dart'; | |||||
import 'package:chat/utils/wpop/w_popup_menu.dart'; | import 'package:chat/utils/wpop/w_popup_menu.dart'; | ||||
import 'package:flutter/services.dart'; | import 'package:flutter/services.dart'; | ||||
import 'package:chat/generated/i18n.dart'; | import 'package:chat/generated/i18n.dart'; | ||||
@@ -87,8 +88,6 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
String curSoundUrl; | String curSoundUrl; | ||||
CancelToken _cancelToken = CancelToken(); | |||||
bool isLongPressed = false; | bool isLongPressed = false; | ||||
double maxWidth = Screen.width - 140; | double maxWidth = Screen.width - 140; | ||||
@@ -106,26 +105,14 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
textList = widget.msg.getTransTextList(); | textList = widget.msg.getTransTextList(); | ||||
MessageMgr().on('Update Translate Message', updateTranslateMsg); | MessageMgr().on('Update Translate Message', updateTranslateMsg); | ||||
MessageMgr().on('Cancel Request', _deleteItem); | |||||
} | } | ||||
@override | @override | ||||
void dispose() { | void dispose() { | ||||
MessageMgr().off('Cancel Request', _deleteItem); | |||||
MessageMgr().off('Update Translate Message', updateTranslateMsg); | MessageMgr().off('Update Translate Message', updateTranslateMsg); | ||||
super.dispose(); | super.dispose(); | ||||
} | } | ||||
_deleteItem(msg) { | |||||
if (msg == widget.msg) { | |||||
print(widget.msg.state); | |||||
if (widget.msg.state == MsgState.Uploading) { | |||||
print('取消上传'); | |||||
UploadUtil().cancelRequests(_cancelToken); | |||||
} | |||||
} | |||||
} | |||||
updateTextList() { | updateTextList() { | ||||
textList.clear(); | textList.clear(); | ||||
curTextType = 0; | curTextType = 0; | ||||
@@ -578,7 +565,6 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
child: ClipRRect( | child: ClipRRect( | ||||
child: UploadImgItem( | child: UploadImgItem( | ||||
msg: widget.msg, | msg: widget.msg, | ||||
cancelToken: _cancelToken, | |||||
child: Container( | child: Container( | ||||
height: imgSize.height, | height: imgSize.height, | ||||
width: imgSize.width, | width: imgSize.width, | ||||
@@ -603,7 +589,6 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
UploadImgItem( | UploadImgItem( | ||||
msg: widget.msg, | msg: widget.msg, | ||||
cancelToken: _cancelToken, | |||||
child: Container( | child: Container( | ||||
width: imgSize.width, | width: imgSize.width, | ||||
height: imgSize.height, | height: imgSize.height, | ||||
@@ -660,7 +645,6 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
Widget _fileMsgItem() { | Widget _fileMsgItem() { | ||||
return UploadImgItem( | return UploadImgItem( | ||||
msg: widget.msg, | msg: widget.msg, | ||||
cancelToken: _cancelToken, | |||||
child: Container( | child: Container( | ||||
height: 100, | height: 100, | ||||
constraints: BoxConstraints(maxWidth: Screen.width - 120), | constraints: BoxConstraints(maxWidth: Screen.width - 120), | ||||
@@ -1063,7 +1047,8 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
print('请求人工翻译成功,进行扣费'); | print('请求人工翻译成功,进行扣费'); | ||||
setState(() { | setState(() { | ||||
widget.msg.transTag = 2; | widget.msg.transTag = 2; | ||||
SqlUtil().updateUserTranslateState(widget.msg.sessionId, | |||||
widget.msg.time, widget.msg.transTag); | |||||
//优先扣券 | //优先扣券 | ||||
if (voucher > 0) { | if (voucher > 0) { | ||||
int costQuan = min(voucher, needMoney); | int costQuan = min(voucher, needMoney); | ||||
@@ -1367,13 +1352,13 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
double width = 130; | double width = 130; | ||||
double minWidth = 0; | double minWidth = 0; | ||||
if (textList.length > 0 && textList[curTextType].length>0) { | |||||
if (textList.length > 0 && textList[curTextType].length > 0) { | |||||
width = _getTextWidth(textList[curTextType]) + 20; | width = _getTextWidth(textList[curTextType]) + 20; | ||||
width = min(width, Screen.width - 120); | width = min(width, Screen.width - 120); | ||||
minWidth = max(width, 150); | minWidth = max(width, 150); | ||||
if(width<130){ | |||||
width=130; | |||||
if (width < 130) { | |||||
width = 130; | |||||
} | } | ||||
showMsg.add(Padding( | showMsg.add(Padding( | ||||
@@ -307,122 +307,127 @@ class _GroupChatPageState extends State<GroupChatPage> { | |||||
Provider<GroupInfoModel>.value(value: widget.groupInfoModel), | Provider<GroupInfoModel>.value(value: widget.groupInfoModel), | ||||
], | ], | ||||
child: GestureDetector( | child: GestureDetector( | ||||
onTap:hideKeyBoard, child: ExtendedTextSelectionPointerHandler( | |||||
///选择文字,消除弹窗 | |||||
builder: (states) { | |||||
return Listener( | |||||
child: Scaffold( | |||||
resizeToAvoidBottomInset: false, | |||||
backgroundColor: const Color(0xFFE2E9F1), | |||||
appBar: AppBar( | |||||
backgroundColor: AppColors.NewAppbarBgColor, | |||||
title: Text( | |||||
widget.groupInfoModel.getGroupName(refMap), | |||||
textScaleFactor: 1.0, | |||||
style: TextStyle( | |||||
color: Constants.BlackTextColor, fontSize: 16.47), | |||||
), | |||||
leading: CustomUI.buildCustomLeading(context), | |||||
titleSpacing: -10, | |||||
elevation: 1, | |||||
centerTitle: false, | |||||
actions: actions), | |||||
body: SafeArea( | |||||
child: Stack( | |||||
children: <Widget>[ | |||||
Column( | |||||
onTap: hideKeyBoard, | |||||
child: ExtendedTextSelectionPointerHandler( | |||||
///选择文字,消除弹窗 | |||||
builder: (states) { | |||||
return Listener( | |||||
child: Scaffold( | |||||
resizeToAvoidBottomInset: false, | |||||
backgroundColor: const Color(0xFFE2E9F1), | |||||
appBar: AppBar( | |||||
backgroundColor: AppColors.NewAppbarBgColor, | |||||
title: Text( | |||||
widget.groupInfoModel.getGroupName(refMap), | |||||
textScaleFactor: 1.0, | |||||
style: TextStyle( | |||||
color: Constants.BlackTextColor, | |||||
fontSize: 16.47), | |||||
), | |||||
leading: CustomUI.buildCustomLeading(context), | |||||
titleSpacing: -10, | |||||
elevation: 1, | |||||
centerTitle: false, | |||||
actions: actions), | |||||
body: SafeArea( | |||||
child: Stack( | |||||
children: <Widget>[ | children: <Widget>[ | ||||
NetStateWidget(), | |||||
Expanded(child: _buildMessageList()), | |||||
InputBar(sendMsg: sendMsg), | |||||
], | |||||
), | |||||
isHaveUnreadNews | |||||
? Positioned( | |||||
top: 32.5, | |||||
right: 0, | |||||
child: InkWell( | |||||
onTap: () { | |||||
jumpToMsg( | |||||
isAlterYou ? alterTime : unreadTime); | |||||
clearUnreadNews(); | |||||
}, | |||||
child: Container( | |||||
alignment: Alignment.center, | |||||
decoration: BoxDecoration( | |||||
boxShadow: [ | |||||
BoxShadow( | |||||
color: Color(0x33000000), //阴影颜色 | |||||
blurRadius: 7, //阴影大小 | |||||
) | |||||
], | |||||
borderRadius: BorderRadius.only( | |||||
topLeft: Radius.circular(80), | |||||
bottomLeft: Radius.circular(80)), | |||||
color: Colors.white, | |||||
), | |||||
constraints: BoxConstraints(minWidth: 120), | |||||
height: 39, | |||||
child: Row( | |||||
children: <Widget>[ | |||||
SizedBox(width: 16.5), | |||||
Image.asset( | |||||
'assets/images/up.png', | |||||
width: 12, | |||||
Column( | |||||
children: <Widget>[ | |||||
NetStateWidget(), | |||||
Expanded(child: _buildMessageList()), | |||||
InputBar(sendMsg: sendMsg), | |||||
], | |||||
), | |||||
isHaveUnreadNews | |||||
? Positioned( | |||||
top: 32.5, | |||||
right: 0, | |||||
child: InkWell( | |||||
onTap: () { | |||||
jumpToMsg(isAlterYou | |||||
? alterTime | |||||
: unreadTime); | |||||
clearUnreadNews(); | |||||
}, | |||||
child: Container( | |||||
alignment: Alignment.center, | |||||
decoration: BoxDecoration( | |||||
boxShadow: [ | |||||
BoxShadow( | |||||
color: Color(0x33000000), //阴影颜色 | |||||
blurRadius: 7, //阴影大小 | |||||
) | |||||
], | |||||
borderRadius: BorderRadius.only( | |||||
topLeft: Radius.circular(80), | |||||
bottomLeft: Radius.circular(80)), | |||||
color: Colors.white, | |||||
), | ), | ||||
SizedBox(width: 10), | |||||
Container( | |||||
child: Text( | |||||
constraints: | |||||
BoxConstraints(minWidth: 120), | |||||
height: 39, | |||||
child: Row( | |||||
children: <Widget>[ | |||||
SizedBox(width: 16.5), | |||||
Image.asset( | |||||
'assets/images/up.png', | |||||
width: 12, | |||||
), | |||||
SizedBox(width: 10), | |||||
Container( | |||||
child: Text( | |||||
isAlterYou | |||||
? '$alterUserName' | |||||
: I18n.of(context) | |||||
.new_msg | |||||
.replaceFirst( | |||||
'/s1', | |||||
unreadNums | |||||
.toString()), | |||||
style: TextStyle( | |||||
color: Color(0xFF3875E9)), | |||||
overflow: | |||||
TextOverflow.ellipsis, | |||||
), | |||||
constraints: BoxConstraints( | |||||
maxWidth: isAlterYou | |||||
? 60 | |||||
: Screen.width)), | |||||
Text( | |||||
isAlterYou | isAlterYou | ||||
? '$alterUserName' | |||||
: I18n.of(context) | |||||
.new_msg | |||||
.replaceFirst( | |||||
'/s1', | |||||
unreadNums | |||||
.toString()), | |||||
? '@${I18n.of(context).you}' | |||||
: '', | |||||
style: TextStyle( | style: TextStyle( | ||||
color: Color(0xFF3875E9)), | color: Color(0xFF3875E9)), | ||||
overflow: TextOverflow.ellipsis, | |||||
), | ), | ||||
constraints: BoxConstraints( | |||||
maxWidth: isAlterYou | |||||
? 60 | |||||
: Screen.width)), | |||||
Text( | |||||
isAlterYou | |||||
? '@${I18n.of(context).you}' | |||||
: '', | |||||
style: TextStyle( | |||||
color: Color(0xFF3875E9)), | |||||
SizedBox(width: 14), | |||||
], | |||||
), | ), | ||||
SizedBox(width: 14), | |||||
], | |||||
), | |||||
))) | |||||
: Container() | |||||
], | |||||
))), | |||||
onPointerDown: (value) { | |||||
for (var state in states) { | |||||
if (!state.containsPosition(value.position)) { | |||||
//clear other selection | |||||
state.clearSelection(); | |||||
} | |||||
} | |||||
}, | |||||
onPointerMove: (value) { | |||||
//clear other selection | |||||
for (var state in states) { | |||||
if (!state.containsPosition(value.position)) { | |||||
))) | |||||
: Container() | |||||
], | |||||
))), | |||||
onPointerDown: (value) { | |||||
for (var state in states) { | |||||
if (!state.containsPosition(value.position)) { | |||||
//clear other selection | |||||
state.clearSelection(); | |||||
} | |||||
} | |||||
}, | |||||
onPointerMove: (value) { | |||||
//clear other selection | //clear other selection | ||||
state.clearSelection(); | |||||
} | |||||
} | |||||
for (var state in states) { | |||||
if (!state.containsPosition(value.position)) { | |||||
//clear other selection | |||||
state.clearSelection(); | |||||
} | |||||
} | |||||
}, | |||||
); | |||||
}, | }, | ||||
); | |||||
}, | |||||
))); | |||||
))); | |||||
} | } | ||||
Widget _buildMessageList() { | Widget _buildMessageList() { | ||||
@@ -510,7 +515,11 @@ class _GroupChatPageState extends State<GroupChatPage> { | |||||
} | } | ||||
_deleteItem(msg) { | _deleteItem(msg) { | ||||
MessageMgr().emit('Cancel Request', msg); | |||||
if (msg.state == MsgState.Uploading) { | |||||
print('取消上传'); | |||||
UploadUtil().cancelSendMsg(msg); | |||||
} | |||||
print('#### 开始删除--'); | print('#### 开始删除--'); | ||||
msgList.remove(msg); | msgList.remove(msg); | ||||
setState(() {}); | setState(() {}); | ||||
@@ -902,6 +902,13 @@ class InputBarState extends State<InputBar> | |||||
} | } | ||||
_sendMessage(String messageText, [bool isGift = false]) { | _sendMessage(String messageText, [bool isGift = false]) { | ||||
var testMsg = messageText.replaceAll(' ', ''); | |||||
if (testMsg.length <=0 ) { | |||||
showToast('不能发送空白消息'); | |||||
return; | |||||
} | |||||
bool isGroup = Provider.of<bool>(context); | bool isGroup = Provider.of<bool>(context); | ||||
int friendId = 0; | int friendId = 0; | ||||
@@ -1,6 +1,8 @@ | |||||
import 'package:chat/models/ChatMsg.dart'; | import 'package:chat/models/ChatMsg.dart'; | ||||
import 'package:chat/proto/chat.pbserver.dart'; | |||||
import 'package:chat/utils/MessageMgr.dart'; | import 'package:chat/utils/MessageMgr.dart'; | ||||
import 'package:chat/utils/msgHandler.dart'; | import 'package:chat/utils/msgHandler.dart'; | ||||
import 'package:chat/utils/upload_util.dart'; | |||||
import 'package:flutter/cupertino.dart'; | import 'package:flutter/cupertino.dart'; | ||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
@@ -81,11 +83,31 @@ class _MsgStateWidgetState extends State<MsgStateWidget> { | |||||
} else if (sendState == MsgState.SendingSuccess) { | } else if (sendState == MsgState.SendingSuccess) { | ||||
return Container(width: 0, height: 0); | return Container(width: 0, height: 0); | ||||
} else { | } else { | ||||
return Align( | |||||
alignment: Alignment.center, | |||||
child: Padding( | |||||
padding: EdgeInsets.only(top: 5), | |||||
child: CupertinoActivityIndicator())); | |||||
if (widget.msg.state == MsgState.Uploading) { | |||||
return Container( | |||||
child: IconButton( | |||||
iconSize: 22, | |||||
icon: Icon( | |||||
Icons.pause_circle_outline, | |||||
color: Colors.red, | |||||
), | |||||
onPressed: () { | |||||
print('暂停发送'); | |||||
UploadUtil().cancelSendMsg(widget.msg); | |||||
setState(() { | |||||
sendState = MsgState.UploadFailed; | |||||
}); | |||||
MsgHandler.sendChatMsg(widget.msg); | |||||
}, | |||||
), | |||||
); | |||||
} else { | |||||
return Align( | |||||
alignment: Alignment.center, | |||||
child: Padding( | |||||
padding: EdgeInsets.only(top: 5), | |||||
child: CupertinoActivityIndicator())); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -12,10 +12,9 @@ class UploadImgItem extends StatefulWidget { | |||||
final MsgModel msg; | final MsgModel msg; | ||||
final Widget child; | final Widget child; | ||||
final bool isShowProgress; | final bool isShowProgress; | ||||
final CancelToken cancelToken; | |||||
UploadImgItem( | UploadImgItem( | ||||
{this.msg, this.child, this.isShowProgress = true, this.cancelToken}); | |||||
{this.msg, this.child, this.isShowProgress = true}); | |||||
@override | @override | ||||
_UploadItemState createState() => _UploadItemState(); | _UploadItemState createState() => _UploadItemState(); | ||||
@@ -58,7 +57,7 @@ class _UploadItemState extends State<UploadImgItem> { | |||||
} | } | ||||
widget.msg.state = MsgState.Uploading; | widget.msg.state = MsgState.Uploading; | ||||
await UploadUtil().uploadFile(widget.msg, cancelToken: widget.cancelToken); | |||||
await UploadUtil().uploadFile(widget.msg); | |||||
if (mounted) { | if (mounted) { | ||||
this.setState(() {}); | this.setState(() {}); | ||||
@@ -87,11 +87,12 @@ class _UtilKeyboardState extends State<UtilKeyboard> { | |||||
} | } | ||||
AppNavigator.pushCoinBagPage(context); | AppNavigator.pushCoinBagPage(context); | ||||
}))); | }))); | ||||
iconList.add(_buildOtherSelect( | |||||
R.assetsImagesChatItem6, I18n.of(context).giving_gift, () { | |||||
_showGiftSheet(context); | |||||
})); | |||||
if (UserData().giftSwitch > 0) { | |||||
iconList.add(_buildOtherSelect( | |||||
R.assetsImagesChatItem6, I18n.of(context).giving_gift, () { | |||||
_showGiftSheet(context); | |||||
})); | |||||
} | |||||
} | } | ||||
iconList.add(_buildOtherSelect( | iconList.add(_buildOtherSelect( | ||||
@@ -313,11 +314,10 @@ class _UtilKeyboardState extends State<UtilKeyboard> { | |||||
showToast(I18n.of(context).max_file.replaceFirst('/s1', 33.toString())); | showToast(I18n.of(context).max_file.replaceFirst('/s1', 33.toString())); | ||||
return; | return; | ||||
} | } | ||||
///ios存在着文件夹才打得开 | |||||
File newFile= await FileCacheMgr().writeFile(file.path.split('/').last, file.readAsBytesSync()); | |||||
///ios存在着文件夹才打得开 | |||||
File newFile = await FileCacheMgr() | |||||
.writeFile(file.path.split('/').last, file.readAsBytesSync()); | |||||
int friendId = 0; | int friendId = 0; | ||||
if (!widget.isGroup) { | if (!widget.isGroup) { | ||||
@@ -394,12 +394,12 @@ class _UtilKeyboardState extends State<UtilKeyboard> { | |||||
if (thumbnail.length > ImgSizeLimit) { | if (thumbnail.length > ImgSizeLimit) { | ||||
print('图片较大 ${thumbnail.length}'); | print('图片较大 ${thumbnail.length}'); | ||||
File file =await FileCacheMgr().writeFile(DateTime.now().millisecondsSinceEpoch.toString(),thumbnail); | |||||
File file = await FileCacheMgr().writeFile( | |||||
DateTime.now().millisecondsSinceEpoch.toString(), thumbnail); | |||||
File compressedFile = await FlutterNativeImage.compressImage(file.path, | File compressedFile = await FlutterNativeImage.compressImage(file.path, | ||||
quality: 30, percentage: 40); | quality: 30, percentage: 40); | ||||
thumbnail =compressedFile.readAsBytesSync().toList(); | |||||
thumbnail = compressedFile.readAsBytesSync().toList(); | |||||
// thumbnail = await FlutterImageCompress.compressWithList(thumbnail, quality: 10); | // thumbnail = await FlutterImageCompress.compressWithList(thumbnail, quality: 10); | ||||
@@ -139,7 +139,6 @@ class ChatDataMgr { | |||||
} | } | ||||
int maxLen = min(curIndex + 4, record.length); | int maxLen = min(curIndex + 4, record.length); | ||||
print('curIndex:$curIndex maxLen:$maxLen}'); | |||||
for (var i = curIndex + 1; i < maxLen; i++) { | for (var i = curIndex + 1; i < maxLen; i++) { | ||||
var shortDesc = record[i].shortRecordForTranslator(); | var shortDesc = record[i].shortRecordForTranslator(); | ||||
// print('shortDesc'+shortDesc['Content']); | // print('shortDesc'+shortDesc['Content']); | ||||
@@ -85,6 +85,9 @@ class _MyProgramPageState extends State<MyProgramPage> { | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if (list.length == 0) { | |||||
_onRefresh(); | |||||
} | |||||
} | } | ||||
Future getData(callback) async { | Future getData(callback) async { | ||||
@@ -170,8 +173,7 @@ class _MyProgramPageState extends State<MyProgramPage> { | |||||
), | ), | ||||
centerTitle: true, | centerTitle: true, | ||||
leading: CustomUI.buildCustomLeading(context), | leading: CustomUI.buildCustomLeading(context), | ||||
elevation: 1, | |||||
elevation: 1, | |||||
actions: <Widget>[ | actions: <Widget>[ | ||||
isMyself | isMyself | ||||
? myPop.PopupMenuButton<String>( | ? myPop.PopupMenuButton<String>( | ||||
@@ -143,6 +143,8 @@ class _ProfilePageState extends State<ProfilePage> | |||||
bool isShowAll = false; | bool isShowAll = false; | ||||
double fansWidth = Screen.width - 105; | |||||
getUserInfo({mymsg = ''}) async { | getUserInfo({mymsg = ''}) async { | ||||
if (mymsg != '' && mymsg != null) { | if (mymsg != '' && mymsg != null) { | ||||
UserData().basicInfo.ownMsg = mymsg; | UserData().basicInfo.ownMsg = mymsg; | ||||
@@ -312,6 +314,14 @@ class _ProfilePageState extends State<ProfilePage> | |||||
} | } | ||||
} | } | ||||
addProgramCallback(data) { | |||||
if (mounted) { | |||||
setState(() { | |||||
userInfo.dynamicNum++; | |||||
}); | |||||
} | |||||
} | |||||
void messageOn() { | void messageOn() { | ||||
MessageMgr().on('inform_sucess', msgInformSucess); | MessageMgr().on('inform_sucess', msgInformSucess); | ||||
MessageMgr().on('refresh_money', msgBuyVip); | MessageMgr().on('refresh_money', msgBuyVip); | ||||
@@ -321,6 +331,7 @@ class _ProfilePageState extends State<ProfilePage> | |||||
MessageMgr().on('refresh_love_list', msgRefreshLoveList); | MessageMgr().on('refresh_love_list', msgRefreshLoveList); | ||||
MessageMgr().on('refresh_fans_num', msgRefreshFansNum); | MessageMgr().on('refresh_fans_num', msgRefreshFansNum); | ||||
MessageMgr().on('change_my_headview', msgChangeMyHeadView); | MessageMgr().on('change_my_headview', msgChangeMyHeadView); | ||||
MessageMgr().on('Add_program', addProgramCallback); | |||||
} | } | ||||
void messageOff() { | void messageOff() { | ||||
@@ -332,6 +343,7 @@ class _ProfilePageState extends State<ProfilePage> | |||||
MessageMgr().off('refresh_love_list', msgRefreshLoveList); | MessageMgr().off('refresh_love_list', msgRefreshLoveList); | ||||
MessageMgr().off('refresh_fans_num', msgRefreshFansNum); | MessageMgr().off('refresh_fans_num', msgRefreshFansNum); | ||||
MessageMgr().off('change_my_headview', msgChangeMyHeadView); | MessageMgr().off('change_my_headview', msgChangeMyHeadView); | ||||
MessageMgr().off('Add_program', addProgramCallback); | |||||
} | } | ||||
msgChangeMyHeadView(data) { | msgChangeMyHeadView(data) { | ||||
@@ -385,7 +397,7 @@ class _ProfilePageState extends State<ProfilePage> | |||||
Widget _buildSignIn() { | Widget _buildSignIn() { | ||||
return Container( | return Container( | ||||
margin: EdgeInsets.only(top: Separate_Size, bottom: Separate_Size), | |||||
margin: EdgeInsets.only(top: 19, bottom: 19), | |||||
padding: EdgeInsets.symmetric(horizontal: 10), | padding: EdgeInsets.symmetric(horizontal: 10), | ||||
child: FullWidthButton( | child: FullWidthButton( | ||||
iconCode: 0xe65c, | iconCode: 0xe65c, | ||||
@@ -394,6 +406,10 @@ class _ProfilePageState extends State<ProfilePage> | |||||
title: I18n.of(context).sign_in, | title: I18n.of(context).sign_in, | ||||
showDivider: false, | showDivider: false, | ||||
onPressed: () { | onPressed: () { | ||||
if (UserData().sign <= 0) { | |||||
showToast(I18n.of(context).system_not_open); | |||||
return; | |||||
} | |||||
Navigator.of(context).push(MaterialPageRoute( | Navigator.of(context).push(MaterialPageRoute( | ||||
builder: (context) { | builder: (context) { | ||||
return DailyBonusPage(); | return DailyBonusPage(); | ||||
@@ -446,7 +462,8 @@ class _ProfilePageState extends State<ProfilePage> | |||||
padding: EdgeInsets.only(top: 19), | padding: EdgeInsets.only(top: 19), | ||||
child: Column( | child: Column( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Row( | |||||
Container( | |||||
child: Row( | |||||
crossAxisAlignment: CrossAxisAlignment.center, | crossAxisAlignment: CrossAxisAlignment.center, | ||||
children: <Widget>[ | children: <Widget>[ | ||||
_buildHeadImg(), | _buildHeadImg(), | ||||
@@ -455,7 +472,7 @@ class _ProfilePageState extends State<ProfilePage> | |||||
_buildButtonList(), | _buildButtonList(), | ||||
]) | ]) | ||||
], | ], | ||||
), | |||||
)), | |||||
_buildUserChips(), | _buildUserChips(), | ||||
_buildAttestation(), | _buildAttestation(), | ||||
_buildMyMsg(), | _buildMyMsg(), | ||||
@@ -473,7 +490,7 @@ class _ProfilePageState extends State<ProfilePage> | |||||
bool showAllContent = isExpansion(userInfo.ownMsg, width); | bool showAllContent = isExpansion(userInfo.ownMsg, width); | ||||
return Container( | return Container( | ||||
padding: | padding: | ||||
EdgeInsets.only(left: 25.5, bottom: isMyself ? 20 : 5, right: 10), | |||||
EdgeInsets.only(left: 25.5, bottom: isMyself ? 20 : 20, right: 10), | |||||
child: userInfo.ownMsg == null || userInfo.ownMsg == '' | child: userInfo.ownMsg == null || userInfo.ownMsg == '' | ||||
? (isMyself | ? (isMyself | ||||
? InkWell( | ? InkWell( | ||||
@@ -635,7 +652,7 @@ class _ProfilePageState extends State<ProfilePage> | |||||
]; | ]; | ||||
} else if (userInfo.sex == UserData().basicInfo.sex) { | } else if (userInfo.sex == UserData().basicInfo.sex) { | ||||
list = [ | list = [ | ||||
_buildBorderButton(I18n.of(context).private_chat, 140, | |||||
_buildBorderButton(I18n.of(context).private_chat, fansWidth - 80, | |||||
isCanWatch ? buyChatAccount : cannotWatchTips, | isCanWatch ? buyChatAccount : cannotWatchTips, | ||||
iconCode: IconData(0xe68c, fontFamily: 'iconfont')), | iconCode: IconData(0xe68c, fontFamily: 'iconfont')), | ||||
]; | ]; | ||||
@@ -702,7 +719,7 @@ class _ProfilePageState extends State<ProfilePage> | |||||
return InkWell( | return InkWell( | ||||
onTap: callback, | onTap: callback, | ||||
child: Container( | child: Container( | ||||
width: (Screen.width - 105) / 3, | |||||
width: fansWidth / 3, | |||||
child: Column( | child: Column( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Stack( | Stack( | ||||
@@ -828,11 +845,11 @@ class _ProfilePageState extends State<ProfilePage> | |||||
textScaleFactor: 1.0, | textScaleFactor: 1.0, | ||||
style: TextStyle(fontSize: 9, color: Colors.white), | style: TextStyle(fontSize: 9, color: Colors.white), | ||||
)) | )) | ||||
: Text(''), | |||||
: Container(width: 0), | |||||
isVip && isMan | isVip && isMan | ||||
? Container( | ? Container( | ||||
child: isSvip ? Constants.svipIcon : Constants.vipIcon) | child: isSvip ? Constants.svipIcon : Constants.vipIcon) | ||||
: Text(''), | |||||
: Container(width: 0), | |||||
(isAttestation && !isMan) || isVip && isMan | (isAttestation && !isMan) || isVip && isMan | ||||
? _buildDivder() | ? _buildDivder() | ||||
: Container(), | : Container(), | ||||
@@ -1015,7 +1032,7 @@ class _ProfilePageState extends State<ProfilePage> | |||||
child.addAll([ | child.addAll([ | ||||
_buildHeadView(), | _buildHeadView(), | ||||
Container( | Container( | ||||
margin: EdgeInsets.only(top: Separate_Size, bottom: Separate_Size), | |||||
margin: EdgeInsets.only(top: 19, bottom: 19), | |||||
padding: EdgeInsets.symmetric(horizontal: 10), | padding: EdgeInsets.symmetric(horizontal: 10), | ||||
child: _buildPicture(), | child: _buildPicture(), | ||||
decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
@@ -1485,7 +1502,6 @@ class _ProfilePageState extends State<ProfilePage> | |||||
return Container( | return Container( | ||||
width: cardWidth, | width: cardWidth, | ||||
margin: EdgeInsets.only(top: Separate_Size), | |||||
decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
color: Colors.white, | color: Colors.white, | ||||
border: Border( | border: Border( | ||||
@@ -1511,7 +1527,6 @@ class _ProfilePageState extends State<ProfilePage> | |||||
Widget _buildMoneyBox() { | Widget _buildMoneyBox() { | ||||
//认证、钱包、隐私连麦设置 | //认证、钱包、隐私连麦设置 | ||||
return Container( | return Container( | ||||
margin: EdgeInsets.only(top: Separate_Size), | |||||
decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
color: Colors.white, | color: Colors.white, | ||||
border: Border( | border: Border( | ||||
@@ -1604,7 +1619,7 @@ class _ProfilePageState extends State<ProfilePage> | |||||
); | ); | ||||
} | } | ||||
Widget _buildIcon(code, str, isCanHit, callback, {iconSize = 28.0}) { | |||||
Widget _buildIcon(code, str, isCanHit, callback, {iconSize = 30.0}) { | |||||
var color = isCanHit ? Constants.BlueTextColor : Constants.GreyTextColor; | var color = isCanHit ? Constants.BlueTextColor : Constants.GreyTextColor; | ||||
return InkWell( | return InkWell( | ||||
onTap: isCanHit | onTap: isCanHit | ||||
@@ -1628,7 +1643,7 @@ class _ProfilePageState extends State<ProfilePage> | |||||
child: Text( | child: Text( | ||||
str, | str, | ||||
textScaleFactor: 1.0, | textScaleFactor: 1.0, | ||||
style: TextStyle(color: color, fontSize: 12), | |||||
style: TextStyle(color: color, fontSize: 14), | |||||
), | ), | ||||
padding: EdgeInsets.only(left: 5)) | padding: EdgeInsets.only(left: 5)) | ||||
], | ], | ||||
@@ -43,12 +43,11 @@ class _WhiteAndBlackPageState extends State<WhiteAndBlackPage> { | |||||
var item = list[i]; | var item = list[i]; | ||||
if (item['FollowUserId'] == data['UserId'] && data['flag'] != 0) { | if (item['FollowUserId'] == data['UserId'] && data['flag'] != 0) { | ||||
list.removeAt(i); | list.removeAt(i); | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if (list.length == 0) { | if (list.length == 0) { | ||||
_refreshController.refreshCompleted(); | |||||
_onRefresh(); | |||||
} | } | ||||
setState(() {}); | setState(() {}); | ||||
} | } | ||||
@@ -176,7 +175,7 @@ class _WhiteAndBlackPageState extends State<WhiteAndBlackPage> { | |||||
setState(() { | setState(() { | ||||
list.removeAt(i); | list.removeAt(i); | ||||
if (list.length == 0) { | if (list.length == 0) { | ||||
_refreshController.refreshCompleted(); | |||||
_onRefresh(); | |||||
} | } | ||||
}); | }); | ||||
break; | break; | ||||
@@ -265,7 +265,8 @@ class GroupSettingState extends State<GroupSetting> { | |||||
setState(() { | setState(() { | ||||
showGroupFriendNickname = val; | showGroupFriendNickname = val; | ||||
widget.groupInfoModel.updateShowNameSwitch(val); | widget.groupInfoModel.updateShowNameSwitch(val); | ||||
MsgHandler.setGroupIsShowMenberNiceNameReq(widget.groupInfoModel.sessionId, val); | |||||
MsgHandler.setGroupIsShowMenberNiceNameReq( | |||||
widget.groupInfoModel.sessionId, val); | |||||
}); | }); | ||||
}), | }), | ||||
@@ -540,8 +541,11 @@ class GroupSettingState extends State<GroupSetting> { | |||||
List<Widget> list = []; | List<Widget> list = []; | ||||
for (int index = 0; index < shouldShow; index++) { | for (int index = 0; index < shouldShow; index++) { | ||||
var member = members[index]; | var member = members[index]; | ||||
var refName = Provider.of<RefNameProvider>(context) | |||||
.getGroupRefName(widget.groupInfoModel.sessionId, member.memberId); | |||||
bool isMyself = member.memberId == UserData().basicInfo.userId; | |||||
var refName = isMyself | |||||
? UserData().basicInfo.nickName | |||||
: Provider.of<RefNameProvider>(context).getGroupRefName( | |||||
widget.groupInfoModel.sessionId, member.memberId); | |||||
list.add(GestureDetector( | list.add(GestureDetector( | ||||
child: Container( | child: Container( | ||||
child: Column( | child: Column( | ||||
@@ -558,9 +562,7 @@ class GroupSettingState extends State<GroupSetting> { | |||||
width: size - 30, | width: size - 30, | ||||
height: size - 30, | height: size - 30, | ||||
)), | )), | ||||
SizedBox( | |||||
height: 5, | |||||
), | |||||
SizedBox(height: 5), | |||||
Container( | Container( | ||||
width: size - 30, | width: size - 30, | ||||
alignment: Alignment.center, | alignment: Alignment.center, | ||||
@@ -582,7 +584,10 @@ class GroupSettingState extends State<GroupSetting> { | |||||
onTap: () { | onTap: () { | ||||
if (members[index].memberId != UserData().basicInfo.userId) { | if (members[index].memberId != UserData().basicInfo.userId) { | ||||
AppNavigator.pushProfileInfoPage(context, members[index].memberId, | AppNavigator.pushProfileInfoPage(context, members[index].memberId, | ||||
fromWhere: 2, addMode: !FriendListMgr().isMyFriend(members[index].memberId) ? 1 : 0); | |||||
fromWhere: 2, | |||||
addMode: !FriendListMgr().isMyFriend(members[index].memberId) | |||||
? 1 | |||||
: 0); | |||||
} | } | ||||
}, | }, | ||||
)); | )); | ||||
@@ -31,6 +31,7 @@ import 'package:oktoast/oktoast.dart'; | |||||
import 'package:provider/provider.dart'; | import 'package:provider/provider.dart'; | ||||
import 'package:shared_preferences/shared_preferences.dart'; | import 'package:shared_preferences/shared_preferences.dart'; | ||||
import 'package:chat/utils/my_bottom_navigation_bar.dart' as myBottm; | import 'package:chat/utils/my_bottom_navigation_bar.dart' as myBottm; | ||||
import 'realtimehelper/real_time_helper_page.dart'; | |||||
import 'friend_page.dart'; | import 'friend_page.dart'; | ||||
import 'group_chat_page.dart'; | import 'group_chat_page.dart'; | ||||
@@ -362,121 +363,121 @@ class _HomeMainState extends State<HomeMain> { | |||||
I18n.of(context).me | I18n.of(context).me | ||||
]; | ]; | ||||
// _navigationViews = [ | |||||
// NavigationIconView( | |||||
// title: _titles[2], | |||||
// icon: IconData( | |||||
// 0xe67c, | |||||
// fontFamily: 'iconfont', | |||||
// ), | |||||
// isShowdot: true, | |||||
// iconSize: 29), | |||||
// NavigationIconView( | |||||
// title: _titles[0], | |||||
// isShowdot: true, | |||||
// iconMargin: EdgeInsets.only(top: 2), | |||||
// type: 5, | |||||
// icon: IconData( | |||||
// 0xe66e, | |||||
// fontFamily: 'iconfont', | |||||
// ), | |||||
// iconSize: 26.5), | |||||
// NavigationIconView( | |||||
// title: _titles[1], | |||||
// icon: IconData( | |||||
// 0xe656, | |||||
// fontFamily: 'iconfont', | |||||
// ), | |||||
// isCenter: true, | |||||
// iconSize: 31), | |||||
// NavigationIconView( | |||||
// title: _titles[1], | |||||
// isShowdot: true, | |||||
// icon: IconData( | |||||
// 0xe60b, | |||||
// fontFamily: 'iconfont', | |||||
// ), | |||||
// type: 6, | |||||
// iconSize: 26.5), | |||||
// NavigationIconView( | |||||
// title: _titles[3], | |||||
// icon: IconData( | |||||
// 0xe67b, | |||||
// fontFamily: 'iconfont', | |||||
// ), | |||||
// iconSize: 26.5), | |||||
// ]; | |||||
// | |||||
// _pages = [ | |||||
// RealTimeHelperPage(), | |||||
// FriendPage(), | |||||
// FindPage(), | |||||
// ConversActionPage(), | |||||
//// GroupChatListPage(), | |||||
// ProfilePage( | |||||
// userId: UserData().basicInfo.userId, | |||||
// ), | |||||
// ]; | |||||
_navigationViews = [ | |||||
NavigationIconView( | |||||
title: _titles[1], | |||||
isShowdot: true, | |||||
icon: IconData( | |||||
0xe60b, | |||||
fontFamily: 'iconfont', | |||||
), | |||||
type: 1, | |||||
iconSize: 26.5), | |||||
NavigationIconView( | |||||
title: _titles[0], | |||||
isShowdot: true, | |||||
iconMargin: EdgeInsets.only(top: 2), | |||||
type: 5, | |||||
icon: IconData( | |||||
0xe663, | |||||
fontFamily: 'iconfont', | |||||
), | |||||
iconSize: 26.5), | |||||
NavigationIconView( | |||||
title: _titles[1], | |||||
icon: IconData( | |||||
0xe656, | |||||
fontFamily: 'iconfont', | |||||
), | |||||
isCenter: true, | |||||
iconSize: 31), | |||||
NavigationIconView( | |||||
title: _titles[3], | |||||
isShowdot: true, | |||||
icon: IconData( | |||||
0xe66e, | |||||
fontFamily: 'iconfont', | |||||
), | |||||
type: 4, | |||||
iconSize: 26.5), | |||||
NavigationIconView( | |||||
title: _titles[3], | |||||
icon: IconData( | |||||
0xe67b, | |||||
fontFamily: 'iconfont', | |||||
), | |||||
iconSize: 26.5), | |||||
]; | |||||
_pages = [ | |||||
ConversActionPage(), | |||||
// RealTimeHelperPage(), | |||||
FriendPage(), | |||||
FindPage(), | |||||
// ConversActionPage(), | |||||
GroupChatListPage(), | |||||
ProfilePage( | |||||
userId: UserData().basicInfo.userId, | |||||
), | |||||
]; | |||||
_navigationViews = [ | |||||
NavigationIconView( | |||||
title: _titles[2], | |||||
icon: IconData( | |||||
0xe67c, | |||||
fontFamily: 'iconfont', | |||||
), | |||||
isShowdot: true, | |||||
iconSize: 29), | |||||
NavigationIconView( | |||||
title: _titles[0], | |||||
isShowdot: true, | |||||
iconMargin: EdgeInsets.only(top: 2), | |||||
type: 5, | |||||
icon: IconData( | |||||
0xe66e, | |||||
fontFamily: 'iconfont', | |||||
), | |||||
iconSize: 26.5), | |||||
NavigationIconView( | |||||
title: _titles[1], | |||||
icon: IconData( | |||||
0xe656, | |||||
fontFamily: 'iconfont', | |||||
), | |||||
isCenter: true, | |||||
iconSize: 31), | |||||
NavigationIconView( | |||||
title: _titles[1], | |||||
isShowdot: true, | |||||
icon: IconData( | |||||
0xe60b, | |||||
fontFamily: 'iconfont', | |||||
), | |||||
type: 6, | |||||
iconSize: 26.5), | |||||
NavigationIconView( | |||||
title: _titles[3], | |||||
icon: IconData( | |||||
0xe67b, | |||||
fontFamily: 'iconfont', | |||||
), | |||||
iconSize: 26.5), | |||||
]; | |||||
_pages = [ | |||||
RealTimeHelperPage(), | |||||
FriendPage(), | |||||
FindPage(), | |||||
ConversActionPage(), | |||||
// GroupChatListPage(), | |||||
ProfilePage( | |||||
userId: UserData().basicInfo.userId, | |||||
), | |||||
]; | |||||
// _navigationViews = [ | |||||
// NavigationIconView( | |||||
// title: _titles[1], | |||||
// isShowdot: true, | |||||
// icon: IconData( | |||||
// 0xe60b, | |||||
// fontFamily: 'iconfont', | |||||
// ), | |||||
// type: 1, | |||||
// iconSize: 26.5), | |||||
// NavigationIconView( | |||||
// title: _titles[0], | |||||
// isShowdot: true, | |||||
// iconMargin: EdgeInsets.only(top: 2), | |||||
// type: 5, | |||||
// icon: IconData( | |||||
// 0xe663, | |||||
// fontFamily: 'iconfont', | |||||
// ), | |||||
// iconSize: 26.5), | |||||
// NavigationIconView( | |||||
// title: _titles[1], | |||||
// icon: IconData( | |||||
// 0xe656, | |||||
// fontFamily: 'iconfont', | |||||
// ), | |||||
// isCenter: true, | |||||
// iconSize: 31), | |||||
// NavigationIconView( | |||||
// title: _titles[3], | |||||
// isShowdot: true, | |||||
// icon: IconData( | |||||
// 0xe66e, | |||||
// fontFamily: 'iconfont', | |||||
// ), | |||||
// type: 4, | |||||
// iconSize: 26.5), | |||||
// NavigationIconView( | |||||
// title: _titles[3], | |||||
// icon: IconData( | |||||
// 0xe67b, | |||||
// fontFamily: 'iconfont', | |||||
// ), | |||||
// iconSize: 26.5), | |||||
// ]; | |||||
// _pages = [ | |||||
// ConversActionPage(), | |||||
// // RealTimeHelperPage(), | |||||
// FriendPage(), | |||||
// FindPage(), | |||||
// // ConversActionPage(), | |||||
// GroupChatListPage(), | |||||
// ProfilePage( | |||||
// userId: UserData().basicInfo.userId, | |||||
// ), | |||||
// ]; | |||||
} | } | ||||
@override | @override | ||||
@@ -331,7 +331,8 @@ class MoneyDetailPageState extends State<MoneyDetailPage> | |||||
//余额Status 0=交易成功,1=系统退回 | //余额Status 0=交易成功,1=系统退回 | ||||
//收入 0=冻结 ,1=成功 ,2= 退回 | //收入 0=冻结 ,1=成功 ,2= 退回 | ||||
//冻结和成功,你都可以表示成功 | //冻结和成功,你都可以表示成功 | ||||
showReturn: (widget.type == 1 && data['Status'] ==1) || (widget.type == 2 && data['Status'] ==2), | |||||
showReturn: (widget.type == 1 && data['Status'] == 1) || | |||||
(widget.type == 2 && data['Status'] == 2 && data['DetailType'] != 1), | |||||
isInCome: widget.type == 2, | isInCome: widget.type == 2, | ||||
money: isAdd(data['DetailType']) ? data['Value'] : -data['Value'], | money: isAdd(data['DetailType']) ? data['Value'] : -data['Value'], | ||||
title: RichTitle.getRichTitleWidget(data, context, | title: RichTitle.getRichTitleWidget(data, context, | ||||
@@ -8,10 +8,12 @@ import 'package:chat/utils/HttpUtil.dart'; | |||||
import 'package:chat/utils/MessageMgr.dart'; | import 'package:chat/utils/MessageMgr.dart'; | ||||
import 'package:chat/utils/TokenMgr.dart'; | import 'package:chat/utils/TokenMgr.dart'; | ||||
import 'package:chat/utils/conversation_table.dart'; | import 'package:chat/utils/conversation_table.dart'; | ||||
import 'package:chat/utils/screen.dart'; | |||||
import 'package:dio/dio.dart'; | import 'package:dio/dio.dart'; | ||||
import 'package:cached_network_image/cached_network_image.dart'; | import 'package:cached_network_image/cached_network_image.dart'; | ||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:flutter/services.dart'; | import 'package:flutter/services.dart'; | ||||
import 'package:oktoast/oktoast.dart'; | |||||
import 'package:provider/provider.dart'; | import 'package:provider/provider.dart'; | ||||
import 'package:chat/models/friends_info.dart'; | import 'package:chat/models/friends_info.dart'; | ||||
import 'ProfilePage.dart'; | import 'ProfilePage.dart'; | ||||
@@ -120,6 +122,52 @@ class _ContactItem extends StatelessWidget { | |||||
), | ), | ||||
); | ); | ||||
_button = Dismissible( | |||||
key: Key(userId.toString()), | |||||
child: _button, | |||||
direction: DismissDirection.endToStart, | |||||
background: Container( | |||||
color: Colors.red, | |||||
child: Row( | |||||
mainAxisAlignment: MainAxisAlignment.end, | |||||
children: <Widget>[ | |||||
fixedText(I18n.of(context).delete, color: Colors.white), | |||||
Icon( | |||||
Icons.delete, | |||||
color: Colors.white, | |||||
), | |||||
SizedBox(width: 20), | |||||
], | |||||
), | |||||
), | |||||
confirmDismiss: (direction) async { | |||||
var _confirmContent = I18n.of(context).confirm_delete; | |||||
bool isDismiss = | |||||
await CustomUI.showIosDialog(context, _confirmContent, () async { | |||||
Map data = { | |||||
"userId": UserData().basicInfo.userId, | |||||
"aUserId": userId, | |||||
}; | |||||
data['sign'] = TokenMgr().getSign(data); | |||||
Response res = await HttpUtil().post( | |||||
'friendship/delete/applicationRecord', | |||||
data: data, | |||||
isShowLoading: true); | |||||
Map resData = res.data; | |||||
//showToast(resData['msg']); | |||||
if (resData['code'] == 0) { | |||||
MessageMgr().emit('delete_friend_record', userId); | |||||
} | |||||
Navigator.of(context).pop(true); | |||||
}, () { | |||||
Navigator.of(context).pop(false); | |||||
}); | |||||
return isDismiss; | |||||
}); | |||||
//分组标签 | //分组标签 | ||||
Widget _itemBody; | Widget _itemBody; | ||||
if (this.groupTitle != null) { | if (this.groupTitle != null) { | ||||
@@ -201,6 +249,7 @@ class _NewFriendsPageState extends State<NewFriendsPage> { | |||||
getNewFriendList(); | getNewFriendList(); | ||||
_scrollController = new ScrollController(); | _scrollController = new ScrollController(); | ||||
MessageMgr().on('do_friend_apply', messageApply); | MessageMgr().on('do_friend_apply', messageApply); | ||||
MessageMgr().on('delete_friend_record', deleteFriendRecord); | |||||
_functionButtons = [ | _functionButtons = [ | ||||
FriendsInfo( | FriendsInfo( | ||||
@@ -257,6 +306,17 @@ class _NewFriendsPageState extends State<NewFriendsPage> { | |||||
} | } | ||||
} | } | ||||
deleteFriendRecord(userId) { | |||||
for (int i = 0; i < friendList.length; i++) { | |||||
if (friendList[i].friendId == userId) { | |||||
setState(() { | |||||
friendList.removeAt(i); | |||||
}); | |||||
break; | |||||
} | |||||
} | |||||
} | |||||
getNewFriendList() async { | getNewFriendList() async { | ||||
Map data = { | Map data = { | ||||
"userId": UserData().basicInfo.userId, | "userId": UserData().basicInfo.userId, | ||||
@@ -281,8 +341,9 @@ class _NewFriendsPageState extends State<NewFriendsPage> { | |||||
@override | @override | ||||
void dispose() { | void dispose() { | ||||
_scrollController.dispose(); | _scrollController.dispose(); | ||||
super.dispose(); | |||||
MessageMgr().off('do_friend_apply', messageApply); | MessageMgr().off('do_friend_apply', messageApply); | ||||
MessageMgr().off('delete_friend_record', deleteFriendRecord); | |||||
super.dispose(); | |||||
} | } | ||||
@override | @override | ||||
@@ -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) { | ||||
@@ -1178,7 +1178,7 @@ class HttpUtil { | |||||
callback(); | callback(); | ||||
} | } | ||||
SqlUtil().updateUserTranslateRate(msg.sessionId, msg.time, msg.transTag); | |||||
SqlUtil().updateUserTranslateState(msg.sessionId, msg.time, msg.transTag); | |||||
return true; | return true; | ||||
} | } | ||||
@@ -169,8 +169,8 @@ class ChatDataTableModel { | |||||
whereArgs: [curUserId, session, sendTime]); | whereArgs: [curUserId, session, sendTime]); | ||||
} | } | ||||
//更新人工翻译评价 | |||||
updateUserTranslateRate(int session, int sendTime, int tranState) async { | |||||
//更新人工翻译状态 | |||||
updateUserTranslateState(int session, int sendTime, int tranState) async { | |||||
var curUserId = UserData().basicInfo.userId; | var curUserId = UserData().basicInfo.userId; | ||||
sql.db.update(table, {'transTag': tranState}, | sql.db.update(table, {'transTag': tranState}, | ||||
@@ -172,7 +172,7 @@ class GroupChatTableModel { | |||||
} | } | ||||
//更新人工翻译评价 | //更新人工翻译评价 | ||||
updateUserTranslateRate(int session, int sendTime, int tranState) async { | |||||
updateUserTranslateState(int session, int sendTime, int tranState) async { | |||||
var curUserId = UserData().basicInfo.userId; | var curUserId = UserData().basicInfo.userId; | ||||
sql.db.update(table, {'transTag': tranState}, | sql.db.update(table, {'transTag': tranState}, | ||||
@@ -119,9 +119,11 @@ class SqlUtil { | |||||
session, sendTime, transContent, tranState); | session, sendTime, transContent, tranState); | ||||
} | } | ||||
//更新人工翻译评价 | |||||
updateUserTranslateRate(int session, int sendTime, int tranState) async { | |||||
chatDataTableModel.updateUserTranslateRate(session, sendTime, tranState); | |||||
//更新人工翻译状态 | |||||
updateUserTranslateState(int session, int sendTime, int tranState) async { | |||||
chatDataTableModel.updateUserTranslateState(session, sendTime, tranState); | |||||
} | } | ||||
//更新消息发送状态 | //更新消息发送状态 | ||||
@@ -42,6 +42,9 @@ class UploadUtil { | |||||
//进度流 | //进度流 | ||||
Map<String, StreamController<double>> streamMap = {}; | Map<String, StreamController<double>> streamMap = {}; | ||||
//取消map | |||||
Map<String, CancelToken> cancelMap = {}; | |||||
//缓存进度,方便快速显示 | //缓存进度,方便快速显示 | ||||
Map<String, double> streamLastPercentMap = {}; | Map<String, double> streamLastPercentMap = {}; | ||||
@@ -104,6 +107,20 @@ class UploadUtil { | |||||
return streamMap[fileId]; | return streamMap[fileId]; | ||||
} | } | ||||
getCancelToken(String fileId) { | |||||
if (cancelMap[fileId] == null) { | |||||
cancelMap[fileId] = CancelToken(); | |||||
} | |||||
return cancelMap[fileId]; | |||||
} | |||||
cancelSendMsg(MsgModel msgModel){ | |||||
var token = cancelMap[msgModel.extraFile]; | |||||
if (token != null) { | |||||
token.cancel('用户取消'); | |||||
} | |||||
} | |||||
Future uploadFile(MsgModel msg, {CancelToken cancelToken}) async { | Future uploadFile(MsgModel msg, {CancelToken cancelToken}) async { | ||||
Response response; | Response response; | ||||
@@ -132,7 +149,7 @@ class UploadUtil { | |||||
print('开始上传文件${msg.extraFile} url:${uploadUrl + 'uploadchatfile'}'); | print('开始上传文件${msg.extraFile} url:${uploadUrl + 'uploadchatfile'}'); | ||||
var streamController = getStream(msg.extraFile); | var streamController = getStream(msg.extraFile); | ||||
var cancelToken = getCancelToken(msg.extraFile); | |||||
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); | ||||
@@ -141,6 +158,7 @@ class UploadUtil { | |||||
streamController.close(); | streamController.close(); | ||||
streamMap.remove(msg.extraFile); | streamMap.remove(msg.extraFile); | ||||
cancelMap.remove(msg.extraFile); | |||||
print('uploadFile response $response'); | print('uploadFile response $response'); | ||||
print('###msgContent ${msg.msgContent.length}'); | print('###msgContent ${msg.msgContent.length}'); | ||||
@@ -199,10 +217,8 @@ class UploadUtil { | |||||
Future downloadFile(MsgModel msg, {CancelToken cancelToken}) async { | Future downloadFile(MsgModel msg, {CancelToken cancelToken}) async { | ||||
Response response; | Response response; | ||||
var fullUrl = getFullUrl(msg.extraFile, msg.sessionId, msg.channelType); | var fullUrl = getFullUrl(msg.extraFile, msg.sessionId, msg.channelType); | ||||
if(msg.extraFile.contains('http://')){ | |||||
if (msg.extraFile.contains('http://')) { | |||||
fullUrl = msg.extraFile; | fullUrl = msg.extraFile; | ||||
} | } | ||||
@@ -1,7 +1,7 @@ | |||||
name: chat | name: chat | ||||
description: A new Flutter project. | description: A new Flutter project. | ||||
#修改版本号后get-clean | #修改版本号后get-clean | ||||
version: 1.1.2+17 | |||||
version: 1.1.0+15 | |||||
environment: | environment: | ||||
sdk: ">=2.1.0 <3.0.0" | sdk: ">=2.1.0 <3.0.0" | ||||