From e2cb2e85e84847dee90ffe681713078c15d1e944 Mon Sep 17 00:00:00 2001 From: ZCM <772112648@qq.com> Date: Mon, 20 Apr 2020 09:24:41 +0800 Subject: [PATCH] 1 --- lib/home/ConversActionPage.dart | 1094 ++++++++++++++----------------- lib/home/DiscoverPage.dart | 51 +- lib/home/EditData.dart | 17 +- lib/home/ProfilePage.dart | 22 +- lib/home/friend_page.dart | 37 +- lib/home/new_friends.dart | 32 +- lib/utils/CustomUI.dart | 37 +- lib/utils/HttpUtil.dart | 6 +- pubspec.yaml | 2 +- 9 files changed, 593 insertions(+), 705 deletions(-) diff --git a/lib/home/ConversActionPage.dart b/lib/home/ConversActionPage.dart index ab0f3dc..a06e932 100644 --- a/lib/home/ConversActionPage.dart +++ b/lib/home/ConversActionPage.dart @@ -18,12 +18,12 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../data/constants.dart' - show - AppColors, - AppStyles, - Constants, - GlobalSearchPageType, - GroupOperatingPageType; + show + AppColors, + AppStyles, + Constants, + GlobalSearchPageType, + GroupOperatingPageType; import 'package:cached_network_image/cached_network_image.dart'; import 'create_group_view.dart'; @@ -31,588 +31,551 @@ import 'global_search.dart'; import 'group_item_widget.dart'; class _ConversationItem extends StatelessWidget { - const _ConversationItem( - {Key key, - this.conversation, - this.callback, - this.icon, - this.bgColor, - this.iconSize = 20}) - : assert(conversation != null), - super(key: key); - final icon; - final double iconSize; - final Conversation conversation; - final callback; - final bgColor; + const _ConversationItem( + {Key key, + this.conversation, + this.callback, + this.icon, + this.bgColor, + this.iconSize = 20}) + : assert(conversation != null), + super(key: key); + final icon; + final double iconSize; + final Conversation conversation; + final callback; + final bgColor; - @override - Widget build(BuildContext context) { - Widget avatar; - if (icon != null) { - avatar = Container( - height: 47.5, - width: 47.5, - margin: EdgeInsets.only(left: 6), - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: bgColor, - borderRadius: BorderRadius.all(Radius.circular(50))), - child: Image.asset( - icon, - height: iconSize, - )); - } else if (conversation.isAvatarFromNet()) { - avatar = CachedNetworkImage( - imageUrl: conversation.avatar, - placeholder: CustomUI.buildImgLoding, - width: Constants.ConversationAvatarSize, - height: Constants.ConversationAvatarSize, - ); - } else { - avatar = Image.asset( - conversation.avatar, - width: Constants.ConversationAvatarSize, - height: Constants.ConversationAvatarSize, - ); - } - List _rightArea = [ - Container( - padding: EdgeInsets.only(top: 4), - alignment: Alignment.center, - child: Text(conversation.updateAt, - textScaleFactor: 1.0, - style: TextStyle(fontSize: 11, color: const Color(0xFFC6C6C6))), - ) - ]; - if (conversation.unreadMsgCount > 0) { - var countStr = conversation.unreadMsgCount.toString(); - if (conversation.unreadMsgCount > 99) { - countStr = '99+'; - } - // 未读消息角标 - Widget unreadMsgCountText = Container( - width: Constants.UnReadMsgNotifyDotSize, - height: Constants.UnReadMsgNotifyDotSize, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(Constants.UnReadMsgNotifyDotSize / 2.0), - color: Color(0xFFFF5454), - ), - child: Text(countStr, - textScaleFactor: 1.0, style: AppStyles.UnreadMsgCountDotStyle), - ); - _rightArea.add(Expanded( - child: Align( - alignment: Alignment.bottomCenter, - child: unreadMsgCountText, - ))); - } + @override + Widget build(BuildContext context) { + Widget avatar; + if (icon != null) { + avatar = Container( + height: 47.5, + width: 47.5, + margin: EdgeInsets.only(left: 6), + alignment: Alignment.center, + decoration: BoxDecoration( + gradient: bgColor, + borderRadius: BorderRadius.all(Radius.circular(50))), + child: Image.asset( + icon, + height: iconSize, + )); + } else if (conversation.isAvatarFromNet()) { + avatar = CachedNetworkImage( + imageUrl: conversation.avatar, + placeholder: CustomUI.buildImgLoding, + width: Constants.ConversationAvatarSize, + height: Constants.ConversationAvatarSize, + ); + } else { + avatar = Image.asset( + conversation.avatar, + width: Constants.ConversationAvatarSize, + height: Constants.ConversationAvatarSize, + ); + } + List _rightArea = [ + Container( + padding: EdgeInsets.only(top: 4), + alignment: Alignment.center, + child: Text(conversation.updateAt, + textScaleFactor: 1.0, + style: TextStyle(fontSize: 11, color: const Color(0xFFC6C6C6))), + ) + ]; + if (conversation.unreadMsgCount > 0) { + var countStr = conversation.unreadMsgCount.toString(); + if (conversation.unreadMsgCount > 99) { + countStr = '99+'; + } + // 未读消息角标 + Widget unreadMsgCountText = Container( + width: Constants.UnReadMsgNotifyDotSize, + height: Constants.UnReadMsgNotifyDotSize, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(Constants.UnReadMsgNotifyDotSize / 2.0), + color: Color(0xFFFF5454), + ), + child: Text(countStr, + textScaleFactor: 1.0, style: AppStyles.UnreadMsgCountDotStyle), + ); + _rightArea.add(Expanded( + child: Align( + alignment: Alignment.bottomCenter, + child: unreadMsgCountText, + ))); + } - return InkWell( - child: Container( - padding: const EdgeInsets.all(10.0), - decoration: BoxDecoration( - color: Color(AppColors.ConversationItemBgColor), - ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - avatar, - Container(width: 17.0), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(conversation.title, - textScaleFactor: 1.0, - style: TextStyle( - color: Colors.black, - )), - SizedBox( - height: 5, - ), - Text(conversation.desc, - textScaleFactor: 1.0, - style: TextStyle( - fontSize: 12, color: const Color(0xFF9B9B9B))) - ], - ), - ), - // Container(width: 10.0), - SizedBox( - height: Constants.ConversationAvatarSize, - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisAlignment: MainAxisAlignment.start, - children: _rightArea, - ), - ) - ], - ), - ), - onTap: () { - callback(); - }, - ); - } + return InkWell( + child: Container( + padding: const EdgeInsets.all(10.0), + decoration: BoxDecoration( + color: Color(AppColors.ConversationItemBgColor), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + avatar, + Container(width: 17.0), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(conversation.title, + textScaleFactor: 1.0, + style: TextStyle( + color: Colors.black, + )), + SizedBox( + height: 5, + ), + Text(conversation.desc, + textScaleFactor: 1.0, + style: TextStyle( + fontSize: 12, color: const Color(0xFF9B9B9B))) + ], + ), + ), + // Container(width: 10.0), + SizedBox( + height: Constants.ConversationAvatarSize, + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.start, + children: _rightArea, + ), + ) + ], + ), + ), + onTap: () { + callback(); + }, + ); + } } class ConversActionPage extends StatefulWidget { - ConversActionPage({Key key}) : super(key: key); + ConversActionPage({Key key}) : super(key: key); - _ConversActionPageState createState() => _ConversActionPageState(); + _ConversActionPageState createState() => _ConversActionPageState(); } Map systemInfo = { - 'applyList': null, - 'applyCount': 0, - 'evaluateList': null, - 'evaluateCount': 0, - 'parkList': null, - 'parkCount': 0, - 'castList': null, - 'castCount': 0, - 'walletList': null, - 'walletCount': 0, + 'applyList': null, + 'applyCount': 0, + 'evaluateList': null, + 'evaluateCount': 0, + 'parkList': null, + 'parkCount': 0, + 'castList': null, + 'castCount': 0, + 'walletList': null, + 'walletCount': 0, }; int msgNum = 0; bool isShowMsg() { - return msgNum > 0; + return msgNum > 0; } getAllResNum(prefs) { - getResNum(prefs, Constants.ApplyCount); - getResNum(prefs, Constants.EvaluateCount); - getResNum(prefs, Constants.ParkCount); - getResNum(prefs, Constants.CastCount); - getResNum(prefs, Constants.WalletCount); + getResNum(prefs, Constants.ApplyCount); + getResNum(prefs, Constants.EvaluateCount); + getResNum(prefs, Constants.ParkCount); + getResNum(prefs, Constants.CastCount); + getResNum(prefs, Constants.WalletCount); } getResNum(prefs, url) async { - var count = prefs.getInt(url + UserData().basicInfo.userId.toString()); - systemInfo[url] = count == null ? systemInfo[url] : (systemInfo[url] - count); + var count = prefs.getInt(url + UserData().basicInfo.userId.toString()); + systemInfo[url] = count == null ? systemInfo[url] : (systemInfo[url] - count); - msgNum += systemInfo[url]; + msgNum += systemInfo[url]; } setResNum(url) async { - var localKey = url + UserData().basicInfo.userId.toString(); - if (systemInfo[url] > 0) { - SharedPreferences prefs = await SharedPreferences.getInstance(); - var count = prefs.getInt(localKey); - prefs.setInt( - localKey, count == null ? systemInfo[url] : (systemInfo[url] + count)); - msgNum -= systemInfo[url]; - systemInfo[url] = 0; - } + var localKey = url + UserData().basicInfo.userId.toString(); + if (systemInfo[url] > 0) { + SharedPreferences prefs = await SharedPreferences.getInstance(); + var count = prefs.getInt(localKey); + prefs.setInt( + localKey, count == null ? systemInfo[url] : (systemInfo[url] + count)); + msgNum -= systemInfo[url]; + systemInfo[url] = 0; + } } class _ConversActionPageState extends State - with SingleTickerProviderStateMixin { - TabController tabCtrl; + with SingleTickerProviderStateMixin { + TabController tabCtrl; - void getSystemMsg(data) async { - Map data = { - "userId": UserData().basicInfo.userId, - "type": UserData().basicInfo.sex - }; - data['sign'] = TokenMgr().getSign(data); + void getSystemMsg(data) async { + Map data = { + "userId": UserData().basicInfo.userId, + "type": UserData().basicInfo.sex + }; + data['sign'] = TokenMgr().getSign(data); - Response res = await HttpUtil().post('message/all/message', data: data); - if (res == null) { - return; - } - Map resData = res.data; - if (resData['code'] == 0) { - SharedPreferences prefs = await SharedPreferences.getInstance(); - systemInfo = resData['data']; - msgNum = 0; - getAllResNum(prefs); - if (mounted) { - setState(() {}); - } - } - } + Response res = await HttpUtil().post('message/all/message', data: data); + if (res == null) { + return; + } + Map resData = res.data; + if (resData['code'] == 0) { + SharedPreferences prefs = await SharedPreferences.getInstance(); + systemInfo = resData['data']; + msgNum = 0; + getAllResNum(prefs); + if (mounted) { + setState(() {}); + } + } + } - @override - void initState() { - super.initState(); + @override + void initState() { + super.initState(); - MessageMgr().on('update_system', getSystemMsg); - MessageMgr().on('Quit Group', quitGroup); + MessageMgr().on('update_system', getSystemMsg); + MessageMgr().on('Quit Group', quitGroup); - MessageMgr().on('Update Group List', updateGroupLastMsg); - getSystemMsg(null); + MessageMgr().on('Update Group List', updateGroupLastMsg); + getSystemMsg(null); - tabCtrl = TabController(length: 3, vsync: this); - } + tabCtrl = TabController(length: 3, vsync: this); + } - @override - void dispose() { - tabCtrl.dispose(); - MessageMgr().off('update_system', getSystemMsg); - super.dispose(); - MessageMgr().off('Quit Group', quitGroup); + @override + void dispose() { + tabCtrl.dispose(); + MessageMgr().off('update_system', getSystemMsg); + super.dispose(); + MessageMgr().off('Quit Group', quitGroup); - MessageMgr().off('Update Group List', updateGroupLastMsg); - } + MessageMgr().off('Update Group List', updateGroupLastMsg); + } - @override - Widget build(BuildContext context) { - List groupList = GroupInfoMgr().groupInfoList; + @override + Widget build(BuildContext context) { + List groupList = GroupInfoMgr().groupInfoList; - return Scaffold( - backgroundColor: Colors.white, - appBar: AppBar( - //backgroundColor: Constants.LightGreyBackgroundColor, - centerTitle: false, - title: Text( - I18n.of(context).message_center, - textScaleFactor: 1.0, - style: Constants.MainTitleStyle, - ), - actions: [ - Container( - child: IconButton( - icon: CircleAvatar( - backgroundColor: Constants.GreyBackgroundColor, - radius: 13.75, - child: Padding( - padding: EdgeInsets.only(bottom: 1.5), - child: Icon( - IconData(0xe659, - fontFamily: Constants.IconFontFamily), - color: Constants.BlackTextColor, - size: 21, - ))), - onPressed: () { - CustomUI().goScanPage(context); - }, - ), - ), - // InkWell( - // onTap: () { - // Navigator.of(context).push( - // new MaterialPageRoute( - // builder: (context) { - // return MessagePushPage(); - // }, - // ), - // ); - // }, - // child: Padding( - // padding: EdgeInsets.only(right: 10), - // child: CircleAvatar( - // backgroundColor: Constants.GreyBackgroundColor, - // radius: 13.75, - // child: Icon( - // Icons.settings, - // color: Constants.BlackTextColor, - // size: 22, - // )), - // )), - ], - elevation: 0, - bottom: PreferredSize( - preferredSize: Size.fromHeight(28), - child: Container( - padding: EdgeInsets.only(left: 2), - decoration: BoxDecoration( - //color: Constants.LightGreyBackgroundColor, - border: - Border(bottom: BorderSide(color: Color(0xffeaeaea)))), - alignment: Alignment.centerLeft, - child: TabBar( - isScrollable: true, - indicatorPadding: EdgeInsets.only(left: 9, right: 9), - tabs: [ - UnreadDot( - child: Container( - margin: EdgeInsets.only(right: 4), - child: Text(I18n.of(context).text_chat, - textScaleFactor: 1.0), - ), - type: 1), - UnreadDot( - child: Container( - margin: EdgeInsets.only(right: 4), - child: Text(I18n.of(context).group_chat, - textScaleFactor: 1.0), - ), - type: 4), - UnreadDot( - child: Container( - margin: EdgeInsets.only(right: 4), - child: Text(I18n.of(context).system_information, - textScaleFactor: 1.0)), - type: 2), - ], - controller: tabCtrl, - ), - )), - ), - body: SafeArea( - child: TabBarView( - children: [ - LastChatPage(), - ListView.builder( + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBar( + //backgroundColor: Constants.LightGreyBackgroundColor, + centerTitle: false, + title: Text( + I18n.of(context).message_center, + textScaleFactor: 1.0, + style: Constants.MainTitleStyle, + ), + actions: [ + CustomUI.buildCircleIconButton(0xe659, + onPressed: () => CustomUI().goScanPage(context)) + ], + elevation: 0, + bottom: PreferredSize( + preferredSize: Size.fromHeight(28), + child: Container( + padding: EdgeInsets.only(left: 2), + decoration: BoxDecoration( + //color: Constants.LightGreyBackgroundColor, + border: + Border(bottom: BorderSide(color: Color(0xffeaeaea)))), + alignment: Alignment.centerLeft, + child: TabBar( + isScrollable: true, + indicatorPadding: EdgeInsets.only(left: 9, right: 9), + tabs: [ + UnreadDot( + child: Container( + margin: EdgeInsets.only(right: 4), + child: Text(I18n.of(context).text_chat, + textScaleFactor: 1.0), + ), + type: 1), + UnreadDot( + child: Container( + margin: EdgeInsets.only(right: 4), + child: Text(I18n.of(context).group_chat, + textScaleFactor: 1.0), + ), + type: 4), + UnreadDot( + child: Container( + margin: EdgeInsets.only(right: 4), + child: Text(I18n.of(context).system_information, + textScaleFactor: 1.0)), + type: 2), + ], + controller: tabCtrl, + ), + )), + ), + body: SafeArea( + child: TabBarView( + children: [ + LastChatPage(), + ListView.builder( // controller: _scrollController, - itemBuilder: (BuildContext context, int index) { - if (index == 0) { - return _buildCreateButton(); - } else { - var info = groupList[index - 1]; - return GroupItem(ValueKey(info), groupInfoModel: info); - } - }, - itemCount: groupList.length + 1, - ), - ListView( - children: [ - SizedBox(height: 8.5), - _ConversationItem( - icon: 'assets/images/chat/icon1.png', - bgColor: Constants.RadioGradient, - conversation: Conversation( - avatar: 'assets/images/ic_tx_news.png', - title: I18n.of(context).radio_message, - desc: RichTitle.normalTitle( - systemInfo['castList'], context, InfoType.Radio), - updateAt: systemInfo['castList'] == null - ? "" - : WebData().getLoginTime( - context, systemInfo['castList']['CreateTime']), - unreadMsgCount: systemInfo['castCount'], - ), - callback: () { - setResNum(Constants.CastCount); - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return InfoListPage( - title: I18n.of(context).radio_message, - type: InfoType.Radio, - ); - }, - ), - ); - }, - ), - _ConversationItem( - icon: 'assets/images/chat/icon4.png', - bgColor: Constants.MoneyGradient, - conversation: Conversation( - avatar: 'assets/images/ic_tx_news.png', - title: I18n.of(context).wallet_reminder, - desc: RichTitle.normalTitle( - systemInfo['walletList'], context, InfoType.IncomeMoney), - updateAt: systemInfo['walletList'] == null - ? "" - : WebData().getLoginTime( - context, systemInfo['walletList']['CreateTime']), - unreadMsgCount: systemInfo['walletCount'], - ), - callback: () { - setResNum(Constants.WalletCount); - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return InfoListPage( - title: I18n.of(context).wallet_reminder, - type: InfoType.IncomeMoney, - ); - }, - ), - ); - }, - ), - _ConversationItem( - icon: 'assets/images/chat/icon3.png', - iconSize: 27, - bgColor: Constants.ApplyGradient, - conversation: Conversation( - avatar: 'assets/images/ic_tx_news.png', - title: I18n.of(context).application_notice, - desc: RichTitle.normalTitle( - systemInfo['applyList'], context, InfoType.Apply), - updateAt: systemInfo['applyList'] == null - ? "" - : WebData().getLoginTime( - context, systemInfo['applyList']['CreatTime']), - unreadMsgCount: systemInfo['applyCount'], - ), - callback: () { - setResNum(Constants.ApplyCount); - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return InfoListPage( - title: I18n.of(context).application_notice, - type: InfoType.Apply, - ); - }, - ), - ); - }, - ), - _ConversationItem( - icon: 'assets/images/chat/icon6.png', - bgColor: Constants.EvaGradient, - conversation: Conversation( - avatar: 'assets/images/ic_tx_news.png', - title: I18n.of(context).evaluation_notice, - desc: RichTitle.normalTitle(systemInfo['evaluateList'], - context, InfoType.Evaluation), - updateAt: systemInfo['evaluateList'] == null - ? '' - : WebData().getLoginTime( - context, systemInfo['evaluateList']['CreateTime']), - unreadMsgCount: systemInfo['evaluateCount'], - ), - callback: () { - setResNum(Constants.EvaluateCount); - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return InfoListPage( - title: I18n.of(context).evaluation_notice, - type: 2, - ); - }, - ), - ); - }, - ), - _ConversationItem( - icon: 'assets/images/chat/icon5.png', - bgColor: Constants.ParkGradient, - conversation: Conversation( - avatar: 'assets/images/ic_tx_news.png', - title: I18n.of(context).appName, - desc: RichTitle.normalTitle( - systemInfo['parkList'], context, InfoType.System), - updateAt: systemInfo['parkList'] == null - ? "" - : WebData().getLoginTime( - context, systemInfo['parkList']['CreateTime']), - unreadMsgCount: systemInfo['parkCount'], - ), - callback: () { - setResNum(Constants.ParkCount); - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return InfoListPage( - title: I18n.of(context).appName, - type: InfoType.System, - ); - }, - ), - ); - }, - ) - ], - ) - ], - controller: tabCtrl, - ))); - } + itemBuilder: (BuildContext context, int index) { + if (index == 0) { + return _buildCreateButton(); + } else { + var info = groupList[index - 1]; + return GroupItem(ValueKey(info), groupInfoModel: info); + } + }, + itemCount: groupList.length + 1, + ), + ListView( + children: [ + SizedBox(height: 8.5), + _ConversationItem( + icon: 'assets/images/chat/icon1.png', + bgColor: Constants.RadioGradient, + conversation: Conversation( + avatar: 'assets/images/ic_tx_news.png', + title: I18n.of(context).radio_message, + desc: RichTitle.normalTitle( + systemInfo['castList'], context, InfoType.Radio), + updateAt: systemInfo['castList'] == null + ? "" + : WebData().getLoginTime( + context, systemInfo['castList']['CreateTime']), + unreadMsgCount: systemInfo['castCount'], + ), + callback: () { + setResNum(Constants.CastCount); + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return InfoListPage( + title: I18n.of(context).radio_message, + type: InfoType.Radio, + ); + }, + ), + ); + }, + ), + _ConversationItem( + icon: 'assets/images/chat/icon4.png', + bgColor: Constants.MoneyGradient, + conversation: Conversation( + avatar: 'assets/images/ic_tx_news.png', + title: I18n.of(context).wallet_reminder, + desc: RichTitle.normalTitle(systemInfo['walletList'], + context, InfoType.IncomeMoney), + updateAt: systemInfo['walletList'] == null + ? "" + : WebData().getLoginTime( + context, systemInfo['walletList']['CreateTime']), + unreadMsgCount: systemInfo['walletCount'], + ), + callback: () { + setResNum(Constants.WalletCount); + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return InfoListPage( + title: I18n.of(context).wallet_reminder, + type: InfoType.IncomeMoney, + ); + }, + ), + ); + }, + ), + _ConversationItem( + icon: 'assets/images/chat/icon3.png', + iconSize: 27, + bgColor: Constants.ApplyGradient, + conversation: Conversation( + avatar: 'assets/images/ic_tx_news.png', + title: I18n.of(context).application_notice, + desc: RichTitle.normalTitle( + systemInfo['applyList'], context, InfoType.Apply), + updateAt: systemInfo['applyList'] == null + ? "" + : WebData().getLoginTime( + context, systemInfo['applyList']['CreatTime']), + unreadMsgCount: systemInfo['applyCount'], + ), + callback: () { + setResNum(Constants.ApplyCount); + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return InfoListPage( + title: I18n.of(context).application_notice, + type: InfoType.Apply, + ); + }, + ), + ); + }, + ), + _ConversationItem( + icon: 'assets/images/chat/icon6.png', + bgColor: Constants.EvaGradient, + conversation: Conversation( + avatar: 'assets/images/ic_tx_news.png', + title: I18n.of(context).evaluation_notice, + desc: RichTitle.normalTitle(systemInfo['evaluateList'], + context, InfoType.Evaluation), + updateAt: systemInfo['evaluateList'] == null + ? '' + : WebData().getLoginTime( + context, systemInfo['evaluateList']['CreateTime']), + unreadMsgCount: systemInfo['evaluateCount'], + ), + callback: () { + setResNum(Constants.EvaluateCount); + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return InfoListPage( + title: I18n.of(context).evaluation_notice, + type: 2, + ); + }, + ), + ); + }, + ), + _ConversationItem( + icon: 'assets/images/chat/icon5.png', + bgColor: Constants.ParkGradient, + conversation: Conversation( + avatar: 'assets/images/ic_tx_news.png', + title: I18n.of(context).appName, + desc: RichTitle.normalTitle( + systemInfo['parkList'], context, InfoType.System), + updateAt: systemInfo['parkList'] == null + ? "" + : WebData().getLoginTime( + context, systemInfo['parkList']['CreateTime']), + unreadMsgCount: systemInfo['parkCount'], + ), + callback: () { + setResNum(Constants.ParkCount); + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return InfoListPage( + title: I18n.of(context).appName, + type: InfoType.System, + ); + }, + ), + ); + }, + ) + ], + ) + ], + controller: tabCtrl, + ))); + } - Widget _buildCreateButton() { - List groupList = GroupInfoMgr().groupInfoList; - Widget _avatarIcon = ClipRRect( - borderRadius: BorderRadius.circular(GroupRadius), - child: Container( - color: const Color(0xFFF2F2F2), - height: AvatarSize, - width: AvatarSize, - child: Icon( - IconData(0xe66f, fontFamily: Constants.IconFontFamily), - color: Constants.BlueTextColor, - size: 35, - ), - )); + Widget _buildCreateButton() { + List groupList = GroupInfoMgr().groupInfoList; + Widget _avatarIcon = ClipRRect( + borderRadius: BorderRadius.circular(GroupRadius), + child: Container( + color: const Color(0xFFF2F2F2), + height: AvatarSize, + width: AvatarSize, + child: Icon( + IconData(0xe66f, fontFamily: Constants.IconFontFamily), + color: Constants.BlueTextColor, + size: 35, + ), + )); - Widget _button = InkWell( - onTap: () { - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return CreateGroupPage( - GroupOperatingPageType.CreateGroup, [], null); - }, - ), - ); - }, - child: Container( - padding: EdgeInsets.only(top: 14, bottom: 14), - color: Constants.GreyBackgroundColor, - child: Container( - height: ItemHeight, - decoration: BoxDecoration(color: Colors.white), - child: Row( - children: [ - SizedBox(width: LeftPadding), - _avatarIcon, - SizedBox(width: 14.0), - Text( - I18n.of(context).create_group_chat, - style: TextStyle(fontSize: 15.5), - ), - ], - ), - ))); + Widget _button = InkWell( + onTap: () { + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return CreateGroupPage( + GroupOperatingPageType.CreateGroup, [], null); + }, + ), + ); + }, + child: Container( + padding: EdgeInsets.only(top: 14, bottom: 14), + color: Constants.GreyBackgroundColor, + child: Container( + height: ItemHeight, + decoration: BoxDecoration(color: Colors.white), + child: Row( + children: [ + SizedBox(width: LeftPadding), + _avatarIcon, + SizedBox(width: 14.0), + Text( + I18n.of(context).create_group_chat, + style: TextStyle(fontSize: 15.5), + ), + ], + ), + ))); - Widget tips = Container( - alignment: Alignment.centerLeft, - width: Screen.width, - height: 33.5, - padding: EdgeInsets.only(left: LeftPadding), - decoration: BoxDecoration( - color: Colors.white, - border: Border(bottom: Constants.GreyBorderSide)), - child: Text(I18n.of(context).group_chat + '(${groupList.length})'), - ); + Widget tips = Container( + alignment: Alignment.centerLeft, + width: Screen.width, + height: 33.5, + padding: EdgeInsets.only(left: LeftPadding), + decoration: BoxDecoration( + color: Colors.white, + border: Border(bottom: Constants.GreyBorderSide)), + child: Text(I18n.of(context).group_chat + '(${groupList.length})'), + ); - return Column( - children: [ - SizedBox( - height: 10, - ), - CustomUI.buildSearchButton(context, () { - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return GlobalSearchPage( - type: GlobalSearchPageType.SearchGroup, - ); - }, - ), - ); - }, bottom: 10), - _button, - tips, - ], - ); - } + return Column( + children: [ + SizedBox( + height: 10, + ), + CustomUI.buildSearchButton(context, () { + Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return GlobalSearchPage( + type: GlobalSearchPageType.SearchGroup, + ); + }, + ), + ); + }, bottom: 10), + _button, + tips, + ], + ); + } - quitGroup(args) { - if (mounted) { - setState(() { - print('更新群列表'); - }); - } - } + quitGroup(args) { + if (mounted) { + setState(() { + print('更新群列表'); + }); + } + } - updateGroupLastMsg(args) async { - await GroupInfoMgr().sortGroupList(); - if (mounted) { - setState(() {}); - } - } + updateGroupLastMsg(args) async { + await GroupInfoMgr().sortGroupList(); + if (mounted) { + setState(() {}); + } + } } // import 'package:chat/data/UserData.dart'; @@ -889,45 +852,8 @@ class _ConversActionPageState extends State // style: Constants.MainTitleStyle, // ), // actions: [ -// Container( -// child: IconButton( -// icon: CircleAvatar( -// backgroundColor: Constants.GreyBackgroundColor, -// radius: 13.75, -// child: Padding( -// padding: EdgeInsets.only(bottom: 1.5), -// child: Icon( -// IconData(0xe659, -// fontFamily: Constants.IconFontFamily), -// color: Constants.BlackTextColor, -// size: 21, -// ))), -// onPressed: () { -// CustomUI().goScanPage(context); -// }, -// ), -// ), -// // InkWell( -// // onTap: () { -// // Navigator.of(context).push( -// // new MaterialPageRoute( -// // builder: (context) { -// // return MessagePushPage(); -// // }, -// // ), -// // ); -// // }, -// // child: Padding( -// // padding: EdgeInsets.only(right: 10), -// // child: CircleAvatar( -// // backgroundColor: Constants.GreyBackgroundColor, -// // radius: 13.75, -// // child: Icon( -// // Icons.settings, -// // color: Constants.BlackTextColor, -// // size: 22, -// // )), -// // )), +// CustomUI.buildCircleIconButton(0xe659, +// onPressed: () => CustomUI().goScanPage(context)) // ], // elevation: 0, // bottom: PreferredSize( diff --git a/lib/home/DiscoverPage.dart b/lib/home/DiscoverPage.dart index 2b4a4fc..fef3e3a 100644 --- a/lib/home/DiscoverPage.dart +++ b/lib/home/DiscoverPage.dart @@ -351,7 +351,7 @@ class _DisCoverPageState extends State child: Row( children: [ CircleAvatar( - backgroundColor: Constants.GreyBackgroundColor, + backgroundColor: Colors.grey[100], radius: 13.75, child: Padding( padding: EdgeInsets.only(bottom: 1.5), @@ -376,47 +376,16 @@ class _DisCoverPageState extends State }); }, ))), - Container( - padding: EdgeInsets.only(left: 10), - child: IconButton( - icon: CircleAvatar( - backgroundColor: Constants.GreyBackgroundColor, - radius: 13.75, - child: Padding( - padding: EdgeInsets.only(bottom: 1), - child: Icon( - IconData(0xe619, fontFamily: Constants.IconFontFamily), - color: Constants.BlackTextColor, - size: 22, - ))), - onPressed: () { - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return SearchPage(); - }, + SizedBox(width: 10), + CustomUI.buildCircleIconButton(0xe619, + onPressed: () => Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return SearchPage(); + }, + ), ), - ); - }, - ), - ), - // Container( - // child: IconButton( - // icon: CircleAvatar( - // backgroundColor: Constants.GreyBackgroundColor, - // radius: 13.75, - // child: Padding( - // padding: EdgeInsets.only(bottom: 1.5), - // child: Icon( - // IconData(0xe659, fontFamily: Constants.IconFontFamily), - // color: Constants.BlackTextColor, - // size: 21, - // ))), - // onPressed: () { - // goScanPage(); - // }, - // ), - // ) + padding: EdgeInsets.only(bottom: 1)), ], ), ); diff --git a/lib/home/EditData.dart b/lib/home/EditData.dart index e525a24..4a10d53 100644 --- a/lib/home/EditData.dart +++ b/lib/home/EditData.dart @@ -16,6 +16,7 @@ import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:image_cropper/image_cropper.dart'; import 'package:oktoast/oktoast.dart'; +import 'package:url_launcher/url_launcher.dart'; import '../utils/ShadowButton.dart'; import 'package:image_picker/image_picker.dart'; import 'dart:io'; @@ -312,13 +313,15 @@ class _EditPageState extends State { Widget _buildAgreement() { return InkWell( onTap: () async { - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return UserAgreement(); - }, - ), - ); + // Navigator.of(context).push( + // new MaterialPageRoute( + // builder: (context) { + // return UserAgreement(); + // }, + // ), + // ); + launch( + 'http://datechatagent.chengyouhd.com/zh-CN/Home/UserAgreement?language=${UserData().language}'); }, child: Container( margin: EdgeInsets.only(top: 10, bottom: 20, left: 10, right: 10), diff --git a/lib/home/ProfilePage.dart b/lib/home/ProfilePage.dart index 8d98af8..1f0e6e3 100644 --- a/lib/home/ProfilePage.dart +++ b/lib/home/ProfilePage.dart @@ -1673,23 +1673,11 @@ class _ProfilePageState extends State elevation: 1, actions: [ isMyself - ? Container( - padding: EdgeInsets.only(right: 15), - alignment: Alignment.center, - child: new InkWell( - child: CircleAvatar( - backgroundColor: Constants.GreyBackgroundColor, - radius: 15.75, - child: Icon( - IconData(0xe685, fontFamily: 'iconfont'), - color: Constants.BlackTextColor, - size: 20, - )), - onTap: () { - Share.share('https://henho.jphgames.com/'); - }, - ), - ) + ? Padding( + padding: EdgeInsets.only(right: 0), + child: CustomUI.buildCircleIconButton(0xe685, + onPressed: () => + Share.share('https://henho.jphgames.com/'))) : Container(), isMyself ? Container() diff --git a/lib/home/friend_page.dart b/lib/home/friend_page.dart index 50fc555..ce5fad0 100644 --- a/lib/home/friend_page.dart +++ b/lib/home/friend_page.dart @@ -147,7 +147,10 @@ class _FriendPageState extends State { SizedBox( height: 5, ), - Text(I18n.of(context).apply_fro_friends, + Text( + list[0]['Content'] == null || list[0]['Content'] == '' + ? I18n.of(context).apply_fro_friends + : list[0]['Content'], textScaleFactor: 1.0, style: TextStyle(fontSize: 10, color: const Color(0xFF6A6A6A))), @@ -473,30 +476,14 @@ class _FriendPageState extends State { centerTitle: false, elevation: 1, actions: [ - Container( - child: IconButton( - icon: CircleAvatar( - backgroundColor: Constants.GreyBackgroundColor, - radius: 13.75, - child: Padding( - padding: EdgeInsets.only(bottom: 1.5), - child: Icon( - IconData(0xe662, - fontFamily: Constants.IconFontFamily), - color: Constants.BlackTextColor, - size: 21, - ))), - onPressed: () { - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return NewAddFriendsPage(); - }, - ), - ); - }, - ), - ), + CustomUI.buildCircleIconButton(0xe662, + onPressed: () => Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return NewAddFriendsPage(); + }, + ), + )), ], bottom: CustomUI.buildSearchButton(context, () { Navigator.of(context).push( diff --git a/lib/home/new_friends.dart b/lib/home/new_friends.dart index d0f64e5..43fb180 100644 --- a/lib/home/new_friends.dart +++ b/lib/home/new_friends.dart @@ -447,30 +447,14 @@ class _NewFriendsPageState extends State { leading: CustomUI.buildCustomLeading(context), elevation: 1, actions: [ - Container( - child: IconButton( - icon: CircleAvatar( - backgroundColor: Constants.GreyBackgroundColor, - radius: 13.75, - child: Padding( - padding: EdgeInsets.only(bottom: 1.5), - child: Icon( - IconData(0xe662, - fontFamily: Constants.IconFontFamily), - color: Constants.BlackTextColor, - size: 21, - ))), - onPressed: () { - Navigator.of(context).push( - new MaterialPageRoute( - builder: (context) { - return NewAddFriendsPage(); - }, - ), - ); - }, - ), - ), + CustomUI.buildCircleIconButton(0xe662, + onPressed: () => Navigator.of(context).push( + new MaterialPageRoute( + builder: (context) { + return NewAddFriendsPage(); + }, + ), + )) ], bottom: PreferredSize( preferredSize: Size.fromHeight(49), diff --git a/lib/utils/CustomUI.dart b/lib/utils/CustomUI.dart index d60555e..a63a517 100644 --- a/lib/utils/CustomUI.dart +++ b/lib/utils/CustomUI.dart @@ -380,9 +380,18 @@ class CustomUI { )); } - static Widget buildImgCover(int imgId, List pics, String imgUrl, double width, - double raduis, bool isWatch, BuildContext context, int type, - {bool isMyself = false, int payStatus = 0, int state = 1}) { + static Widget buildImgCover( + int imgId, + List pics, + String imgUrl, + double width, + double raduis, + bool isWatch, + BuildContext context, + int type, + {bool isMyself = false, + int payStatus = 0, + int state = 1}) { Color color = isWatch ? const Color(0xFF999999) : const Color(0xFFFB5656); //const Color(0xfffb5656); @@ -1314,4 +1323,26 @@ class CustomUI { children: [cancelCountDown, confirm], ))); } + + static Widget buildCircleIconButton(int iconCode, + {double radius = 13.75, + onPressed, + double iconSize = 21, + EdgeInsetsGeometry padding}) { + return Container( + child: IconButton( + icon: CircleAvatar( + backgroundColor: Colors.grey[100], + radius: radius, + child: Padding( + padding: padding ?? EdgeInsets.only(bottom: 1.5), + child: Icon( + IconData(iconCode, fontFamily: Constants.IconFontFamily), + color: Constants.BlackTextColor, + size: iconSize, + ))), + onPressed: onPressed, + ), + ); + } } diff --git a/lib/utils/HttpUtil.dart b/lib/utils/HttpUtil.dart index 257431c..07f1c35 100644 --- a/lib/utils/HttpUtil.dart +++ b/lib/utils/HttpUtil.dart @@ -44,9 +44,9 @@ class HttpUtil { //static const String BaseUrl = 'http://192.168.0.223:7001/'; //static const String BaseUrl = 'http://192.168.0.207:9080/'; - //static const String BaseUrl = 'http://120.79.107.63:9080/'; + static const String BaseUrl = 'http://120.79.107.63:9080/'; //static const String BaseUrl = 'http://192.168.0.177:9016/'; - static const String BaseUrl = 'https://datasm.chengyouhd.com/'; + //static const String BaseUrl = 'https://datasm.chengyouhd.com/'; static HttpUtil _getInstance() { if (_instance == null) { @@ -928,7 +928,7 @@ class HttpUtil { if (resData['code'] == 0) { UserData().privatyMsgPushSwitch = resData['data']['PrivacyChat'] == 1; UserData().newDateSwitch = resData['data']['NewBroadcast'] == 1; - + UserData().shockNoticSwitch = resData['data']['VibrationReminder'] ==1; if (isMan) { UserData().acceptCheckSwitch = resData['data']['AcceptCheck'] == 1; UserData().codeSucessSwitch = resData['data']['ApplySuccess'] == 1; diff --git a/pubspec.yaml b/pubspec.yaml index 5f19193..85524c3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: chat description: A new Flutter project. #修改版本号后get-clean -version: 1.1.3+17 +version: 1.1.4+18 environment: sdk: ">=2.1.0 <3.0.0"