From 0692ba71e00ca12eb88d6af20799ea60014a1c9f Mon Sep 17 00:00:00 2001 From: ZCM <772112648@qq.com> Date: Thu, 9 Apr 2020 18:41:18 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E6=96=B0=E7=9A=84=E7=9B=B8?= =?UTF-8?q?=E5=86=8C=E7=95=8C=E9=9D=A2=EF=BC=8C=E6=9B=B4=E6=8D=A2=E5=A4=B4?= =?UTF-8?q?=E5=83=8F=E7=95=8C=E9=9D=A2=E5=92=8C=E6=9F=A5=E7=9C=8B=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E4=BA=BA=E8=B5=84=E6=96=99=E7=95=8C=E9=9D=A2=202.?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=87=AA=E5=B7=B1=E7=9A=84=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E6=9F=A5=E7=9C=8B=E9=97=AE=E9=A2=98=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/build.gradle | 6 +- assets/fonts/iconfont.ttf | Bin 45464 -> 48948 bytes assets/images/lock_photo.png | Bin 0 -> 11202 bytes assets/images/up.png | Bin 0 -> 1185 bytes i18n/en-US.json | 7 +- i18n/ja-JP.json | 7 +- i18n/ko-KR.json | 7 +- i18n/vi-VN.json | 9 +- i18n/zh-CN.json | 7 +- i18n/zh-HK.json | 7 +- lib/chat/group_chat_view.dart | 222 +++-- lib/data/chat_data_mgr.dart | 17 +- lib/data/constants.dart | 6 +- lib/generated/i18n.dart | 93 +- lib/home/ProfilePage.dart | 1317 +++++++++---------------- lib/home/SystemEditPage.dart | 59 +- lib/home/friend_page.dart | 2 - lib/home/homeMain.dart | 1 - lib/home/last_chat_record_widget.dart | 4 +- lib/home/my_headview.dart | 179 ++++ lib/home/new_addfriends.dart | 9 - lib/home/new_friends.dart | 1 - lib/home/photo_page.dart | 516 ++++++++++ lib/models/unread_count_provider.dart | 35 +- lib/utils/CustomUI.dart | 2 +- lib/utils/FullWithButton.dart | 48 +- lib/utils/HttpUtil.dart | 2 +- lib/utils/sp_utils.dart | 10 +- pubspec.yaml | 2 + 29 files changed, 1567 insertions(+), 1008 deletions(-) create mode 100644 assets/images/lock_photo.png create mode 100644 assets/images/up.png create mode 100644 lib/home/my_headview.dart create mode 100644 lib/home/photo_page.dart diff --git a/android/app/build.gradle b/android/app/build.gradle index b7fee24..2964d4e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -56,9 +56,9 @@ android { // manifestPlaceholders = [ // AMAP_KEY : "1fd4e93e3b4b13747da41f484c955fe2", /// 高德地图key // ] - ndk { - abiFilters 'armeabi-v7a' - } +// ndk { +// abiFilters 'armeabi-v7a' +// } multiDexEnabled true manifestPlaceholders = [ JPUSH_PKGNAME : 'com.cyhd.henhoandroid', diff --git a/assets/fonts/iconfont.ttf b/assets/fonts/iconfont.ttf index f36674ba548112daf4867bb949d5f8d61d9de9f1..76d655a99540e9853a09e18a50a6917b3abb4940 100644 GIT binary patch delta 4164 zcmZWs4RBP~b-w4m|F>`7+qe66pLSRK5Bnq}t-O+WizHYfAq(^e7A8^)!A1!J31h%g zDB#py62};9gTY{Iw~phalbB@e;#8Tmozj@N*e0D$hL%hx>9`ptb(DCfoiUj>sojkpB&%Ni}bNAeP&-u>LbN@xZ=h4%5RQ~FRzxjX=K0t`_@b0}wcD>*5>r;g2 zuMu*AOixYjjQ#aFix6@H$(=@lDu|n~e+g;X^!;BryuNwqCL!<>Lg?zf`#(Qv@U*&P7@{^RRQTvHAnz<557!e|+yk`1gG2f0y=(E!>xIEECG4_%OYv=9BOSHF>i1 z5!0&DKO#T-uaN3Pfq=vzHP=4Ux2jqME~Av`HzQZkwzmimXcmc)0Fx}xg}#Nkg;Qs< z{FqS>xBn&2ewqKkeuR95JW7s{$H;MVf;>*1AWxE$M{3|s=ZL;uajc^^ZaI8kSB3X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u8Txd(DAdeQ45|pJDc`aHVftVT}MA)&y zkQk#bTuNe47(&3H5`KVTL5yKx43fr$MmEGpp!G}>6VJ_ezwdnKoSWR-yHa3}zOcD7 zQ%9*EdI0V-fa$|f=GNe^djlc>zX|YUdw3w-U%Qa+0RXB)c$f^c-Vi6fK{z>_oy^%r zia!Bx2Y^{Jqc_su$16VpSk}lhWz)Gae8Uo?9n|k0NoNNlJ%zgf3v<+;9UGnCC)dxu z-vf9-b^XH!8&Y%zkTl`S-sbAHiVKHOt|J3rcR3aM$Hm{pjNvqQpK=p0&85)hW>hC` zF@+S}3OGU|fev7cr8?kqa<$GzVspvY;T_6rp;B}5EU)Az^3(I(x>SV@|6hjrW!<6r zPVdArKMiOxt>z6c_39};fUTy;<;dfxFWMJfZ1y!jYu=3|V=J*gN>Vw9EAj0XTT7vJ z>{54|*tXs7Yk%7Qt>bFPPG^6@n>b23lDXu5SETE!`pW9QJyks5mbe6XAOZ}jpUCwdwj$GbrVQ3*1i97jJdioCzH4@tZr@RFoCl8f5xZnvHJ9Iis& wpc%y)bIyXq7OA{kd#U0U_mQiCD)6gsXH}QFv^vLdMpf1gs9t}a(UpF|U-h7%aR2}S diff --git a/assets/images/lock_photo.png b/assets/images/lock_photo.png new file mode 100644 index 0000000000000000000000000000000000000000..b0ed4ed3de3efe3d1de5ef7eb98b9369c4128f18 GIT binary patch literal 11202 zcmaKSXFwC()-EVjdJ8oenxY{Ip@t?kR8e{_1_($ebP!N_fY3#nf`E!hlWLGA5SnzA zj+D?;ngKyjgd5-Qob%lu_uTxL?Af!*v!1>7>^4b8w{(~;@m->zpkUI|)iR-=pwuRp zr|4+N*XlknE%}c(5NQ=?>gyU9g7QaGsJr+&p+S1yC^xhT8s!p(8AK~nP+Yv?Ze|r| zWq4E3+1DG2`YQts_4XrcQ&1?YhWeqLJ<)+6C$yWpkBabKYo{>C-9<&%Qr1w?&`%S6 z*IhT0x`-8gMvLT|rh}K|vF)Ev1f-g)2y@|65nf*Ez@=?Gy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me`WMBuC4BRh1Ah7H`dxsda1{ zR9u**l%b~KePJ3)kEIWs?oR;^M3%^mWL+* literal 0 HcmV?d00001 diff --git a/assets/images/up.png b/assets/images/up.png new file mode 100644 index 0000000000000000000000000000000000000000..495ef2465eec0b1c80e0f339c8f4f66bd2eea1c9 GIT binary patch literal 1185 zcmeAS@N?(olHy`uVBq!ia0vp^58U}fi7AzZCsS=07?{;ELn2Bde0{8v^K*7iAWdWaj57fJ{tG z$}cUkRRX#c;)UD-xUqS~&|m@vn0`fKfxe-h0mw@*g}%P{mFDKcRTq~8r6Sym)!^cg z%7Rq=pw#00(xPNw#HA^NtSYc_E=o--$uA1Y&(DE{Vn9ZINq%ugeu09sGbq%|6*R&# z^HTE5i#5S|e0{Av^NLFn^O93NU2K(rrs!p6rdYX{o0wXd7&)0+niv`yx;k1qTNqlJ zIT^URI2oF`8JoiNy5uL9=BDPA!1Sgd^g83z3rY^T1wfl!Qj0RnQd8WD@^cly-nPob z?G{U%=0WwQ;C726PQCg-$LND17b&t~LckORV#1RykONQrsd>N@Uj$6rh2pka3=E8d zo-U3d6}Q$**(i9(fX8*Bctf9%nTOY@90xOx8x3vq=C$z(sWk`&1s&p;QnG>Z(%d(f zEw?RZ*mc^naLISoXfvNF+iux<%M|_F6T|;`wi@4*4^r)JK6^iEnkX3v)jc=7+|`g2 zd5$UWL-lgeMi!g&3s(*ae&PD#-E|dGH-Uq)Y%*=m~GNb0X1$Kt-|h!|b9$oT;&t(mAIqLk&L2)4 zD%>YK { sendMsg(msg); } }); + + controller.addListener(() { + if (alterTime != null || unreadTime != null) { + for (int i = 0; i < msgList.length; i++) { + if ((msgList[i].time == alterTime || msgList[i].time == unreadTime) && + controller.isIndexStateInLayoutRange(i)) { + clearUnreadNews(); + } + } + } + }); } jumpToMsg(time) async { @@ -236,6 +248,11 @@ class _GroupChatPageState extends State { } } + clearUnreadNews() { + unreadTime = null; + setState(() {}); + } + @override Widget build(BuildContext context) { List actions = []; @@ -289,111 +306,126 @@ class _GroupChatPageState extends State { Provider.value(value: true), Provider.value(value: widget.groupInfoModel), ], - child: GestureDetector( - onTapDown: (args){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( + child: GestureDetector(onTapDown: (args) { + 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: [ + Column( children: [ - Column( - children: [ - NetStateWidget(), - Expanded(child: _buildMessageList()), - InputBar(sendMsg: sendMsg), - ], - ), - isHaveUnreadNews - ? Positioned( - top: 32.5, - right: 0, - child: InkWell( - onTap: () { - jumpToMsg(isAlterYou - ? alterTime - : unreadTime); - unreadTime = null; - setState(() {}); - }, - child: Container( - alignment: Alignment.center, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Color(0x33000000), //阴影颜色 - blurRadius: 10.0, //阴影大小 - ) - ], - borderRadius: BorderRadius.only( - topLeft: Radius.circular(80), - bottomLeft: Radius.circular(80)), - color: Colors.white, + 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: [ + SizedBox(width: 16.5), + Image.asset( + 'assets/images/up.png', + width: 12, ), - constraints: - BoxConstraints(minWidth: 120), - height: 39, - child: Row( - children: [ - Icon( - Icons.arrow_upward, - color: Color(0xFF3875E9), - size: 20, - ), - Text( + SizedBox(width: 10), + Container( + child: Text( isAlterYou - ? '$alterUserName @你' - : '$unreadNums条新消息', + ? '$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 + ? '@${I18n.of(context).you}' + : '', + style: TextStyle( + color: Color(0xFF3875E9)), ), - ))) - : Container() - ], - ))), - onPointerDown: (value) { - for (var state in states) { - if (!state.containsPosition(value.position)) { - //clear other selection - state.clearSelection(); - } - } - }, - onPointerMove: (value) { + SizedBox(width: 14), + ], + ), + ))) + : Container() + ], + ))), + onPointerDown: (value) { + for (var state in states) { + if (!state.containsPosition(value.position)) { //clear other selection - for (var state in states) { - if (!state.containsPosition(value.position)) { - //clear other selection - state.clearSelection(); - } - } - }, - ); + state.clearSelection(); + } + } + }, + onPointerMove: (value) { + //clear other selection + for (var state in states) { + if (!state.containsPosition(value.position)) { + //clear other selection + state.clearSelection(); + } + } }, - ))); + ); + }, + ))); } - Widget _buildMessageList() { return Container( alignment: Alignment.topCenter, diff --git a/lib/data/chat_data_mgr.dart b/lib/data/chat_data_mgr.dart index 97d9443..956bfdb 100644 --- a/lib/data/chat_data_mgr.dart +++ b/lib/data/chat_data_mgr.dart @@ -59,7 +59,6 @@ class ChatDataMgr { getLastRecord(); } - //初始化私聊未读消息 initUnreadCount() async { @@ -77,6 +76,7 @@ class ChatDataMgr { unreadCountMap.forEach((k, v) { groupUnreadProvider.updateUnreadCount(k, v); }); + groupUnreadProvider.initUnreadAlter(); } logout() { @@ -92,7 +92,8 @@ class ChatDataMgr { //获取私聊记录 List getRecord({int sessionId}) { - var record = msgRecordMap[sessionId==null?MsgHandler.curActiveSession:sessionId]; + var record = msgRecordMap[ + sessionId == null ? MsgHandler.curActiveSession : sessionId]; if (record == null) { record = []; msgRecordMap[MsgHandler.curActiveSession] = record; @@ -102,7 +103,8 @@ class ChatDataMgr { //获取群聊记录 List getGroupRecord({int sessionId}) { - var record = groupRecordMap[sessionId==null?MsgHandler.curActiveSession:sessionId]; + var record = groupRecordMap[ + sessionId == null ? MsgHandler.curActiveSession : sessionId]; if (record == null) { record = []; groupRecordMap[MsgHandler.curActiveSession] = record; @@ -118,7 +120,6 @@ class ChatDataMgr { msgRecordMap[MsgHandler.curActiveSession] = record; } return record; - } updateLastMsgWithTranslateMsg(PushChat chat) async { @@ -281,7 +282,7 @@ class ChatDataMgr { } var result = getMsgBy(msg.sessionId, msg.time, true); if (result != null) { - print('消息存在!!!!'); + print('消息存在!!!!'); } else { print('插入消息!!!!'); insertToDB(msg, record); @@ -315,10 +316,10 @@ class ChatDataMgr { print('数据为空,无法插入'); } else { record.insert(0, msg); - // print(MsgHandler.time); + // print(MsgHandler.time); //int after = DateTime.now().millisecondsSinceEpoch-MsgHandler.time; - // print('******插入数据 use $after'); - // print('******record length ${record.length} ${msg.sessionId}'); + // print('******插入数据 use $after'); + // print('******record length ${record.length} ${msg.sessionId}'); SqlUtil.insert(msg); diff --git a/lib/data/constants.dart b/lib/data/constants.dart index 5adc864..36c981e 100644 --- a/lib/data/constants.dart +++ b/lib/data/constants.dart @@ -92,8 +92,8 @@ class GroupOperatingPageType { //消息发送界面类别 class SendMessagePageType { - static const int AddFriends = 0; //添加朋友 - static const int ChangeGroupName = 1; //修改群名字 + static const int AddFriends = 0; //添加朋友 + static const int ChangeGroupName = 1; //修改群名字 static const int ChangeGroupNickName = 2; //修改群昵称 static const int Remark = 3; //修改备注 } @@ -285,6 +285,8 @@ class Constants { static const Latitude = 'Latitude'; static const Longitude = 'Longitude'; + static const GroupAlterKey = 'GroupAlterKey'; //群@ + /// currentGoodsId+'@'+receipt+'@'+purchaseToken static final vipIcon = Image.asset( diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index ce60261..23c66eb 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -2539,6 +2539,16 @@ class I18n implements WidgetsLocalizations { String get travel_tips2 => "您的贴身出行管家,解决语言不通打车走错路的问题"; /// "现在我们可以开始聊天了。" String get new_friends_tips => "现在我们可以开始聊天了。"; + /// "填写自我简介获得更多关注,在此处填写" + String get msg_tips => "填写自我简介获得更多关注,在此处填写"; + /// "/s1条新消息" + String get new_msg => "/s1条新消息"; + /// "上传" + String get upload1 => "上传"; + /// "他的资料" + String get his_profile => "他的资料"; + /// "她的资料" + String get her_profile => "她的资料"; } class _I18n_en_US extends I18n { @@ -5680,9 +5690,9 @@ class _I18n_vi_VN extends I18n { /// "Đơn xin xác thực của bạn đã gửi và chờ đối phương thông qua" @override String get add_friends_tips => "Đơn xin xác thực của bạn đã gửi và chờ đối phương thông qua"; - /// "Tôi là/s1" + /// "Tôi là /s1" @override - String get i_am => "Tôi là/s1"; + String get i_am => "Tôi là /s1"; /// "Cho phép" @override String get agree => "Cho phép"; @@ -6031,9 +6041,9 @@ class _I18n_vi_VN extends I18n { /// " Đối phương đã đưa bạn vào danh sách đen" @override String get you_are_blaklisted => " Đối phương đã đưa bạn vào danh sách đen"; - /// " Có chắc là bạn muốn phục hồi ảnh đã tiêu hủy không?\n (người dùng đã xem có thể xem lại lần nữa" + /// " Có chắc là bạn muốn phục hồi ảnh đã tiêu hủy không?\n (người dùng đã xem có thể xem lại lần nữa)" @override - String get confrim_recovery => " Có chắc là bạn muốn phục hồi ảnh đã tiêu hủy không?\n (người dùng đã xem có thể xem lại lần nữa"; + String get confrim_recovery => " Có chắc là bạn muốn phục hồi ảnh đã tiêu hủy không?\n (người dùng đã xem có thể xem lại lần nữa)"; /// " Gửi tới " @override String get send_to => " Gửi tới "; @@ -6310,6 +6320,21 @@ class _I18n_vi_VN extends I18n { /// "现在我们可以开始聊天了。" @override String get new_friends_tips => "现在我们可以开始聊天了。"; + /// "填写自我简介获得更多关注,在此处填写" + @override + String get msg_tips => "填写自我简介获得更多关注,在此处填写"; + /// "/s1条新消息" + @override + String get new_msg => "/s1条新消息"; + /// "上传" + @override + String get upload1 => "上传"; + /// "他的资料" + @override + String get his_profile => "他的资料"; + /// "她的资料" + @override + String get her_profile => "她的资料"; @override TextDirection get textDirection => TextDirection.ltr; @@ -10077,6 +10102,21 @@ class _I18n_zh_HK extends I18n { /// "现在我们可以开始聊天了。" @override String get new_friends_tips => "现在我们可以开始聊天了。"; + /// "填寫自我簡介獲得更多關注,在此處填寫" + @override + String get msg_tips => "填寫自我簡介獲得更多關注,在此處填寫"; + /// "/s1條新消息" + @override + String get new_msg => "/s1條新消息"; + /// "上傳" + @override + String get upload1 => "上傳"; + /// "他的資料" + @override + String get his_profile => "他的資料"; + /// "她的資料" + @override + String get her_profile => "她的資料"; @override TextDirection get textDirection => TextDirection.ltr; @@ -13844,6 +13884,21 @@ class _I18n_zh_CN extends _I18n_zh_HK { /// "现在我们可以开始聊天了。" @override String get new_friends_tips => "现在我们可以开始聊天了。"; + /// "填写自我简介获得更多关注,在此处填写" + @override + String get msg_tips => "填写自我简介获得更多关注,在此处填写"; + /// "/s1条新消息" + @override + String get new_msg => "/s1条新消息"; + /// "上传" + @override + String get upload1 => "上传"; + /// "他的资料" + @override + String get his_profile => "他的资料"; + /// "她的资料" + @override + String get her_profile => "她的资料"; @override TextDirection get textDirection => TextDirection.ltr; @@ -17611,6 +17666,21 @@ class _I18n_ko_KR extends I18n { /// "现在我们可以开始聊天了。" @override String get new_friends_tips => "现在我们可以开始聊天了。"; + /// "填写自我简介获得更多关注,在此处填写" + @override + String get msg_tips => "填写自我简介获得更多关注,在此处填写"; + /// "/s1条新消息" + @override + String get new_msg => "/s1条新消息"; + /// "上传" + @override + String get upload1 => "上传"; + /// "他的资料" + @override + String get his_profile => "他的资料"; + /// "她的资料" + @override + String get her_profile => "她的资料"; @override TextDirection get textDirection => TextDirection.ltr; @@ -21378,6 +21448,21 @@ class _I18n_ja_JP extends I18n { /// "现在我们可以开始聊天了。" @override String get new_friends_tips => "现在我们可以开始聊天了。"; + /// "填写自我简介获得更多关注,在此处填写" + @override + String get msg_tips => "填写自我简介获得更多关注,在此处填写"; + /// "/s1条新消息" + @override + String get new_msg => "/s1条新消息"; + /// "上传" + @override + String get upload1 => "上传"; + /// "他的资料" + @override + String get his_profile => "他的资料"; + /// "她的资料" + @override + String get her_profile => "她的资料"; @override TextDirection get textDirection => TextDirection.ltr; diff --git a/lib/home/ProfilePage.dart b/lib/home/ProfilePage.dart index 237b372..33ea340 100644 --- a/lib/home/ProfilePage.dart +++ b/lib/home/ProfilePage.dart @@ -2,6 +2,8 @@ import 'dart:convert'; import 'dart:io'; import 'package:chat/home/fans_page.dart'; import 'package:chat/home/goddess_hot.dart'; +import 'package:chat/home/my_headview.dart'; +import 'package:chat/home/photo_page.dart'; import 'package:chat/home/rich_title.dart'; import 'package:chat/models/ChatMsg.dart'; import 'package:chat/models/money_change.dart'; @@ -29,14 +31,10 @@ import 'package:chat/home/VideoPage.dart'; import 'package:chat/home/VipPage.dart'; import 'package:chat/models/UserInfo.dart'; import 'package:chat/utils/CustomUI.dart'; -import 'package:chat/utils/LoadingDialog.dart'; import 'package:chat/utils/MessageMgr.dart'; import 'package:chat/utils/TutorialOverlay.dart'; -import 'package:chat/utils/UserCard.dart'; -import 'package:chat/utils/UserChips.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/services.dart'; -import 'package:image_cropper/image_cropper.dart'; import 'package:image_picker/image_picker.dart'; import 'package:multi_image_picker/multi_image_picker.dart'; @@ -59,6 +57,7 @@ import 'add_friend.dart'; import 'apply_content_view.dart'; import 'daily_bonus_page.dart'; import 'money_picture_view.dart'; +import 'dart:math' as math; var cardWidth; @@ -91,10 +90,6 @@ class _ProfilePageState extends State UserInfo userInfo = new UserInfo(); TextEditingController nickNameController = new TextEditingController(); - - // AnimationController animationController; - // Animation movement; - bool isMyself = false; List imgList = []; @@ -152,6 +147,8 @@ class _ProfilePageState extends State bool isAuthority = false; //是否有聊天和查看用户资料的权限 + bool isShowAll = false; + getUserInfo({mymsg = ''}) async { if (mymsg != '' && mymsg != null) { UserData().basicInfo.ownMsg = mymsg; @@ -335,6 +332,7 @@ class _ProfilePageState extends State MessageMgr().on('post_add_friend', msgAddFriend); MessageMgr().on('refresh_love_list', msgRefreshLoveList); MessageMgr().on('refresh_fans_num', msgRefreshFansNum); + MessageMgr().on('change_my_headview', msgChangeMyHeadView); } void messageOff() { @@ -346,6 +344,14 @@ class _ProfilePageState extends State MessageMgr().off('post_add_friend', msgAddFriend); MessageMgr().off('refresh_love_list', msgRefreshLoveList); MessageMgr().off('refresh_fans_num', msgRefreshFansNum); + MessageMgr().off('change_my_headview', msgChangeMyHeadView); + } + + msgChangeMyHeadView(data) { + if (isMyself) { + userInfo.headimgurl = UserData().basicInfo.headimgurl; + setState(() {}); + } } msgRefreshFansNum(data) { @@ -376,7 +382,6 @@ class _ProfilePageState extends State void dispose() { messageOff(); registKey = null; - //animationController?.dispose(); nickNameController.dispose(); super.dispose(); } @@ -414,22 +419,6 @@ class _ProfilePageState extends State //上传相册 void _uploadPhoto() async { - // if (await CustomUI.showPhotoPermissionSetting(context)) { - // var tempFile = await ImagePicker.pickImage(source: ImageSource.gallery); - // if (tempFile != null) { - // //选择焚烧 - // Navigator.of(context).push( - // new MaterialPageRoute( - // builder: (context) { - // return UploadPicture( - // img: tempFile, - // ); - // }, - // ), - // ); - // } - // } - int leftLength = MaxImgSize - imgList.length; if (leftLength <= 0) { showToast(I18n.of(context) @@ -486,119 +475,291 @@ class _ProfilePageState extends State showToast(resData['msg']); } } - -// var photos = await PhotoPicker.pickAsset( -// context: context, -// themeColor: Color(0xFFF0F0F0), -// textColor: Color(0xFF3F3F3F), -// pickType: PickType.onlyImage); - -// if (photos != null && photos.length > 0) { -// List fileList = []; -// for (var i = 0; i < photos.length; i++) { -// AssetEntity photoEntity = photos[i]; -// fileList.add(await photoEntity.file); -// } -// Map data = {"type": 2, "userId": UserData().basicInfo.userId}; -// data['sign'] = TokenMgr().getSign(data); -// data['sex'] = UserData().basicInfo.sex; -// data['isBurn'] = 0; -// Response res = await HttpUtil().uploadFiles( -// fileList, data, 'upload/post/postfiles', 'image', -// isShowLoading: true); -// var resData = res.data; -// if (resData['code'] == 0) { -// if (resData['data']['msg'] != '' && resData['data']['msg'] != null) { -// showToast(resData['data']['msg']); -// } -// if(resData['msg'].split('|').length !=photos.length){ -// showToast(I18n.of(context).hava_error_photo); -// } -// MessageMgr().emit('refresh_photo'); -// } -// } } - void _sendPicture() async { - if (await CustomUI.showPhotoPermissionSetting(context)) { - showDialog( - context: context, - barrierDismissible: false, - builder: (BuildContext context) { - return LoadingDialog( - text: "", - ); - }); - var tempFile = await ImagePicker.pickImage(source: ImageSource.gallery); - Navigator.of(context).pop(); - if (tempFile != null) { - _cropPicture(tempFile); - } - } + showHeadView() { + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return MyHeadViewPage(); + }, + ), + ); } - void _cropPicture(tempFile) async { - File croppedFile = await ImageCropper.cropImage( - sourcePath: tempFile.path, - aspectRatio: CropAspectRatio(ratioX: 1, ratioY: 1), + Widget _buildSignIn() { + return Container( + margin: EdgeInsets.only(top: Separate_Size, bottom: Separate_Size), + padding: EdgeInsets.symmetric(horizontal: 10), + child: FullWidthButton( + iconCode: 0xe65c, + iconColor: 0xFFAF60F8, + showRightIcon: true, + title: I18n.of(context).sign_in, + showDivider: false, + onPressed: () { + Navigator.of(context).push(MaterialPageRoute( + builder: (context) { + return DailyBonusPage(); + }, + )); + }, + ), + decoration: BoxDecoration( + color: Colors.white, + border: Border( + top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)), ); + } - if (croppedFile != null) { - Map data = {"type": 1, "userId": userInfo.userId}; - data['sign'] = TokenMgr().getSign(data); - Response res = await HttpUtil() - .uploadFile(croppedFile, data, 'upload/file/postflie', 'image'); - var resData = res.data; - if (resData['code'] == 0) { - userInfo.headimgurl = resData['msg']; - - if (mounted) { - setState(() {}); - } - } - } + Widget _buildPicture() { + return FullWidthButton( + iconCode: 0xe689, + iconColor: 0xFFE3AA10, + title: (isMyself + ? I18n.of(context).my_album + : (isMan ? I18n.of(context).his_photo : I18n.of(context).her_photo)), + descriptionColor: Constants.BlueTextColor, + showDivider: false, + showRightIcon: true, + onPressed: () { + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return PhotoPage( + userInfo: userInfo, + ); + }, + ), + ); + }, + ); } Widget _buildHeadView() { cardWidth = MediaQuery.of(context).size.width; - - Color buttonColor = Colors.grey; return Container( + decoration: BoxDecoration( + color: Colors.white, + border: Border(bottom: Constants.GreyBorderSide)), + child: Container( decoration: BoxDecoration( - color: Colors.white, - border: Border(bottom: Constants.GreyBorderSide)), - child: Stack( + color: Colors.white, + ), + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.only(top: 19), + child: Column( children: [ - Container( - decoration: BoxDecoration( - color: Colors.white, - ), - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.only(top: 20), - child: Column( - children: [ - _buildHeadImg(), - _buildUserName(), - _buildUserChips(), - _buildResientCity(), - //_buildProgram(), - _buildAttestation(), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + _buildHeadImg(), + Column(children: [ _buildFans(), - ], - ), + _buildButtonList(), + ]) + ], ), - _buildLoveButton(buttonColor), + _buildUserChips(), + _buildAttestation(), + _buildMyMsg(), ], + ), + ), + ); + } + + Widget _buildMyMsg() { + double width = Screen.width - 80; + var textStyle = TextStyle(fontSize: 12, color: Color(0xFF333333)); + // userInfo.ownMsg = + // '哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈'; + bool showAllContent = isExpansion(userInfo.ownMsg, width); + return Container( + padding: + EdgeInsets.only(left: 25.5, bottom: isMyself ? 20 : 5, right: 10), + child: userInfo.ownMsg == null || userInfo.ownMsg == '' + ? (isMyself + ? InkWell( + onTap: () { + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return EditPage(isEditPage: true); + }, + ), + ); + }, + child: Row(children: [ + Text(I18n.of(context).msg_tips, style: textStyle), + Transform.rotate( + angle: math.pi * 2, + child: Icon( + IconData(0xe68d, + fontFamily: Constants.IconFontFamily), + color: Color(0xFF717171), + size: 16, + )) + ])) + : Container()) + : Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: width, + child: Text( + userInfo.ownMsg, + style: textStyle, + maxLines: isShowAll ? 10 : 1, + overflow: TextOverflow.ellipsis, + )), + SizedBox(width: 4), + showAllContent + ? InkWell( + onTap: () { + setState(() { + isShowAll = !isShowAll; + }); + }, + child: Transform.rotate( + angle: isShowAll ? math.pi : 0, + child: Icon( + IconData(0xe684, + fontFamily: Constants.IconFontFamily), + color: Color(0xFF717171), + size: 13, + ))) + : Container(), + ], + )); + } + + bool isExpansion(String text, double width) { + TextPainter _textPainter = TextPainter( + maxLines: 2, + text: TextSpan( + text: text, style: TextStyle(fontSize: 12.0, color: Colors.black)), + textDirection: TextDirection.ltr) + ..layout(maxWidth: width, minWidth: width); + if (_textPainter.didExceedMaxLines) { + //这里判断 文本是否截断 + return true; + } else { + return false; + } + } + + Widget _buildBorderButton(String str, double width, callback, + {IconData iconCode, int iconColor = 0xFF181818}) { + return InkWell( + onTap: callback, + child: Container( + alignment: Alignment.center, + decoration: BoxDecoration( + border: Border.all(color: Color(0xB5CCCCCC)), + borderRadius: BorderRadius.circular(14)), + height: 28, + width: width, + child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + iconCode != null + ? Container( + margin: EdgeInsets.only(right: 2), + child: Icon( + iconCode, + size: 16, + color: Color(iconColor), + )) + : Container(), + Text( + str, + style: TextStyle(fontSize: 14), + ) + ]), + )); + } + + gotoEditPage() { + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return EditPage(isEditPage: true); + }, + ), + ); + } + + gotoSystemEditPage() { + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return SystemEditPage(); + }, + ), + ); + } + + loveOrCancele() { + if (!userInfo.isLike) { + HttpUtil().setLove(userInfo.userId, () { + MessageMgr() + .emit('refresh_love_list', {'UserId': userInfo.userId, 'flag': 0}); + setState(() { + userInfo.isLike = true; + }); + }); + } else { + HttpUtil().cancleLove(userInfo.userId, () { + MessageMgr() + .emit('refresh_love_list', {'UserId': userInfo.userId, 'flag': 2}); + setState(() { + userInfo.isLike = false; + }); + }); + } + } + + Widget _buildButtonList() { + List list = []; + if (isMyself) { + list = [ + _buildBorderButton( + I18n.of(context).edit_information, 140, gotoEditPage), + SizedBox(width: 12.5), + _buildBorderButton('', 53, gotoSystemEditPage, + iconCode: Icons.settings), + ]; + } else if (userInfo.sex == UserData().basicInfo.sex) { + list = [ + _buildBorderButton(I18n.of(context).private_chat, 140, + isCanWatch ? buyChatAccount : null, + iconCode: IconData(0xe68c, fontFamily: 'iconfont')), + ]; + } else { + list = [ + _buildBorderButton(I18n.of(context).like, 140, loveOrCancele, + iconCode: IconData(userInfo.isLike ? 0xe623 : 0xe625, + fontFamily: Constants.IconFontFamily), + iconColor: userInfo.isLike ? 0xFFFF7777 : 0xFF181818), + SizedBox(width: 12.5), + _buildBorderButton('', 53, isCanWatch ? buyChatAccount : null, + iconCode: IconData(0xe68c, fontFamily: 'iconfont')), + ]; + } + + return Container( + margin: EdgeInsets.only(top: 13, bottom: 10), + child: Row( + children: list, )); } //认证相关 Widget _buildAttestation() { return Container( - margin: EdgeInsets.only(top: 7, bottom: 7), - alignment: Alignment.center, + margin: EdgeInsets.only(top: 7, bottom: 7, left: 25.5), + alignment: Alignment.centerLeft, child: Row( - mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, children: [ isAttestation ? Icon(Icons.check_circle_outline, @@ -628,78 +789,6 @@ class _ProfilePageState extends State style: TextStyle(fontSize: 11, color: Constants.GreyTextColor)) ], )); - // return Stack( - // children: [ - // Container( - // margin: EdgeInsets.only(top: 3), - // alignment: Alignment.center, - // child: Row( - // mainAxisAlignment: MainAxisAlignment.center, - // children: [ - // isAttestation - // ? Icon(Icons.check_circle_outline, - // size: 12, color: Constants.BlueTextColor) - // : Padding( - // padding: EdgeInsets.only(bottom: 0.5), - // child: Icon(IconData(0xe63a, fontFamily: 'iconfont'), - // size: 16, color: const Color(0xFFA9A9A9))), - // SizedBox(width: 3), - // Text( - // isAttestation - // ? isMyself - // ? (isMan - // ? (userInfo.isVipAttestation - // ? I18n.of(context).by_paying - // : I18n.of(context).incode_passed) - // : I18n.of(context).certified) - // : (isMan - // ? (userInfo.isVipAttestation - // ? I18n.of(context).pay_join - // : I18n.of(context).passed_review) - // : I18n.of(context).passed_video) - // : isMyself - // ? I18n.of(context).not_certified - // : (isMan ? '' : I18n.of(context).not_video), - // textScaleFactor: 1.0, - // style: - // TextStyle(fontSize: 11, color: Constants.GreyTextColor)) - // ], - // )), - // !isMan && isAttestation - // ? Container( - // padding: EdgeInsets.only(top: 17), - // alignment: Alignment.centerRight, - // child: InkWell( - // onTap: () { - // Navigator.of(context).push( - // new MaterialPageRoute( - // builder: (context) { - // return VideoPage( - // userId: userInfo.userId, - // ); - // }, - // ), - // ); - // }, - // child: Padding( - // padding: EdgeInsets.only(right: 17), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - // Text('${I18n.of(context).certified_video}', - // textScaleFactor: 1.0, - // style: TextStyle( - // fontSize: 11, color: Colors.grey)), - // Icon( - // IconData(0xe63c, fontFamily: 'iconfont'), - // size: 18.0, - // color: Color(AppColors.TabIconNormal), - // ), - // ], - // )))) - // : Container(), - // ], - // ); } Widget _buildFansButton(int nums, String text, callback, @@ -707,20 +796,17 @@ class _ProfilePageState extends State return InkWell( onTap: callback, child: Container( - width: Screen.width / 3, + width: (Screen.width - 130) / 3, child: Column( children: [ - SizedBox(height: 8), Stack( children: [ Padding( padding: EdgeInsets.only(left: 4, right: 4), child: Text( - nums < 0 ? "0" : nums.toString(), + nums > 99 ? "99+" : nums.toString(), style: TextStyle( - fontSize: 13, - //color: isMyself ? Constants.BlackTextColor : greyColor), - color: Constants.BlackTextColor), + fontSize: 13, color: Constants.BlackTextColor), )), isShowDot ? Positioned( @@ -739,12 +825,8 @@ class _ProfilePageState extends State SizedBox(height: 4), Text( text, - style: TextStyle( - fontSize: 11, - //color: isMyself ? Constants.BlackTextColor : greyColor), - color: greyColor), + style: TextStyle(fontSize: 11, color: greyColor), ), - SizedBox(height: 8), ], )), ); @@ -753,167 +835,60 @@ class _ProfilePageState extends State //关注列表 Widget _buildFans() { return Container( - decoration: - BoxDecoration(border: Border(top: Constants.GreyBorderSide)), child: Row( - //mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - _buildFansButton( - userInfo.fans, - I18n.of(context).fans, - isMyself - ? () { - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return FansPage(); - }, - ), - ); - } - : null), - _buildFansButton( - userInfo.followNum, - I18n.of(context).attention, - isMyself - ? () { - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return WhiteAndBlackPage( - isWhite: true, - ); - }, - ), - ); - } - : null), - _buildFansButton(userInfo.dynamicNum, I18n.of(context).dynamics, - () { - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return MyProgramPage( - userId: userInfo.userId, - isMan: isMan, + children: [ + _buildFansButton( + userInfo.fans, + I18n.of(context).fans, + isMyself + ? () { + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return FansPage(); + }, + ), ); - }, - ), - ); - }, isShowDot: userInfo.dynamicNum > 0), - ], - )); + } + : null), + _buildFansButton( + userInfo.followNum, + I18n.of(context).attention, + isMyself + ? () { + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return WhiteAndBlackPage( + isWhite: true, + ); + }, + ), + ); + } + : null), + _buildFansButton(userInfo.dynamicNum, I18n.of(context).dynamics, () { + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return MyProgramPage( + userId: userInfo.userId, + isMan: isMan, + ); + }, + ), + ); + }, isShowDot: userInfo.dynamicNum > 0), + ], + )); } - // //约会节目按钮 - // Widget _buildProgram() { - // return programId != 0 - // ? InkWell( - // onTap: () { - // Navigator.of(context).push( - // new MaterialPageRoute( - // builder: (context) { - // return ProgramDetailPage( - // programId: programId, - // ); - // }, - // ), - // ); - // }, - // child: Container( - // decoration: BoxDecoration( - // borderRadius: BorderRadius.all( - // Radius.circular(Constants.LittleButtonRadius)), - // gradient: LinearGradient(colors: [ - // const Color(0xFF6D6AEC), - // const Color(0xFF1795FF), - // ])), - // height: 31, - // alignment: Alignment.center, - // width: Screen.width, - // margin: - // EdgeInsets.only(left: 32.5, right: 32.5, top: 5, bottom: 3), - // child: Stack( - // alignment: Alignment.center, - // children: [ - // Container( - // alignment: Alignment.center, - // height: 31, - // child: Text( - // isMan - // ? I18n.of(context).his_appointment - // : I18n.of(context).her_appointment, - // style: TextStyle(color: Colors.white, fontSize: 14), - // )), - // Positioned( - // right: 30, - // child: Container( - // //padding: movement.value, - // child: Image.asset( - // 'assets/images/hand.png', - // width: 20, - // )), - // ) - // ], - // ))) - // : Container(); - // } - - //常驻城市 - Widget _buildResientCity() { - return isMyself - ? Container( - padding: EdgeInsets.only(top: 5), - child: Text( - userInfo.userId == null - ? '' - : '${I18n.of(context).Resident_city}:${UserData().hasLocationPermission ? WebData().getDateRange(userInfo.meetPlace) : I18n.of(context).unknown}', - textScaleFactor: 1.0, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 12), - )) - : userInfo.userId == null - ? Container() - : Padding( - padding: EdgeInsets.only(top: 5), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InfoTile( - icon: IconData(0xe630, - fontFamily: Constants.IconFontFamily), - title: WebData() - .getDistanceString(userInfo.distince.toDouble()), - titleColor: greyColor, - isDivider: true), - InfoTile( - title: userInfo.onlineStatus == 1 - ? I18n.of(context).online - : WebData() - .getLoginTime(context, userInfo.loginDate), - titleColor: greyColor, - isDivider: - userInfo.photoAut == 1 || userInfo.infoAut == 1), - userInfo.infoAut == 1 - ? InfoTile( - icon: IconData(0xe645, fontFamily: 'iconfont'), - iconHeight: 22, - title: I18n.of(context).application_view, - titleColor: greyColor, - isDivider: false, - onTap: () {}) - : Container(), - userInfo.photoAut == 1 - ? InfoTile( - icon: IconData(0xe632, - fontFamily: Constants.IconFontFamily), - title: I18n.of(context).paid_photo, - titleColor: greyColor, - isDivider: false, - onTap: () {}) - : Container(), - ], - )); + Widget _buildDivder() { + return Container( + color: Color(0xFFE6E6E6), + width: 1.5, + height: 10, + margin: EdgeInsets.only(left: 7.5, right: 7.5)); } //用户chips @@ -922,275 +897,102 @@ class _ProfilePageState extends State if (userInfo.birthday != null) { age = DateTime.now().year - int.parse(userInfo.birthday.split('-')[0]); } + var textStyle = TextStyle(fontSize: 12); return Container( - margin: EdgeInsets.only(top: 10), - alignment: Alignment.center, - width: cardWidth, - child: userInfo.userId == null - ? Container() - : UserChips( - bgColor: const Color(0xFFF2F2F2), - fontStyle: - TextStyle(fontSize: 12, color: const Color(0xFF807B95)), - isCenter: true, - city: UserData().hasLocationPermission - ? WebData().getCity(userInfo.city) - : I18n.of(context).unknown, - age: age, - constellation: - WebData().getConstellation(context, userInfo.constellation), - professional: userInfo.occupation == null - ? '' - : WebData().getProffesionName(userInfo.occupation))); + width: Screen.width, + padding: EdgeInsets.only(left: 25.5), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + isAttestation && !isMan + ? Container( + height: 13, + padding: EdgeInsets.only(left: 5, right: 5), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Constants.PurpleBackgroundColor, + ), + child: Text( + 'Real', + textScaleFactor: 1.0, + style: TextStyle(fontSize: 9, color: Colors.white), + )) + : Text(''), + isVip && isMan + ? Container( + child: isSvip ? Constants.svipIcon : Constants.vipIcon) + : Text(''), + (isAttestation && !isMan) || isVip && isMan + ? _buildDivder() + : Container(), + Text( + '${UserData().hasLocationPermission ? WebData().getDateRange(userInfo.meetPlace) : I18n.of(context).unknown}', + style: textStyle, + ), + _buildDivder(), + Text( + '$age ${I18n.of(context).years_old}-${WebData().getConstellation(context, userInfo.constellation)}', + style: textStyle, + ), + _buildDivder(), + Text( + userInfo.occupation == null + ? '' + : WebData().getProffesionName(userInfo.occupation), + style: textStyle, + ) + ], + )); } - //用户姓名 - Widget _buildUserName() { - return isMyself - ? InkWell( - onTap: () { + //用户头像 + Widget _buildHeadImg() { + double width = 85; + return InkWell( + onTap: isMyself + ? showHeadView + : () { Navigator.of(context).push( new MaterialPageRoute( builder: (context) { - return EditPage(isEditPage: true); + return PicSwiper( + id: 0, + pics: [PicSwiperItem(userInfo.headimgurl, id: 0)], + ); }, ), ); }, - child: Container( - margin: EdgeInsets.only(top: 10), - alignment: Alignment.center, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - Provider.of(context) - .getRefName(userInfo.userId, userInfo.nickName), - textScaleFactor: 1.0, - style: TextStyle( - color: Constants.BlackTextColor, - fontWeight: FontWeight.w500, - fontSize: 16)), - isAttestation && !isMan - ? Container( - height: 13, - margin: EdgeInsets.only(left: 5), - padding: EdgeInsets.only(left: 5, right: 5), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Constants.PurpleBackgroundColor, - ), - child: Text( - 'Real', - textScaleFactor: 1.0, - style: - TextStyle(fontSize: 9, color: Colors.white), - )) - : Text(''), - isVip && isMan - ? Container( - margin: EdgeInsets.only(left: 5), - child: - isSvip ? Constants.svipIcon : Constants.vipIcon) - : Text(''), - Container( - padding: EdgeInsets.only(left: 5), - alignment: Alignment.center, - child: new InkWell( - child: Icon( - IconData(0xe6e5, fontFamily: 'iconfont'), - color: Colors.grey, - size: 16, - ), - onTap: () { - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return EditPage(isEditPage: true); - }, - ), - ); - }, - ), - ) - ], - ))) - : Container(); - } - - //用户头像 - Widget _buildHeadImg() { - bool needSign = UserData().sign == 1 && isMyself; - - return Container( - width: MediaQuery.of(context).size.width, - child: Stack( - children: [ - Center( - child: InkWell( - onTap: isMyself - ? _sendPicture - : () { - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return PicSwiper( - id: 0, - pics: [ - PicSwiperItem(userInfo.headimgurl, id: 0) - ], - ); - }, - ), - ); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2.0), - boxShadow: [ - BoxShadow( - color: Colors.grey[200], - offset: Offset(0, 6), - blurRadius: 5, - ) - ]), - width: 110, - height: 110, - child: ClipRRect( - borderRadius: BorderRadius.circular(10), - child: userInfo.headimgurl == null || - userInfo.headimgurl == '' - ? Image.asset(Constants.DefaultHeadImgUrl, - height: 110, width: 110) - : CachedNetworkImage( - imageUrl: userInfo.headimgurl, - placeholder: (context, url) => Image.asset( - Constants.DefaultHeadImgUrl, - height: 110, - width: 110, - ), - fit: BoxFit.cover, - ), - ))), - ), - - ///签到功能入口 - needSign - ? Positioned.fill( - child: GestureDetector( - onTap: () { - Navigator.of(context).push(MaterialPageRoute( - builder: (context) { - return DailyBonusPage(); - }, - )); - }, - child: Container( - alignment: Alignment.centerRight, - child: Container( - margin: EdgeInsets.only(right: 23), - width: 48, - height: 48, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(30)), - boxShadow: [ - BoxShadow( - color: Color(0x739f9f9f), - offset: Offset(0.3, 0.5), - blurRadius: 2.0, - spreadRadius: 1.0), -// BoxShadow( -// color: Color(0x9900FF00), offset: Offset(1.0, 1.0)), -// BoxShadow(color: Color(0xFF0000FF)) - ]), - child: ClipOval( - child: Container( - color: Colors.white, - child: Column( - children: [ - SizedBox( - height: 8, - ), - Icon( - IconData(0xe65c, - fontFamily: Constants.IconFontFamily), - size: 20, - color: Color(0xFF0D68FF), - ), - SizedBox( - height: 2, - ), - Text( - I18n.of(context).signin, - style: TextStyle( - color: Color(0xFF0D68FF), fontSize: 10), - ) - ], - ), - ), - ), - ), + child: Container( + margin: EdgeInsets.only(left: 19, right: 19, bottom: 15), + decoration: BoxDecoration(shape: BoxShape.circle, boxShadow: [ + BoxShadow( + color: Color(0xFFD9D9D9), + offset: Offset(0, 0.5), + blurRadius: 5, + ) + ]), + width: width, + height: width, + child: ClipRRect( + borderRadius: BorderRadius.circular(100), + child: userInfo.headimgurl == null || userInfo.headimgurl == '' + ? Image.asset(Constants.DefaultHeadImgUrl, + height: width, width: width) + : CachedNetworkImage( + imageUrl: userInfo.headimgurl, + placeholder: (context, url) => Image.asset( + Constants.DefaultHeadImgUrl, + height: width, + width: width, ), + fit: BoxFit.cover, ), - ) - : Container() - ], - ), + )), ); } - //收藏按钮 - Widget _buildLoveButton(Color buttonColor) { - return isMyself || userInfo.sex == UserData().basicInfo.sex - ? Container() - : Positioned( - right: 10, - top: 20, - child: InkWell( - onTap: () async { - if (!userInfo.isLike) { - HttpUtil().setLove(userInfo.userId, () { - MessageMgr().emit('refresh_love_list', - {'UserId': userInfo.userId, 'flag': 0}); - setState(() { - userInfo.isLike = true; - }); - }); - } else { - HttpUtil().cancleLove(userInfo.userId, () { - MessageMgr().emit('refresh_love_list', - {'UserId': userInfo.userId, 'flag': 2}); - setState(() { - userInfo.isLike = false; - }); - }); - } - }, - child: Container( - child: Row( - children: [ - Icon( - IconData(userInfo.isLike ? 0xe623 : 0xe625, - fontFamily: Constants.IconFontFamily), - size: 14, - color: userInfo.isLike - ? const Color(0xFFFF7777) - : buttonColor, - ), - SizedBox(width: 2), - Text( - I18n.of(context).like, - style: TextStyle(color: buttonColor, fontSize: 11), - ) - ], - ), - padding: EdgeInsets.symmetric(horizontal: 8, vertical: 5), - decoration: BoxDecoration( - border: Border.all(color: Colors.grey[300]), - borderRadius: BorderRadius.circular(5))))); - } - Widget _buildMyPicture() { var pisc = imgList .map((f) => PicSwiperItem( @@ -1247,7 +1049,6 @@ class _ProfilePageState extends State : (isMan ? I18n.of(context).his_photo : I18n.of(context).her_photo)), - //+'(${I18n.of(context).visit_you.replaceFirst('/s1', userInfo.accessNum.toString())})', description: isMyself ? '${I18n.of(context).upload}(${imgList.length}/$MaxImgSize)' : '', @@ -1395,9 +1196,6 @@ class _ProfilePageState extends State }, child: Container( alignment: Alignment.centerRight, - // decoration: BoxDecoration( - // border: - // Border(top: BorderSide(color: Colors.grey[50]))), margin: EdgeInsets.only(top: 10, right: 10, bottom: 10), padding: EdgeInsets.only(top: 10), child: Text( @@ -1407,7 +1205,6 @@ class _ProfilePageState extends State ), )) : Container(), - _buildRset(), ], ), decoration: BoxDecoration( @@ -1536,18 +1333,22 @@ class _ProfilePageState extends State if (isMyself) { child.addAll([ _buildHeadView(), - _buildGoldnessHot(), + _buildSignIn(), _buildMoneyBox(), - _buildMyPicture(), - _buildTips(), - _buildHistory(), - //_buildApplyCode(), - _buildShare(), ]); } else if (isCanWatch) { child.addAll([ _buildHeadView(), - _buildMyPicture(), + Container( + margin: EdgeInsets.only(top: Separate_Size, bottom: Separate_Size), + padding: EdgeInsets.symmetric(horizontal: 10), + child: _buildPicture(), + decoration: BoxDecoration( + color: Colors.white, + border: Border( + top: Constants.GreyBorderSide, + bottom: Constants.GreyBorderSide)), + ), _buildBasicInfo(), _buildBottomTips(), ]); @@ -1729,7 +1530,7 @@ class _ProfilePageState extends State top: 17, bottom: 17, ), - margin: EdgeInsets.only(left: 20, bottom: 0, right: 10), + margin: EdgeInsets.only(left: 45, bottom: 0, right: 10), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -1792,12 +1593,6 @@ class _ProfilePageState extends State }); } - // //对方是女性用户,且未认证提示未认证 - // if (userInfo.sex == 2 && !userInfo.isAttestation) { - // showToast(I18n.of(context).not_video); - // return; - // } - //自己是女性,且未认证,提示去认证(好友除外) if (!UserData().isMan() && !UserData().basicInfo.isAttestation && @@ -1981,6 +1776,17 @@ class _ProfilePageState extends State : '${userInfo.weight.toInt()}KG'; List basicList = [ + Container( + padding: EdgeInsets.symmetric(horizontal: 10), + child: FullWidthButton( + iconCode: 0xe676, + iconColor: 0xFF57BBFB, + title: isMan + ? I18n.of(context).his_profile + : I18n.of(context).her_profile, + showDivider: true, + showRightIcon: false, + onPressed: () {})), userInfo.height != null && userInfo.height != 0 ? _bottomBorderBox(I18n.of(context).height, heightStr, true, () {}) : Container(), @@ -1988,7 +1794,6 @@ class _ProfilePageState extends State ? _bottomBorderBox(I18n.of(context).weight, weightStr, true, () {}) : Container(), _bottomBorderBox(I18n.of(context).Resident_city, dateRange, true, () {}), - //_bottomBorderBox(I18n.of(context).program, dateItem, true, () {}), _bottomBorderBox(I18n.of(context).expect_lover, lovePeople, true, () {}), (userInfo.wechat != null && userInfo.wechat != '') ? _bottomBorderBox( @@ -2000,10 +1805,6 @@ class _ProfilePageState extends State I18n.of(context).facebook, facebook, true, clickChatAccout, showIcon: !isAuthority) : Container(), - userInfo.ownMsg != null && userInfo.ownMsg != '' - ? _bottomBorderBox( - I18n.of(context).self_introduction, myMsg, false, () {}) - : Container(), ]; return Container( @@ -2019,17 +1820,6 @@ class _ProfilePageState extends State )); } - Widget _buildTips() { - return Container( - margin: EdgeInsets.only(top: 10, bottom: 10, left: 20, right: 20), - child: Text(I18n.of(context).dont, - textScaleFactor: 1.0, - style: TextStyle( - fontSize: 12, - color: Colors.grey, - ))); - } - Widget _buildBottomTips() { return Container( margin: EdgeInsets.only(bottom: 10, left: 10, right: 10, top: 10), @@ -2042,37 +1832,6 @@ class _ProfilePageState extends State ); } - Widget _buildGoldnessHot() { - //女神热度 - return isMan - ? Container() - : Container( - margin: EdgeInsets.only(top: Separate_Size), - padding: EdgeInsets.symmetric(horizontal: 10), - child: FullWidthButton( - title: I18n.of(context).Goddess_heat, - showDivider: false, - showRightIcon: true, - onPressed: () { - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return GoddessHotPage( - userId: userInfo.userId, - ); - }, - ), - ); - }, - ), - decoration: BoxDecoration( - color: Colors.white, - border: Border( - top: Constants.GreyBorderSide, - bottom: Constants.GreyBorderSide)), - ); - } - Widget _buildMoneyBox() { //认证、钱包、隐私连麦设置 return Container( @@ -2081,11 +1840,33 @@ class _ProfilePageState extends State color: Colors.white, border: Border( top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)), - padding: EdgeInsets.all(10), + padding: EdgeInsets.only(top: 4, bottom: 4, left: 10, right: 10), child: Column( children: [ + isMan + ? Container() + : FullWidthButton( + iconCode: 0xe687, + iconColor: 0xFFFF7752, + title: I18n.of(context).Goddess_heat, + showDivider: true, + showRightIcon: true, + onPressed: () { + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return GoddessHotPage( + userId: userInfo.userId, + ); + }, + ), + ); + }, + ), isMan ? FullWidthButton( + iconCode: 0xe68e, + iconColor: 0xFF3D83E6, title: I18n.of(context).member, description: UserData().isVip ? I18n.of(context) @@ -2104,6 +1885,8 @@ class _ProfilePageState extends State }, ) : FullWidthButton( + iconCode: 0xe688, + iconColor: 0xFF3D83E6, title: isAttestation ? I18n.of(context).certified_video : I18n.of(context).authenticate, @@ -2123,10 +1906,12 @@ class _ProfilePageState extends State }, ), FullWidthButton( + iconCode: 0xe68a, + iconColor: 0xFF4CB871, title: I18n.of(context).wallet, description: '${Provider.of(context).money}${I18n.of(context).mask_coin}', - showDivider: false, + showDivider: true, onPressed: () { Navigator.of(context).push( new MaterialPageRoute( @@ -2137,86 +1922,12 @@ class _ProfilePageState extends State ); }, ), + _buildPicture(), ], ), ); } - Widget _buildHistory() { - //历史访客 - return Container( - margin: EdgeInsets.only(top: Separate_Size), - padding: EdgeInsets.symmetric(horizontal: 10), - child: FullWidthButton( - title: I18n.of(context).historical_visitor, - description: I18n.of(context) - .visit_you - .replaceFirst('/s1', userInfo.accessNum.toString()), - showDivider: false, - showRightIcon: false, - onPressed: () {}, - ), - decoration: BoxDecoration( - color: Colors.white, - border: Border( - top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)), - ); - } - - //恢复焚阅照片 - Widget _buildRset() { - //历史访客 - return isMyself - ? Container( - margin: EdgeInsets.only(top: Separate_Size), - //padding: EdgeInsets.symmetric(horizontal: 10), - child: FullWidthButton( - title: I18n.of(context) - .visit_photo - .replaceFirst('/s1', userInfo.burnNum.toString()), - description: I18n.of(context).recovery_photo, - showDivider: false, - showRightIcon: false, - onPressed: () async { - CustomUI.buildOneConfirm( - context, - I18n.of(context).confrim_recovery, - I18n.of(context).determine, () async { - HttpUtil().resetPhoto(() { - Navigator.of(context).pop(); - userInfo.burnNum = 0; - setState(() {}); - }); - }); - }, - ), - decoration: BoxDecoration( - color: Colors.white, - border: Border(top: Constants.GreyBorderSide)), - ) - : Container(); - } - - Widget _buildShare() { - //分享 - return Container( - margin: EdgeInsets.only(top: Separate_Size, bottom: Separate_Size), - padding: EdgeInsets.symmetric(horizontal: 10), - child: FullWidthButton( - showRightIcon: false, - title: I18n.of(context).share_app, - showDivider: false, - onPressed: () { - Share.share('https://henho.jphgames.com/'); - }, - ), - decoration: BoxDecoration( - color: Colors.white, - border: Border( - top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)), - ); - } - Widget _buildIcon(code, str, isCanHit, callback, {iconSize = 28.0}) { var color = isCanHit ? Constants.BlueTextColor : Constants.GreyTextColor; return InkWell( @@ -2257,45 +1968,16 @@ class _ProfilePageState extends State titleSpacing: isMyself ? -40 : NavigationToolbar.kMiddleSpacing, title: isMyself ? Text( - I18n.of(context).me, + userInfo.nickName, + //I18n.of(context).me, textScaleFactor: 1.0, style: Constants.MainTitleStyle, ) - : Container( - alignment: Alignment.center, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - WebData().subUserName( - Provider.of(context) - .getRefName(userInfo.userId, userInfo.nickName)), - textScaleFactor: 1.0, - style: TextStyle(color: Constants.BlackTextColor)), - isAttestation && !isMan - ? Container( - height: 13, - margin: EdgeInsets.only(left: 5), - padding: EdgeInsets.only(left: 5, right: 5), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Constants.PurpleBackgroundColor, - ), - child: Text( - 'Real', - textScaleFactor: 1.0, - style: TextStyle(fontSize: 10, color: Colors.white), - )) - : Text(''), - isVip && isMan - ? Container( - margin: EdgeInsets.only(left: 5), - child: - isSvip ? Constants.svipIcon : Constants.vipIcon) - : Text(''), - ], - )), + : Text( + WebData().subUserName(Provider.of(context) + .getRefName(userInfo.userId, userInfo.nickName)), + textScaleFactor: 1.0, + style: TextStyle(color: Constants.BlackTextColor)), centerTitle: !isMyself, elevation: 1, actions: [ @@ -2308,66 +1990,18 @@ class _ProfilePageState extends State backgroundColor: Constants.GreyBackgroundColor, radius: 15.75, child: Icon( - IconData(0xe658, fontFamily: 'iconfont'), + IconData(0xe685, fontFamily: 'iconfont'), color: Constants.BlackTextColor, size: 20, )), onTap: () { - AppNavigator.pushQrPage(context); + Share.share('https://henho.jphgames.com/'); }, ), ) : Container(), isMyself - ? Container( - padding: EdgeInsets.only(right: 15), - alignment: Alignment.center, - child: new InkWell( - child: CircleAvatar( - backgroundColor: Constants.GreyBackgroundColor, - radius: 15.75, - child: Icon( - Icons.settings, - //IconData(0xe6e5, fontFamily: 'iconfont'), - color: Constants.BlackTextColor, - size: 22, - )), - onTap: () { - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return SystemEditPage(); - }, - ), - ); - }, - ), - ) - : Container(), - isMyself - ? Container( - // padding: EdgeInsets.only(right: 10), - // alignment: Alignment.center, - // child: new InkWell( - // child: CircleAvatar( - // backgroundColor: Constants.GreyBackgroundColor, - // radius: 15.75, - // child: Icon( - // IconData(0xe6e5, fontFamily: 'iconfont'), - // color: Constants.BlackTextColor, - // size: 25, - // )), - // onTap: () { - // Navigator.of(context).push( - // new MaterialPageRoute( - // builder: (context) { - // return EditPage(isEditPage: true); - // }, - // ), - // ); - // }, - // ), - ) + ? Container() : Container( alignment: Alignment.center, child: new InkWell( @@ -2494,7 +2128,7 @@ class _ProfilePageState extends State : (widget.addMode == 2 ? [_dealInvite()] : [ - _buildIcon(0xe633, I18n.of(context).evaluate, true, + _buildIcon(0xe68b, I18n.of(context).evaluate, true, () async { Map data = { "userid": userInfo.userId, @@ -2517,9 +2151,6 @@ class _ProfilePageState extends State showToast(resData['msg']); } }), - _buildIcon(0xe637, I18n.of(context).private_chat, - isCanWatch, isCanWatch ? buyChatAccount : null, - iconSize: 24.0), _buildIcon( 0xe62f, I18n.of(context).chat, isCanWatch, onAudio) ]), diff --git a/lib/home/SystemEditPage.dart b/lib/home/SystemEditPage.dart index 8683ec6..09ab485 100644 --- a/lib/home/SystemEditPage.dart +++ b/lib/home/SystemEditPage.dart @@ -78,6 +78,7 @@ class SystemEditPageState extends State { textScaleFactor: 1.0, ), centerTitle: true, + elevation: 1, leading: CustomUI.buildCustomLeading(context), ), body: SafeArea( @@ -107,6 +108,8 @@ class SystemEditPageState extends State { _buildMyEvaluation(), _buildVersion(), _buildHelp(), + _buildHistory(), + _buildRset(), SizedBox(height: Separate_Size), _buildLogout(), SizedBox(height: Separate_Size), @@ -114,6 +117,56 @@ class SystemEditPageState extends State { ); } + //恢复焚阅照片 + Widget _buildRset() { + //历史访客 + return Container( + margin: EdgeInsets.only(top: Separate_Size), + padding: EdgeInsets.symmetric(horizontal: 10), + child: FullWidthButton( + title: I18n.of(context) + .visit_photo + .replaceFirst('/s1', UserData().basicInfo.burnNum.toString()), + description: I18n.of(context).recovery_photo, + showDivider: false, + showRightIcon: false, + onPressed: () async { + CustomUI.buildOneConfirm(context, I18n.of(context).confrim_recovery, + I18n.of(context).determine, () async { + HttpUtil().resetPhoto(() { + Navigator.of(context).pop(); + UserData().basicInfo.burnNum = 0; + setState(() {}); + }); + }); + }, + ), + decoration: BoxDecoration( + color: Colors.white, border: Border(top: Constants.GreyBorderSide)), + ); + } + + Widget _buildHistory() { + //历史访客 + return Container( + margin: EdgeInsets.only(top: Separate_Size), + padding: EdgeInsets.symmetric(horizontal: 10), + child: FullWidthButton( + title: I18n.of(context).historical_visitor, + description: I18n.of(context) + .visit_you + .replaceFirst('/s1', UserData().basicInfo.accessNum.toString()), + showDivider: false, + showRightIcon: false, + onPressed: () {}, + ), + decoration: BoxDecoration( + color: Colors.white, + border: Border( + top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)), + ); + } + //有问题需要帮助 Widget _buildHelp() { return Container( @@ -398,7 +451,6 @@ class SystemEditPageState extends State { }, true); setStatusBar(); - } //清楚图片缓存 @@ -512,17 +564,14 @@ class SystemEditPageState extends State { context, I18n.of(context).exit, I18n.of(context).determine, () { userLogout(); HttpUtil().postLoginOut(context); - }); } - - static userLogout(){ + static userLogout() { LocalNotificationUtil().removeAlias(); ReceiveShareFile.dispose(); } - //退出登陆 Widget _buildLogout() { return Container( diff --git a/lib/home/friend_page.dart b/lib/home/friend_page.dart index 1df91ee..6b06981 100644 --- a/lib/home/friend_page.dart +++ b/lib/home/friend_page.dart @@ -17,10 +17,8 @@ import 'package:chat/utils/friend_list_mgr.dart'; import 'package:chat/utils/screen.dart'; import 'package:dio/dio.dart'; import 'package:oktoast/oktoast.dart'; -import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; import 'package:shared_preferences/shared_preferences.dart'; -import 'address_book.dart'; List showUserList = []; diff --git a/lib/home/homeMain.dart b/lib/home/homeMain.dart index c3fad2a..7d8ec1a 100644 --- a/lib/home/homeMain.dart +++ b/lib/home/homeMain.dart @@ -34,7 +34,6 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'package:chat/utils/my_bottom_navigation_bar.dart' as myBottm; import 'friend_page.dart'; -import 'group_chat_page.dart'; class NavigationIconView { final BottomNavigationBarItem item; diff --git a/lib/home/last_chat_record_widget.dart b/lib/home/last_chat_record_widget.dart index 588003e..ebd9f7b 100644 --- a/lib/home/last_chat_record_widget.dart +++ b/lib/home/last_chat_record_widget.dart @@ -110,7 +110,7 @@ class _LastChatPageState extends State { : Container(), NetStateWidget(), widget.needRobot ? _translateRobot() : Container(), - _CompanyServer(), + _companyServer(), lastMsgList.length == 0 ? _emptyContent() : _chatRecordsList(lastMsgList) @@ -155,7 +155,7 @@ class _LastChatPageState extends State { )); } - Widget _CompanyServer() { + Widget _companyServer() { return InkWell( onTap: () { AppNavigator.pushCompanyServerPage(context); diff --git a/lib/home/my_headview.dart b/lib/home/my_headview.dart new file mode 100644 index 0000000..7b4a5e0 --- /dev/null +++ b/lib/home/my_headview.dart @@ -0,0 +1,179 @@ +import 'dart:io'; + +import 'package:chat/generated/i18n.dart'; +import 'package:chat/utils/CustomUI.dart'; +import 'package:chat/utils/LoadingDialog.dart'; +import 'package:chat/utils/MessageMgr.dart'; +import 'package:chat/utils/screen.dart'; +import 'package:extended_image/extended_image.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:image_cropper/image_cropper.dart'; +import 'package:image_picker/image_picker.dart'; +import '../utils/HttpUtil.dart'; +import 'package:dio/dio.dart'; +import "../data/UserData.dart"; +import '../utils/TokenMgr.dart'; + +class MyHeadViewPage extends StatefulWidget { + MyHeadViewPage({Key key}) : super(key: key); + + @override + _MyHeadViewPageState createState() => new _MyHeadViewPageState(); +} + +class _MyHeadViewPageState extends State + with SingleTickerProviderStateMixin { + AnimationController _animationController; + Animation _animation; + Function animationListener; + List doubleTapScales = [1.0, 2.0]; + + @override + void initState() { + super.initState(); + _animationController = AnimationController( + duration: const Duration(milliseconds: 150), vsync: this); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea(child: _buildBody()), + backgroundColor: Colors.black, + ); + } + + Widget _buildHeadView() { + return ExtendedImageGesturePageView( + children: [ + InkWell( + onTap: () { + Navigator.pop(context); + }, + child: ExtendedImage.network( + UserData().basicInfo.headimgurl, + fit: BoxFit.contain, + mode: ExtendedImageMode.gesture, + initGestureConfigHandler: (state) { + return GestureConfig( + inPageView: true, + maxScale: 5, + initialAlignment: InitialAlignment.topCenter, + animationMaxScale: 5, + cacheGesture: false); + }, + onDoubleTap: (ExtendedImageGestureState state) { + var pointerDownPosition = state.pointerDownPosition; + double begin = state.gestureDetails.totalScale; + double end; + //remove old + _animation?.removeListener(animationListener); + + //stop pre + _animationController.stop(); + + //reset to use + _animationController.reset(); + + if (begin == doubleTapScales[0]) { + end = doubleTapScales[1]; + } else { + end = doubleTapScales[0]; + } + + animationListener = () { + //print(_animation.value); + state.handleDoubleTap( + scale: _animation.value, + doubleTapPosition: pointerDownPosition); + }; + _animation = _animationController + .drive(Tween(begin: begin, end: end)); + + _animation.addListener(animationListener); + + _animationController.forward(); + }, + )) + ], + ); + } + + Widget _buildBody() { + return Stack( + children: [ + _buildHeadView(), + Positioned( + child: _buildChangeButton(), + bottom: 40, + ) + ], + ); + } + + Widget _buildChangeButton() { + return InkWell( + onTap: _sendPicture, + child: Container( + alignment: Alignment.center, + width: Screen.width, + child: Container( + height: 47.5, + alignment: Alignment.center, + width: 230, + child: Text( + I18n.of(context).upload_avatar, + style: TextStyle(color: Colors.white, fontSize: 17.5), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(24), + color: Color(0xFF181818)), + ))); + } + + void _sendPicture() async { + if (await CustomUI.showPhotoPermissionSetting(context)) { + showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return LoadingDialog( + text: "", + ); + }); + var tempFile = await ImagePicker.pickImage(source: ImageSource.gallery); + Navigator.of(context).pop(); + if (tempFile != null) { + _cropPicture(tempFile); + } + } + } + + void _cropPicture(tempFile) async { + File croppedFile = await ImageCropper.cropImage( + sourcePath: tempFile.path, + aspectRatio: CropAspectRatio(ratioX: 1, ratioY: 1), + ); + + if (croppedFile != null) { + Map data = {"type": 1, "userId": UserData().basicInfo.userId}; + data['sign'] = TokenMgr().getSign(data); + Response res = await HttpUtil() + .uploadFile(croppedFile, data, 'upload/file/postflie', 'image'); + var resData = res.data; + if (resData['code'] == 0) { + UserData().basicInfo.headimgurl = resData['msg']; + MessageMgr().emit('change_my_headview'); + if (mounted) { + setState(() {}); + } + } + } + } + + @override + void dispose() { + super.dispose(); + } +} diff --git a/lib/home/new_addfriends.dart b/lib/home/new_addfriends.dart index 82010a2..4ddb5c8 100644 --- a/lib/home/new_addfriends.dart +++ b/lib/home/new_addfriends.dart @@ -1,8 +1,6 @@ import 'dart:io'; -import 'package:cached_network_image/cached_network_image.dart'; import 'package:chat/home/global_search.dart'; -import 'package:chat/home/new_friends.dart'; import 'package:chat/models/friends_info.dart'; import 'package:chat/utils/TutorialOverlay.dart'; import 'package:flutter/material.dart'; @@ -10,16 +8,9 @@ import 'package:chat/data/UserData.dart'; import 'package:chat/data/constants.dart'; import 'package:chat/generated/i18n.dart'; import 'package:chat/utils/CustomUI.dart'; -import 'package:chat/utils/HttpUtil.dart'; import 'package:chat/utils/MessageMgr.dart'; -import 'package:chat/utils/TokenMgr.dart'; -import 'package:chat/utils/conversation_table.dart'; -import 'package:chat/utils/friend_list_mgr.dart'; import 'package:chat/utils/screen.dart'; -import 'package:dio/dio.dart'; -import 'package:oktoast/oktoast.dart'; import 'package:permission_handler/permission_handler.dart'; -import 'package:shared_preferences/shared_preferences.dart'; import 'address_book.dart'; import 'my_qr.dart'; diff --git a/lib/home/new_friends.dart b/lib/home/new_friends.dart index c7e046e..94fbd1f 100644 --- a/lib/home/new_friends.dart +++ b/lib/home/new_friends.dart @@ -8,7 +8,6 @@ import 'package:chat/utils/HttpUtil.dart'; import 'package:chat/utils/MessageMgr.dart'; import 'package:chat/utils/TokenMgr.dart'; import 'package:chat/utils/conversation_table.dart'; -import 'package:chat/utils/screen.dart'; import 'package:dio/dio.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; diff --git a/lib/home/photo_page.dart b/lib/home/photo_page.dart new file mode 100644 index 0000000..9ea5858 --- /dev/null +++ b/lib/home/photo_page.dart @@ -0,0 +1,516 @@ +import 'dart:io'; +import 'dart:typed_data'; + +import 'package:chat/data/UserData.dart'; +import 'package:chat/data/constants.dart'; +import 'package:chat/generated/i18n.dart'; +import 'package:chat/home/rich_title.dart'; +import 'package:chat/models/UserInfo.dart'; +import 'package:chat/models/money_change.dart'; +import 'package:chat/models/ref_name_provider.dart'; +import 'package:chat/utils/ChargeMoney.dart'; +import 'package:chat/utils/CustomUI.dart'; +import 'package:chat/utils/HttpUtil.dart'; +import 'package:chat/utils/MessageMgr.dart'; +import 'package:chat/utils/PicSwiper.dart'; +import 'package:chat/utils/TokenMgr.dart'; +import 'package:chat/utils/file_cache_mgr.dart'; +import 'package:chat/utils/screen.dart'; +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:multi_image_picker/multi_image_picker.dart'; +import 'package:oktoast/oktoast.dart'; +import 'package:provider/provider.dart'; + +import 'VipPage.dart'; + +const double LeftSize = 80; +const MaxImgSize = 20; + +class PhotoPage extends StatefulWidget { + @required + final UserInfo userInfo; + PhotoPage({Key key, this.userInfo}) : super(key: key); + + @override + _PhotoPageState createState() => new _PhotoPageState(); +} + +class _PhotoPageState extends State { + bool isMyself = false; + bool isMan = false; + Map imgList = {}; + bool isLoadingFinish = false; + double imgWidth = (Screen.width - LeftSize - 60) / 3; + var resultList = []; + bool isBuyPicture = false; + + @override + void initState() { + super.initState(); + isMyself = widget.userInfo.userId == UserData().basicInfo.userId; + isMan = widget.userInfo.sex == 1; + isBuyPicture = (isMyself || + widget.userInfo.photoAut == 0 || + widget.userInfo.payStatus == 1); + getImg(); + MessageMgr().on('refresh_photo', msgRefreshPhoto); + } + + msgRefreshPhoto(data) { + getImg(); + } + + void getImg() async { + Map data = { + "visitUserId": UserData().basicInfo.userId, + "userId": widget.userInfo.userId, + }; + data['sign'] = TokenMgr().getSign(data); + + Response res = await HttpUtil().post('user/personal/album', data: data); + if (res == null) { + return; + } + isLoadingFinish = true; + Map resData = res.data; + if (resData['code'] == 0) { + imgList = {}; + resultList = resData['data'] ?? []; + for (int i = 0; i < resultList.length; i++) { + var temp = DateTime.parse(resultList[i]['CreatTime']); + if (imgList[temp.year] == null) { + imgList[temp.year] = { + 1: [], + 2: [], + 3: [], + 4: [], + 5: [], + 6: [], + 7: [], + 8: [], + 9: [], + 10: [], + 11: [], + 12: [], + }; + } + imgList[temp.year][temp.month].add(resultList[i]); + } + + if (isMyself) { + UserData().picNum = 0; + for (int i = 0; i < resultList.length; i++) { + if (resultList[i]['Status'] == 1) { + UserData().picNum++; + } + if (resultList[i]['Status'] == 0 || resultList[i]['Status'] == 2) { + UserData().haveReview = true; + } + } + } + + if (mounted) { + setState(() {}); + } + } + } + + @override + Widget build(BuildContext context) { + var content = Scaffold( + appBar: AppBar( + title: !isMyself + ? Text( + (isMyself + ? I18n.of(context).my_album + : (isMan + ? I18n.of(context).his_photo + : I18n.of(context).her_photo)), + textScaleFactor: 1.0, + style: TextStyle( + color: AppColors.NewAppbarTextColor, fontSize: 20), + ) + : Column(children: [ + Text( + (isMyself + ? I18n.of(context).my_album + : (isMan + ? I18n.of(context).his_photo + : I18n.of(context).her_photo)), + textScaleFactor: 1.0, + style: TextStyle( + color: AppColors.NewAppbarTextColor, fontSize: 20), + ), + Text( + '${resultList.length}/$MaxImgSize', + style: TextStyle(fontSize: 11), + ) + ]), + leading: CustomUI.buildCustomLeading(context), + titleSpacing: -10, + centerTitle: true, + elevation: 1), + backgroundColor: Colors.white, + body: SafeArea( + child: SingleChildScrollView( + child: Column(children: _buildBody()), + )), + ); + + return CustomUI.buildPageLoading(context, content, !isLoadingFinish); + } + + buyPhoto() { + //女性用户付费,男性用户会员的话免费解锁,非会员付费解锁 + becomeVip() { + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return VipPage(); + }, + ), + ); + } + + payCallback() { + if (Provider.of(context).money < + widget.userInfo.price) { + Navigator.of(context).pop(); + CustomUI.buildOneConfirm(context, I18n.of(context).balance_insufficien, + I18n.of(context).recharge, () { + Navigator.of(context).pop(); + ChargeMoney.showChargeSheet(context, () { + setState(() {}); + }); + }); + return; + } + Navigator.of(context).pop(); + HttpUtil().buyPictures( + widget.userInfo.price, widget.userInfo.userId, context, () { + setState(() { + isBuyPicture = true; + widget.userInfo.payStatus = 1; + }); + }); + } + + freeTime() { + HttpUtil().userFreeTime(context, widget.userInfo.userId, 1, () { + UserData().basicInfo.usedNum++; + Navigator.of(context).pop(); + setState(() { + isBuyPicture = true; + widget.userInfo.payStatus = 1; + }); + }); + } + + String title = I18n.of(context).unlock_user.replaceFirst( + '/s1', + Provider.of(context) + .getRefName(widget.userInfo.userId, widget.userInfo.nickName), + ); + + if (!UserData().isMan()) { + CustomUI.buildOneConfirm( + context, + title, + I18n.of(context) + .pay_unlock + .replaceFirst('/s1', widget.userInfo.price.toString()), + payCallback); + } else if (UserData().isVip) { + if (UserData().basicInfo.freeNum < UserData().basicInfo.usedNum) { + CustomUI.buildOneConfirm( + context, + title, + I18n.of(context) + .pay_unlock + .replaceFirst('/s1', widget.userInfo.price.toString()), + payCallback); + } else { + CustomUI.buildOneConfirm( + context, title, I18n.of(context).unlock_choose, freeTime); + } + } else { + CustomUI.buildTowConfirm( + context, + title, + I18n.of(context).become_member, + becomeVip, + I18n.of(context) + .pay_unlock + .replaceFirst('/s1', widget.userInfo.price.toString()), + payCallback); + } + } + + Widget _buildLockWidget() { + TitleItem title; + if (!isMan) { + title = UserData().isVip + ? TitleItem( + title: I18n.of(context).unlock_user, + name: Provider.of(context) + .getRefName(widget.userInfo.userId, widget.userInfo.nickName), + ) + : TitleItem( + title: I18n.of(context).free_unlock, + name: widget.userInfo.price.toString() + + I18n.of(context).mask_coin); + } else { + title = TitleItem( + title: I18n.of(context).pay_unlock, + name: widget.userInfo.price.toString()); + } + return Container( + height: Screen.height * 0.7, + alignment: Alignment.center, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/lock_photo.png', + width: 160, + //color: Colors.grey[700], + ), + Container( + margin: EdgeInsets.only(top: 20), + alignment: Alignment.center, + child: Text( + isMan ? I18n.of(context).set_lock : I18n.of(context).set_lock2, + textScaleFactor: 1.0, + style: TextStyle( + color: Colors.grey[700], + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + Container( + margin: EdgeInsets.only(top: 8), + alignment: Alignment.center, + child: RichText( + text: TextSpan( + children: RichTitle.getRichText(title, + titleStyle: + TextStyle(color: Colors.grey[700], fontSize: 13), + nameStyle: TextStyle(color: Colors.red, fontSize: 13))), + ), + ), + InkWell( + onTap: buyPhoto, + child: Container( + margin: EdgeInsets.only(top: 30), + padding: EdgeInsets.only(top: 6, bottom: 6), + width: 100, + alignment: Alignment.center, + decoration: Constants.ConfirmBUttonBoxDecoration, + child: Text( + I18n.of(context).unlock, + textScaleFactor: 1.0, + style: TextStyle(color: Colors.white, fontSize: 18), + ), + )), + ], + )); + } + + List _buildBody() { + List list = [_buildUpload()]; + if (imgList.length == 0 && isLoadingFinish && !isMyself) { + list.add(CustomUI.buildNoData(context)); + return list; + } + + if (!isBuyPicture) { + list.add(_buildLockWidget()); + return list; + } + + imgList.keys.forEach((k) { + list.add(_buildYear(k)); + }); + return list; + } + + //上传相册 + void _uploadPhoto() async { + int leftLength = MaxImgSize - imgList.length; + if (leftLength <= 0) { + showToast(I18n.of(context) + .max_upload_size + .replaceFirst('/s1', MaxImgSize.toString())); + return; + } + List resultList = List(); + + resultList = await MultiImagePicker.pickImages( + maxImages: leftLength > 9 ? 9 : leftLength, + enableCamera: false, + selectedAssets: [], + cupertinoOptions: CupertinoOptions(takePhotoIcon: "chat"), + materialOptions: MaterialOptions( + actionBarColor: "#50A7F9", + actionBarTitle: "Hibok", + allViewTitle: "", + useDetailsView: true, + selectCircleStrokeColor: "#000000", + ), + ); + + if (resultList != null && resultList.length > 0) { + List fileList = []; + for (var i = 0; i < resultList.length; i++) { + Asset photoEntity = resultList[i]; + print('名字:${photoEntity.name}'); + ByteData byteData = await photoEntity.getByteData(); + File file = await FileCacheMgr().writeFile( + 'temp-photo-${DateTime.now().millisecondsSinceEpoch}.png', + byteData.buffer.asInt8List(0)); + + fileList.add(file); + } + print('文件列表${fileList.length}'); + Map data = {"type": 2, "userId": UserData().basicInfo.userId}; + data['sign'] = TokenMgr().getSign(data); + data['sex'] = UserData().basicInfo.sex; + data['isBurn'] = 0; + Response res = await HttpUtil().uploadFiles( + fileList, data, 'upload/post/postfiles', 'image', + isShowLoading: true); + var resData = res.data; + if (resData['code'] == 0) { + if (resData['data']['msg'] != '' && resData['data']['msg'] != null) { + showToast(resData['data']['msg']); + } + if (resData['msg'].split('|').length != fileList.length) { + showToast(I18n.of(context).hava_error_photo); + } + //MessageMgr().emit('refresh_photo'); + getImg(); + } else { + showToast(resData['msg']); + } + } + } + + Widget _buildUpload() { + return isMyself + ? Container( + margin: EdgeInsets.only(top: 20), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + alignment: Alignment.centerRight, + margin: EdgeInsets.only(right: 15), + width: LeftSize, + child: Text( + I18n.of(context).upload1, + style: + TextStyle(fontSize: 15, fontWeight: FontWeight.w600), + )), + InkWell( + onTap: _uploadPhoto, + child: Container( + width: imgWidth, + height: imgWidth, + margin: EdgeInsets.all(5), + decoration: BoxDecoration( + color: Color(0xFFEDEDED), + borderRadius: BorderRadius.circular(10)), + child: Icon( + IconData(0xe686, fontFamily: Constants.IconFontFamily), + size: 35, + color: Colors.white, + ), + )) + ], + ), + ) + : Container(); + } + + Widget _buildYear(int year) { + var list = [_buildYearTips(year)]; + imgList[year].keys.forEach((k) { + if (imgList[year][k].length > 0) { + list.add(_buildMonth(year, k)); + } + }); + return Container( + width: Screen.width, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: list, + )); + } + + Widget _buildYearTips(int year) { + return Container( + alignment: Alignment.centerRight, + margin: EdgeInsets.only(right: 15, top: 20, bottom: 18), + width: LeftSize, + child: Text( + '$year${I18n.of(context).year}', + style: TextStyle(fontSize: 15, fontWeight: FontWeight.w600), + )); + } + + Widget _buildMonth(int year, int month) { + if (imgList[year] == null || imgList[year][month] == null) { + return Container(); + } + List pisc = []; + imgList[year][month].forEach((f) { + pisc.add(PicSwiperItem( + f['ImgUrl'], + id: f['Id'], + type: f['Type'], + isWatch: f['IsCheck'] == 1, + userId: widget.userInfo.userId, + isBuy: f['PayStatus'] == 1, + isCheck: f['Status'] == 0, + )); + }); + + List list = []; + imgList[year][month].forEach((data) { + bool isWatch = data['IsCheck'] == 1; + double raduis = 10; + list.add(CustomUI.buildImgCover(data['Id'], pisc, data['ImgUrl'], + imgWidth, raduis, isWatch, context, data['Type'], + isMyself: isMyself, + payStatus: data['PayStatus'], + state: isMan ? 1 : data['Status'])); + }); + return Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + alignment: Alignment.centerRight, + margin: EdgeInsets.only(right: 15, top: 1), + width: LeftSize, + child: Text( + '$month${I18n.of(context).month}', + style: TextStyle(fontSize: 15, fontWeight: FontWeight.w600), + )), + Container( + width: Screen.width - LeftSize - 15, + child: Wrap( + crossAxisAlignment: WrapCrossAlignment.start, + children: list, + )) + ], + ); + } + + @override + void dispose() { + super.dispose(); + MessageMgr().off('refresh_photo', msgRefreshPhoto); + } +} diff --git a/lib/models/unread_count_provider.dart b/lib/models/unread_count_provider.dart index 74017c8..094bb80 100644 --- a/lib/models/unread_count_provider.dart +++ b/lib/models/unread_count_provider.dart @@ -1,4 +1,6 @@ +import 'package:chat/data/constants.dart'; import 'package:chat/utils/MessageMgr.dart'; +import 'package:chat/utils/sp_utils.dart'; class UnreadCountProvider { //未读消息条数管理 @@ -16,12 +18,41 @@ class UnreadCountProvider { MessageMgr().emit('Update UnreadCount', sessionId); } + initUnreadAlter() async { + //初始化@消息 + List alterList = await SPUtils.getStringList(Constants.GroupAlterKey) ?? []; + for (int i = 0; i < alterList.length; i++) { + var list = alterList[i].split('-'); + if (list.length == 2) { + isHaveAlterme[int.parse(list[0])] = int.parse(list[1]); + } + } + } + getHavaAltertime(int sessionId) { return isHaveAlterme[sessionId] ?? null; } setAlterMe(int sessionId, int time) { - if (isHaveAlterme[sessionId] == null) isHaveAlterme[sessionId] = time; + if (isHaveAlterme[sessionId] == null) { + isHaveAlterme[sessionId] = time; + saveGroupAlterToLocal(); + } + } + + saveGroupAlterToLocal() { + List alterList = []; + isHaveAlterme.forEach((k, v) { + if (v != null) { + alterList.add('$k-$v'); + } + }); + SPUtils.saveList(Constants.GroupAlterKey, alterList); + } + + signUnreadAlter(int sessionId) { + isHaveAlterme[sessionId] = null; + saveGroupAlterToLocal(); } clear() { @@ -45,7 +76,7 @@ class UnreadCountProvider { print('消除未读标记:$sessionId'); int count = getUnreadCount(sessionId); - isHaveAlterme[sessionId] = null; + signUnreadAlter(sessionId); if (count > 0) { unreadCountMap[sessionId] = 0; diff --git a/lib/utils/CustomUI.dart b/lib/utils/CustomUI.dart index a3df280..84dccdb 100644 --- a/lib/utils/CustomUI.dart +++ b/lib/utils/CustomUI.dart @@ -382,7 +382,7 @@ class CustomUI { static Widget buildImgCover( int imgId, - List pics, + List pics, String imgUrl, double width, double raduis, diff --git a/lib/utils/FullWithButton.dart b/lib/utils/FullWithButton.dart index 9c79f01..2dd0390 100644 --- a/lib/utils/FullWithButton.dart +++ b/lib/utils/FullWithButton.dart @@ -11,6 +11,8 @@ class FullWidthButton extends StatelessWidget { final String description; final Color descriptionColor; final bool showRightIcon; + final int iconCode; + final iconColor; final Widget extendWidget; @@ -21,8 +23,9 @@ class FullWidthButton extends StatelessWidget { this.descriptionColor, this.showRightIcon: true, this.showDivider: false, - this.extendWidget - }) + this.iconCode, + this.iconColor, + this.extendWidget}) : assert(title != null), assert(onPressed != null); @@ -32,28 +35,39 @@ class FullWidthButton extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ + iconCode == null + ? Container() + : Container( + margin: EdgeInsets.only(right: 5,bottom: 3), + child: Icon( + IconData( + iconCode, + fontFamily: 'iconfont', + ), + color: Color(iconColor), + size: 20, + )), SizedBox(width: Hor_Padding), Expanded( child: Text( title, textScaleFactor: 1.0, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.normal - ), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.normal), ), ), - extendWidget!=null?extendWidget: Text( - description, - textScaleFactor: 1.0, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.normal, - color: descriptionColor == null - ? const Color(0xFF818181) - : descriptionColor), - ), + extendWidget != null + ? extendWidget + : Text( + description, + textScaleFactor: 1.0, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.normal, + color: descriptionColor == null + ? const Color(0xFF818181) + : descriptionColor), + ), showRightIcon ? Padding( padding: EdgeInsets.only(bottom: 1.5), diff --git a/lib/utils/HttpUtil.dart b/lib/utils/HttpUtil.dart index a56dd3d..90ec477 100644 --- a/lib/utils/HttpUtil.dart +++ b/lib/utils/HttpUtil.dart @@ -282,7 +282,7 @@ class HttpUtil { } Map resData = res.data; print('用户信息resData $resData'); - if (resData['code'] == 0) { + if (resData['code'] == 0 && resData != null) { var info = UserInfo.fromJson(resData['data']); info.isBlackened ? BlacklistMgr.addBlackListMe(info.userId) diff --git a/lib/utils/sp_utils.dart b/lib/utils/sp_utils.dart index 515d4f8..ba1c5f5 100755 --- a/lib/utils/sp_utils.dart +++ b/lib/utils/sp_utils.dart @@ -1,10 +1,6 @@ - import 'package:shared_preferences/shared_preferences.dart'; class SPUtils { - - - static saveString(String key, value) async { SharedPreferences spf = await SharedPreferences.getInstance(); spf.setString(key, value); @@ -15,7 +11,6 @@ class SPUtils { spf.setStringList(key, value); } - static saveBool(String key, value) async { SharedPreferences prefs = await SharedPreferences.getInstance(); prefs.setBool(key, value); @@ -36,6 +31,11 @@ class SPUtils { return prefs.get(key); } + static getStringList(String key) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + return prefs.getStringList(key); + } + static remove(String key) async { SharedPreferences prefs = await SharedPreferences.getInstance(); prefs.remove(key); diff --git a/pubspec.yaml b/pubspec.yaml index a7df44e..5e04abf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -311,6 +311,8 @@ flutter: - assets/images/gift_2.png - assets/images/ext_txt.png - assets/images/gift_show_2_1.png + - assets/images/up.png + - assets/images/lock_photo.png # assets/images/chat/* - assets/images/chat/emoji.png - assets/images/chat/onion.png