diff --git a/android/app/build.gradle b/android/app/build.gradle index 77fbfd9..b7fee24 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/img_splash_4.png b/assets/img_splash_4.png new file mode 100644 index 0000000..0258739 Binary files /dev/null and b/assets/img_splash_4.png differ diff --git a/assets/img_splash_5.png b/assets/img_splash_5.png new file mode 100644 index 0000000..d69020a Binary files /dev/null and b/assets/img_splash_5.png differ diff --git a/i18n/en-US.json b/i18n/en-US.json index 5a81253..a03a007 100644 --- a/i18n/en-US.json +++ b/i18n/en-US.json @@ -1152,7 +1152,7 @@ "you_get": " you got rewards from others", "enter_num_qian": " number of exchanges (unit K) ", "enter_num_qian1": " number of withdrawals (unit K) ", - "daily_translate_voucher": "Translation voucher", + "daily_translate_voucher": " Voucher", "msg_notice": "Notice message", "select_notice_people": "Select notice people", "search_phone": "Search phone number", @@ -1164,7 +1164,7 @@ "search_plach": "Search location", "finding_place": "Find location", "real_time_helper": "Real-time helper", - "translation_butler": "Translation assistant", + "translation_butler": "Real-time translation service", "travel_butler": "Travel assistant", "translation_butler_tips": "Your real-time personal translator, it can help you solve the language barrier anytime and anywhere", "choose_language": "Please select the language to be translated", @@ -1249,5 +1249,7 @@ "splash_tips_content4": "Unobstructed travel chat", "splash_tips_content5": "Worry-free your trip", "shock_notice": "Vibration notification", - "max_upload_size": "最多上传/s1张" + "max_upload_size": "最多上传/s1张", + "travel_tips2":"Your personal butler, to solve the problem of taxis going to the wrong destination caused by the language" + } \ No newline at end of file diff --git a/i18n/ja-JP.json b/i18n/ja-JP.json index 375e62a..9500a35 100644 --- a/i18n/ja-JP.json +++ b/i18n/ja-JP.json @@ -1164,7 +1164,7 @@ "search_plach": "位置検索", "finding_place": "位置を検索", "real_time_helper": "リアルタイムヘルプ", - "translation_butler": "翻訳バトラー", + "translation_butler": "リアルタイム翻訳サービス", "travel_butler": "トラベルバトラー", "translation_butler_tips": "あなたのリアルタイムの個人通訳は、いつでもどこでも言語の不通を解決してくれます", "choose_language": "翻訳する言語を選んでください", @@ -1248,5 +1248,7 @@ "splash_tips_content4": "出行聊天畅通无阻", "splash_tips_content5": "无忧你的旅行" , "shock_notice": "震动通知", - "max_upload_size": "最多上传/s1张" + "max_upload_size": "最多上传/s1张", + "travel_tips2":"您的贴身出行管家,解决语言不通打车走错路的问题" + } \ No newline at end of file diff --git a/i18n/ko-KR.json b/i18n/ko-KR.json index d52a57f..a60a6b5 100644 --- a/i18n/ko-KR.json +++ b/i18n/ko-KR.json @@ -1164,7 +1164,7 @@ "search_plach": "위치 검색", "finding_place": "위치 찾기", "real_time_helper": "실시 도움", - "translation_butler": "번역 집사", + "translation_butler": "실시간 번역 서비스", "travel_butler": "출행 집사", "translation_butler_tips": " 당신의 실시간 밀착 통역으로 언제 어디서나 말이 통하지 않는 것을 해결해 드립니다.", "choose_language": "번역할 언어를 선택하세요.", @@ -1249,5 +1249,7 @@ "splash_tips_content4": "出行聊天畅通无阻", "splash_tips_content5": "无忧你的旅行" , "shock_notice": "震动通知", - "max_upload_size": "最多上传/s1张" + "max_upload_size": "最多上传/s1张", + "travel_tips2":"您的贴身出行管家,解决语言不通打车走错路的问题" + } \ No newline at end of file diff --git a/i18n/vi-VN.json b/i18n/vi-VN.json index 84df8d9..0c72a5e 100644 --- a/i18n/vi-VN.json +++ b/i18n/vi-VN.json @@ -1164,7 +1164,7 @@ "search_plach": "Rà soát địa điểm", "finding_place": " Tìm địa điểm", "real_time_helper": "Hỗ trợ nhanh", - "translation_butler": "Trợ lý phiên dịch", + "translation_butler": "Dịch vụ dịch thuật thời gian thực", "travel_butler": " Trợ lý chỉ đường", "translation_butler_tips": "Trợ lý dịch thuật giúp bạn giải quyết trở ngại ngôn ngữ", "choose_language": " Vui lòng chọn một ngôn ngữ để dịch ", @@ -1248,5 +1248,7 @@ "splash_tips_content4": "出行聊天畅通无阻", "splash_tips_content5": "无忧你的旅行" , "shock_notice": "震动通知", - "max_upload_size": "最多上传/s1张" + "max_upload_size": "最多上传/s1张", + "travel_tips2":"您的贴身出行管家,解决语言不通打车走错路的问题" + } \ No newline at end of file diff --git a/i18n/zh-CN.json b/i18n/zh-CN.json index ba7baeb..0e85281 100644 --- a/i18n/zh-CN.json +++ b/i18n/zh-CN.json @@ -1164,7 +1164,7 @@ "search_plach": "搜索位置", "finding_place": "查找位置", "real_time_helper": "实时帮", - "translation_butler": "翻译管家", + "translation_butler": "实时翻译服务", "travel_butler": "出行管家", "translation_butler_tips": "您的实时贴身翻译,随时随地帮您解决语言不通", "choose_language": "请选择要翻译的语言", @@ -1249,5 +1249,6 @@ "splash_tips_content4": "出行聊天畅通无阻", "splash_tips_content5": "无忧你的旅行", "shock_notice":"震动通知", - "max_upload_size": "最多上传/s1张" + "max_upload_size": "最多上传/s1张", + "travel_tips2":"您的贴身出行管家,解决语言不通打车走错路的问题" } \ No newline at end of file diff --git a/i18n/zh-HK.json b/i18n/zh-HK.json index 7ff6634..1688ac8 100644 --- a/i18n/zh-HK.json +++ b/i18n/zh-HK.json @@ -1164,7 +1164,7 @@ "search_plach": "搜索位置", "finding_place": "查找位置", "real_time_helper": "實時幫", - "translation_butler": "翻譯管家", + "translation_butler": "實時翻譯服務", "travel_butler": "出行管家", "translation_butler_tips": "您的實時貼身翻譯,隨時隨地幫您解決語言不通", "choose_language": "請選擇您的語言和要翻譯的語言", @@ -1248,5 +1248,7 @@ "splash_tips_content4": "出行聊天畅通无阻", "splash_tips_content5": "无忧你的旅行", "shock_notice": "震動通知", - "max_upload_size": "最多上传/s1张" + "max_upload_size": "最多上传/s1张", + "travel_tips2":"您的贴身出行管家,解决语言不通打车走错路的问题" + } \ No newline at end of file diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh index 7f00e2d..8c3b364 100755 --- a/ios/Flutter/flutter_export_environment.sh +++ b/ios/Flutter/flutter_export_environment.sh @@ -2,10 +2,9 @@ # This is a generated file; do not edit or check into version control. export "FLUTTER_ROOT=/Users/random/sdk/flutter_sdk" export "FLUTTER_APPLICATION_PATH=/Users/random/code/flutter/project/hibok" -export "FLUTTER_TARGET=/Users/random/code/flutter/project/hibok/lib/main.dart" +export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "SYMROOT=${SOURCE_ROOT}/../build/ios" -export "FLUTTER_FRAMEWORK_DIR=/Users/random/sdk/flutter_sdk/bin/cache/artifacts/engine/ios" -export "FLUTTER_BUILD_NAME=1.0.9" -export "FLUTTER_BUILD_NUMBER=14" -export "TRACK_WIDGET_CREATION=true" +export "FLUTTER_FRAMEWORK_DIR=/Users/random/sdk/flutter_sdk/bin/cache/artifacts/engine/ios-release" +export "FLUTTER_BUILD_NAME=1.1.0" +export "FLUTTER_BUILD_NUMBER=15" diff --git a/ios/Podfile.lock b/ios/Podfile.lock index ca53417..1b8f70f 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -151,6 +151,8 @@ PODS: - TOCropViewController (2.5.2) - url_launcher (0.0.1): - Flutter + - vibration (1.2.4): + - Flutter - video_player (0.0.1): - Flutter - video_thumbnail (0.0.1): @@ -209,6 +211,7 @@ DEPENDENCIES: - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`) - url_launcher (from `.symlinks/plugins/url_launcher/ios`) + - vibration (from `.symlinks/plugins/vibration/ios`) - video_player (from `.symlinks/plugins/video_player/ios`) - video_thumbnail (from `.symlinks/plugins/video_thumbnail/ios`) - wifi_info_plugin (from `.symlinks/plugins/wifi_info_plugin/ios`) @@ -332,6 +335,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/sqflite/ios" url_launcher: :path: ".symlinks/plugins/url_launcher/ios" + vibration: + :path: ".symlinks/plugins/vibration/ios" video_player: :path: ".symlinks/plugins/video_player/ios" video_thumbnail: @@ -406,6 +411,7 @@ SPEC CHECKSUMS: sqflite: 4001a31ff81d210346b500c55b17f4d6c7589dd0 TOCropViewController: e9da34f484aedd4e5d5a8ab230ba217cfe16c729 url_launcher: a1c0cc845906122c4784c542523d8cacbded5626 + vibration: f0c5bb486671fb81e973bfb451d89f8efd07c9c9 video_player: 69c5f029fac4ffe4fc8a85ea7f7b793709661549 video_thumbnail: c4e2a3c539e247d4de13cd545344fd2d26ffafd1 wifi_info_plugin: ff6048382842ec5c7594460750ae96ad54bd3044 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 5ded8b7..fa27d9b 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -542,7 +542,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 13; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_TEAM = QJ9M3998Q6; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -556,7 +556,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.0.9; + MARKETING_VERSION = 1.1.0; PRODUCT_BUNDLE_IDENTIFIER = com.chengyouhudong.hibok; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -578,14 +578,14 @@ CODE_SIGN_ENTITLEMENTS = "Share Extension/Share Extension.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 13; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_TEAM = QJ9M3998Q6; ENABLE_BITCODE = YES; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Share Extension/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.0.9; + MARKETING_VERSION = 1.1.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; OTHER_LDFLAGS = ""; @@ -610,14 +610,14 @@ CODE_SIGN_ENTITLEMENTS = "Share Extension/Share Extension.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 13; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_TEAM = QJ9M3998Q6; ENABLE_BITCODE = YES; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Share Extension/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.0.9; + MARKETING_VERSION = 1.1.0; MTL_FAST_MATH = YES; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = com.chengyouhudong.hibok.share; @@ -640,14 +640,14 @@ CODE_SIGN_ENTITLEMENTS = "Share Extension/Share ExtensionProfile.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 13; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_TEAM = QJ9M3998Q6; ENABLE_BITCODE = YES; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Share Extension/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.0.9; + MARKETING_VERSION = 1.1.0; MTL_FAST_MATH = YES; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = com.chengyouhudong.hibok.share; @@ -777,7 +777,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 13; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -791,7 +791,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.0.9; + MARKETING_VERSION = 1.1.0; PRODUCT_BUNDLE_IDENTIFIER = com.chengyouhudong.hibok; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -811,7 +811,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 13; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_TEAM = QJ9M3998Q6; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -825,7 +825,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.0.9; + MARKETING_VERSION = 1.1.0; PRODUCT_BUNDLE_IDENTIFIER = com.chengyouhudong.hibok; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/lib/data/chat_data_mgr.dart b/lib/data/chat_data_mgr.dart index cc79f55..297db74 100644 --- a/lib/data/chat_data_mgr.dart +++ b/lib/data/chat_data_mgr.dart @@ -314,11 +314,11 @@ class ChatDataMgr { print('数据为空,无法插入'); } else { record.insert(0, msg); - int after = DateTime.now().millisecondsSinceEpoch-MsgHandler.time; - print('******插入数据 use $after'); - print('******record length ${record.length} ${msg.sessionId}'); + // print(MsgHandler.time); + //int after = DateTime.now().millisecondsSinceEpoch-MsgHandler.time; + // print('******插入数据 use $after'); + // print('******record length ${record.length} ${msg.sessionId}'); - //record.add(msg); SqlUtil.insert(msg); updateLastRecordWithMsg(msg); diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index 0f976f4..a0a3a65 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -2339,8 +2339,8 @@ class I18n implements WidgetsLocalizations { String get enter_num_qian => " number of exchanges (unit K) "; /// " number of withdrawals (unit K) " String get enter_num_qian1 => " number of withdrawals (unit K) "; - /// "Translation voucher" - String get daily_translate_voucher => "Translation voucher"; + /// " Voucher" + String get daily_translate_voucher => " Voucher"; /// "Notice message" String get msg_notice => "Notice message"; /// "Select notice people" @@ -2363,8 +2363,8 @@ class I18n implements WidgetsLocalizations { String get finding_place => "Find location"; /// "Real-time helper" String get real_time_helper => "Real-time helper"; - /// "Translation assistant" - String get translation_butler => "Translation assistant"; + /// "Real-time translation service" + String get translation_butler => "Real-time translation service"; /// "Travel assistant" String get travel_butler => "Travel assistant"; /// "Your real-time personal translator, it can help you solve the language barrier anytime and anywhere" @@ -2535,6 +2535,8 @@ class I18n implements WidgetsLocalizations { String get shock_notice => "Vibration notification"; /// "最多上传/s1张" String get max_upload_size => "最多上传/s1张"; + /// "Your personal butler, to solve the problem of taxis going to the wrong destination caused by the language" + String get travel_tips2 => "Your personal butler, to solve the problem of taxis going to the wrong destination caused by the language"; } class _I18n_en_US extends I18n { @@ -4719,9 +4721,9 @@ class _I18n_vi_VN extends I18n { /// "Xin cung cấp ảnh chụp màn hình liên quan để chúng tôi theo dõi xác thực" @override String get provide_screenshots => "Xin cung cấp ảnh chụp màn hình liên quan để chúng tôi theo dõi xác thực"; - /// "Vui lòng mô tả chi tiết (trong vòng 100 từ)" + /// "Vui lòng mô tả chi tiết(trong vòng 100 ký tự)" @override - String get describe_details => "Vui lòng mô tả chi tiết (trong vòng 100 từ)"; + String get describe_details => "Vui lòng mô tả chi tiết(trong vòng 100 ký tự)"; /// "Vui lòng chọn lý do báo cáo" @override String get report_reason => "Vui lòng chọn lý do báo cáo"; @@ -6042,9 +6044,9 @@ class _I18n_vi_VN extends I18n { /// "Hỗ trợ nhanh" @override String get real_time_helper => "Hỗ trợ nhanh"; - /// "Trợ lý phiên dịch" + /// "Dịch vụ dịch thuật thời gian thực" @override - String get translation_butler => "Trợ lý phiên dịch"; + String get translation_butler => "Dịch vụ dịch thuật thời gian thực"; /// " Trợ lý chỉ đường" @override String get travel_butler => " Trợ lý chỉ đường"; @@ -6297,6 +6299,9 @@ class _I18n_vi_VN extends I18n { /// "最多上传/s1张" @override String get max_upload_size => "最多上传/s1张"; + /// "您的贴身出行管家,解决语言不通打车走错路的问题" + @override + String get travel_tips2 => "您的贴身出行管家,解决语言不通打车走错路的问题"; @override TextDirection get textDirection => TextDirection.ltr; @@ -9800,9 +9805,9 @@ class _I18n_zh_HK extends I18n { /// "實時幫" @override String get real_time_helper => "實時幫"; - /// "翻譯管家" + /// "實時翻譯服務" @override - String get translation_butler => "翻譯管家"; + String get translation_butler => "實時翻譯服務"; /// "出行管家" @override String get travel_butler => "出行管家"; @@ -10055,6 +10060,9 @@ class _I18n_zh_HK extends I18n { /// "最多上传/s1张" @override String get max_upload_size => "最多上传/s1张"; + /// "您的贴身出行管家,解决语言不通打车走错路的问题" + @override + String get travel_tips2 => "您的贴身出行管家,解决语言不通打车走错路的问题"; @override TextDirection get textDirection => TextDirection.ltr; @@ -13558,9 +13566,9 @@ class _I18n_zh_CN extends _I18n_zh_HK { /// "实时帮" @override String get real_time_helper => "实时帮"; - /// "翻译管家" + /// "实时翻译服务" @override - String get translation_butler => "翻译管家"; + String get translation_butler => "实时翻译服务"; /// "出行管家" @override String get travel_butler => "出行管家"; @@ -13816,6 +13824,9 @@ class _I18n_zh_CN extends _I18n_zh_HK { /// "最多上传/s1张" @override String get max_upload_size => "最多上传/s1张"; + /// "您的贴身出行管家,解决语言不通打车走错路的问题" + @override + String get travel_tips2 => "您的贴身出行管家,解决语言不通打车走错路的问题"; @override TextDirection get textDirection => TextDirection.ltr; @@ -17319,9 +17330,9 @@ class _I18n_ko_KR extends I18n { /// "실시 도움" @override String get real_time_helper => "실시 도움"; - /// "번역 집사" + /// "실시간 번역 서비스" @override - String get translation_butler => "번역 집사"; + String get translation_butler => "실시간 번역 서비스"; /// "출행 집사" @override String get travel_butler => "출행 집사"; @@ -17577,6 +17588,9 @@ class _I18n_ko_KR extends I18n { /// "最多上传/s1张" @override String get max_upload_size => "最多上传/s1张"; + /// "您的贴身出行管家,解决语言不通打车走错路的问题" + @override + String get travel_tips2 => "您的贴身出行管家,解决语言不通打车走错路的问题"; @override TextDirection get textDirection => TextDirection.ltr; @@ -21080,9 +21094,9 @@ class _I18n_ja_JP extends I18n { /// "リアルタイムヘルプ" @override String get real_time_helper => "リアルタイムヘルプ"; - /// "翻訳バトラー" + /// "リアルタイム翻訳サービス" @override - String get translation_butler => "翻訳バトラー"; + String get translation_butler => "リアルタイム翻訳サービス"; /// "トラベルバトラー" @override String get travel_butler => "トラベルバトラー"; @@ -21335,6 +21349,9 @@ class _I18n_ja_JP extends I18n { /// "最多上传/s1张" @override String get max_upload_size => "最多上传/s1张"; + /// "您的贴身出行管家,解决语言不通打车走错路的问题" + @override + String get travel_tips2 => "您的贴身出行管家,解决语言不通打车走错路的问题"; @override TextDirection get textDirection => TextDirection.ltr; diff --git a/lib/home/ConversActionPage.dart b/lib/home/ConversActionPage.dart index 7f1cf53..3d646f3 100644 --- a/lib/home/ConversActionPage.dart +++ b/lib/home/ConversActionPage.dart @@ -1,620 +1,3 @@ -import 'package:chat/data/UserData.dart'; -import 'package:chat/data/WebData.dart'; -import 'package:chat/data/conversation.dart'; -import 'package:chat/data/group_data_mgr.dart'; -import 'package:chat/generated/i18n.dart'; -import 'package:chat/home/InfoList.dart'; -import 'package:chat/home/last_chat_record_widget.dart'; -import 'package:chat/home/rich_title.dart'; -import 'package:chat/home/unread_dot_widget.dart'; -import 'package:chat/models/group_info_model.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/screen.dart'; -import 'package:dio/dio.dart'; -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; -import 'package:cached_network_image/cached_network_image.dart'; - -import 'create_group_view.dart'; -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; - - @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(); - }, - ); - } -} - -class ConversActionPage extends StatefulWidget { - ConversActionPage({Key key}) : super(key: key); - - _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, -}; - -int msgNum = 0; -bool isShowMsg() { - 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, url) async { - var count = prefs.getInt(url + UserData().basicInfo.userId.toString()); - systemInfo[url] = count == null ? systemInfo[url] : (systemInfo[url] - count); - - 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; - } -} - -class _ConversActionPageState extends State - with SingleTickerProviderStateMixin { - TabController tabCtrl; - - 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(() {}); - } - } - } - - @override - void initState() { - super.initState(); - - MessageMgr().on('update_system', getSystemMsg); - MessageMgr().on('Quit Group', quitGroup); - - MessageMgr().on('Update Group List', updateGroupLastMsg); - getSystemMsg(null); - - tabCtrl = TabController(length: 3, vsync: this); - } - - @override - void dispose() { - tabCtrl.dispose(); - MessageMgr().off('update_system', getSystemMsg); - super.dispose(); - MessageMgr().off('Quit Group', quitGroup); - - MessageMgr().off('Update Group List', updateGroupLastMsg); - } - - @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( -// 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, - ))); - } - - 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 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, - ], - ); - } - - quitGroup(args) { - if (mounted) { - setState(() { - print('更新群列表'); - }); - } - } - - updateGroupLastMsg(args) async { - await GroupInfoMgr().sortGroupList(); - if (mounted) { - setState(() {}); - } - } -} - //import 'package:chat/data/UserData.dart'; //import 'package:chat/data/WebData.dart'; //import 'package:chat/data/conversation.dart'; @@ -757,478 +140,1095 @@ class _ConversActionPageState extends State // ], // ), // ), -// // Container(width: 10.0), -// SizedBox( -// height: Constants.ConversationAvatarSize, -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.end, -// mainAxisAlignment: MainAxisAlignment.start, -// children: _rightArea, -// ), -// ) +// // 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); +// +// _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, +//}; +// +//int msgNum = 0; +//bool isShowMsg() { +// 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, url) async { +// var count = prefs.getInt(url + UserData().basicInfo.userId.toString()); +// systemInfo[url] = count == null ? systemInfo[url] : (systemInfo[url] - count); +// +// 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; +// } +//} +// +//class _ConversActionPageState extends State +// with SingleTickerProviderStateMixin { +// TabController tabCtrl; +// +// 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(() {}); +// } +// } +// } +// +// @override +// void initState() { +// super.initState(); +// +// MessageMgr().on('update_system', getSystemMsg); +// MessageMgr().on('Quit Group', quitGroup); +// +// MessageMgr().on('Update Group List', updateGroupLastMsg); +// getSystemMsg(null); +// +// tabCtrl = TabController(length: 3, vsync: this); +// } +// +// @override +// void dispose() { +// tabCtrl.dispose(); +// MessageMgr().off('update_system', getSystemMsg); +// super.dispose(); +// MessageMgr().off('Quit Group', quitGroup); +// +// MessageMgr().off('Update Group List', updateGroupLastMsg); +// } +// +// @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, +// ), +// )), // ), -// ), -// onTap: () { -// callback(); -// }, -// ); -// } -//} -// -//class ConversActionPage extends StatefulWidget { -// ConversActionPage({Key key}) : super(key: key); -// -// _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, -//}; -// -//int msgNum = 0; -//bool isShowMsg() { -// return msgNum > 0; -//} +// 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, +// ))); +// } // -//getAllResNum(prefs) { -// getResNum(prefs, Constants.ApplyCount); -// getResNum(prefs, Constants.EvaluateCount); -// getResNum(prefs, Constants.ParkCount); -// getResNum(prefs, Constants.CastCount); -// getResNum(prefs, Constants.WalletCount); -//} +// 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, +// ), +// )); // -//getResNum(prefs, url) async { -// var count = prefs.getInt(url + UserData().basicInfo.userId.toString()); -// systemInfo[url] = count == null ? systemInfo[url] : (systemInfo[url] - count); +// 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), +// ), +// ], +// ), +// ))); // -// msgNum += systemInfo[url]; -//} +// 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})'), +// ); // -//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; +// 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, +// ], +// ); // } -//} -// -//class _ConversActionPageState extends State -// with SingleTickerProviderStateMixin { -// TabController tabCtrl; -// -// 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(() {}); -// } +// quitGroup(args) { +// if (mounted) { +// setState(() { +// print('更新群列表'); +// }); // } // } // -// @override -// void initState() { -// super.initState(); -// -// MessageMgr().on('update_system', getSystemMsg); -//// MessageMgr().on('Quit Group', quitGroup); -//// -//// MessageMgr().on('Update Group List', updateGroupLastMsg); -// getSystemMsg(null); -// -// tabCtrl = TabController(length: 2, vsync: this); -// } -// -// @override -// void dispose() { -// tabCtrl.dispose(); -// MessageMgr().off('update_system', getSystemMsg); -// super.dispose(); +// updateGroupLastMsg(args) async { +// await GroupInfoMgr().sortGroupList(); +// if (mounted) { +// setState(() {}); +// } // } +//} + +import 'package:chat/data/UserData.dart'; +import 'package:chat/data/WebData.dart'; +import 'package:chat/data/conversation.dart'; +import 'package:chat/data/group_data_mgr.dart'; +import 'package:chat/generated/i18n.dart'; +import 'package:chat/home/InfoList.dart'; +import 'package:chat/home/last_chat_record_widget.dart'; +import 'package:chat/home/rich_title.dart'; +import 'package:chat/home/unread_dot_widget.dart'; +import 'package:chat/models/group_info_model.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/screen.dart'; +import 'package:dio/dio.dart'; +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; +import 'package:cached_network_image/cached_network_image.dart'; + +import 'create_group_view.dart'; +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; + + @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(); + }, + ); + } +} + +class ConversActionPage extends StatefulWidget { + ConversActionPage({Key key}) : super(key: key); + + _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, +}; + +int msgNum = 0; +bool isShowMsg() { + 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, url) async { + var count = prefs.getInt(url + UserData().basicInfo.userId.toString()); + systemInfo[url] = count == null ? systemInfo[url] : (systemInfo[url] - count); + + 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; + } +} + +class _ConversActionPageState extends State + with SingleTickerProviderStateMixin { + TabController tabCtrl; + + 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(() {}); + } + } + } + + @override + void initState() { + super.initState(); + + MessageMgr().on('update_system', getSystemMsg); +// MessageMgr().on('Quit Group', quitGroup); // -// @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: [ +// MessageMgr().on('Update Group List', updateGroupLastMsg); + getSystemMsg(null); + + tabCtrl = TabController(length: 2, vsync: this); + } + + @override + void dispose() { + tabCtrl.dispose(); + MessageMgr().off('update_system', getSystemMsg); + super.dispose(); + } + + @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).text_chat, +// child: Text(I18n.of(context).group_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, -// ); -// }, -// ), -// ); +// 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, // ), -// _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, -// ))); + 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 _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, + textScaleFactor: 1.0, + 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})', + textScaleFactor: 1.0, + ), + ); + + 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('更新群列表'); +// }); +// } // } // -// 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, -// textScaleFactor: 1.0, -// 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})', -// textScaleFactor: 1.0, -// ), -// ); -// -// 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, -// ], -// ); +// updateGroupLastMsg(args) async { +// await GroupInfoMgr().sortGroupList(); +// if (mounted) { +// setState(() {}); +// } // } -// -//// quitGroup(args) { -//// if (mounted) { -//// setState(() { -//// print('更新群列表'); -//// }); -//// } -//// } -//// -//// updateGroupLastMsg(args) async { -//// await GroupInfoMgr().sortGroupList(); -//// if (mounted) { -//// setState(() {}); -//// } -//// } -//} +} diff --git a/lib/home/homeMain.dart b/lib/home/homeMain.dart index a5dce48..75e1633 100644 --- a/lib/home/homeMain.dart +++ b/lib/home/homeMain.dart @@ -34,6 +34,7 @@ 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; @@ -361,79 +362,22 @@ class _HomeMainState extends State { I18n.of(context).me ]; - _navigationViews = [ - NavigationIconView( - title: _titles[2], - icon: IconData( - 0xe67c, - fontFamily: 'iconfont', - ), - isShowdot: true, - iconSize: 29), - NavigationIconView( - title: _titles[0], - isShowdot: true, - iconMargin: EdgeInsets.only(top: 2), - type: 5, - icon: IconData( - 0xe66e, - fontFamily: 'iconfont', - ), - iconSize: 26.5), - NavigationIconView( - title: _titles[1], - icon: IconData( - 0xe656, - fontFamily: 'iconfont', - ), - isCenter: true, - iconSize: 31), - NavigationIconView( - title: _titles[1], - isShowdot: true, - icon: IconData( - 0xe60b, - fontFamily: 'iconfont', - ), - type: 6, - iconSize: 26.5), - NavigationIconView( - title: _titles[3], - icon: IconData( - 0xe67b, - fontFamily: 'iconfont', - ), - iconSize: 26.5), - ]; - - _pages = [ - RealTimeHelperPage(), - FriendPage(), - FindPage(), - ConversActionPage(), -// GroupChatListPage(), - ProfilePage( - userId: UserData().basicInfo.userId, - ), - ]; - // _navigationViews = [ // NavigationIconView( -// title: _titles[1], -// isShowdot: true, +// title: _titles[2], // icon: IconData( -// 0xe60b, +// 0xe67c, // fontFamily: 'iconfont', // ), -// type: 1, -// iconSize: 26.5), +// isShowdot: true, +// iconSize: 29), // NavigationIconView( // title: _titles[0], // isShowdot: true, // iconMargin: EdgeInsets.only(top: 2), // type: 5, // icon: IconData( -// 0xe663, +// 0xe66e, // fontFamily: 'iconfont', // ), // iconSize: 26.5), @@ -445,17 +389,15 @@ class _HomeMainState extends State { // ), // isCenter: true, // iconSize: 31), -// // NavigationIconView( -// title: _titles[3], +// title: _titles[1], // isShowdot: true, // icon: IconData( -// 0xe66e, +// 0xe60b, // fontFamily: 'iconfont', // ), -// type: 4, +// type: 6, // iconSize: 26.5), -// // NavigationIconView( // title: _titles[3], // icon: IconData( @@ -466,16 +408,75 @@ class _HomeMainState extends State { // ]; // // _pages = [ -// ConversActionPage(), -//// RealTimeHelperPage(), +// RealTimeHelperPage(), // FriendPage(), // FindPage(), -//// ConversActionPage(), -// GroupChatListPage(), +// ConversActionPage(), +//// GroupChatListPage(), // ProfilePage( // userId: UserData().basicInfo.userId, // ), // ]; + + _navigationViews = [ + NavigationIconView( + title: _titles[1], + isShowdot: true, + icon: IconData( + 0xe60b, + fontFamily: 'iconfont', + ), + type: 1, + iconSize: 26.5), + NavigationIconView( + title: _titles[0], + isShowdot: true, + iconMargin: EdgeInsets.only(top: 2), + type: 5, + icon: IconData( + 0xe663, + fontFamily: 'iconfont', + ), + iconSize: 26.5), + NavigationIconView( + title: _titles[1], + icon: IconData( + 0xe656, + fontFamily: 'iconfont', + ), + isCenter: true, + iconSize: 31), + + NavigationIconView( + title: _titles[3], + isShowdot: true, + icon: IconData( + 0xe66e, + fontFamily: 'iconfont', + ), + type: 4, + iconSize: 26.5), + + NavigationIconView( + title: _titles[3], + icon: IconData( + 0xe67b, + fontFamily: 'iconfont', + ), + iconSize: 26.5), + ]; + + _pages = [ + ConversActionPage(), +// RealTimeHelperPage(), + FriendPage(), + FindPage(), +// ConversActionPage(), + GroupChatListPage(), + ProfilePage( + userId: UserData().basicInfo.userId, + ), + ]; } @override diff --git a/lib/home/realtimehelper/real_time_helper_page.dart b/lib/home/realtimehelper/real_time_helper_page.dart index 792f17c..a4cbd24 100644 --- a/lib/home/realtimehelper/real_time_helper_page.dart +++ b/lib/home/realtimehelper/real_time_helper_page.dart @@ -168,7 +168,7 @@ class RealTimeHelperPageState extends State { builder: (_) => TranslationButlerPage(), ), ); - },textColor: Color(0xff2685FA),tips: I18n.of(context).translation_butler_introduction), + },textColor: Color(0xff2685FA)), helperCard( I18n.of(context).travel_butler, R.assetsImagesImgTravelButler, () { @@ -177,7 +177,7 @@ class RealTimeHelperPageState extends State { builder: (_) => TravelButlerPage(), ), ); - },textColor: Color(0xffff682d),tips: I18n.of(context).travel_introduction), + },textColor: Color(0xffff682d) ), SizedBox( height: 15, ), @@ -189,7 +189,7 @@ class RealTimeHelperPageState extends State { } Widget helperCard(String title, String assets, Function callBack, - {Color textColor,String tips}) { + {Color textColor }) { return Stack(children: [ InkWell( child: Container( @@ -223,13 +223,6 @@ class RealTimeHelperPageState extends State { onTap: callBack, ), - Positioned(child: InkWell(child: Container( width: 40,height: 40,child: Align(child: Icon( - IconData(0xe681, fontFamily: Constants.IconFontFamily), - color: Color(0xFFFF7E00), - size: 28.0, - ),alignment: Alignment.center,),),onTap: (){ - CustomUI.buildTip(context, title, Padding(padding: EdgeInsets.all(10),child: fixedText(tips,fontSize: 14),)); - },),right: 21,top: 21,) ],); } diff --git a/lib/home/realtimehelper/translation_butler_page.dart b/lib/home/realtimehelper/translation_butler_page.dart index 154295c..691242e 100644 --- a/lib/home/realtimehelper/translation_butler_page.dart +++ b/lib/home/realtimehelper/translation_butler_page.dart @@ -363,14 +363,30 @@ class TranslationButlerPageState extends State { return ListView( controller: _scrollController, children: [ + Padding( padding: EdgeInsets.only(left: 20, right: 10, top: 15), - child: Text( - I18n.of(context).translation_butler_tips, - textScaleFactor: 1.0, - style: TextStyle(color: Color(0xffABABAB), fontSize: 13), - ), - ), + child: Row(children: [ + Expanded(child: Text( + I18n.of(context).translation_butler_tips, + textScaleFactor: 1.0, + style: TextStyle(color: Color(0xffABABAB), fontSize: 13), + )), + InkWell(child: Container( width: 40,height: 40,child: Align(child: Icon( + IconData(0xe681, fontFamily: Constants.IconFontFamily), + color: Color(0xFFFF7E00), + size: 28.0, + ),alignment: Alignment.center,),),onTap: (){ + CustomUI.buildTip(context, I18n.of(context).translation_butler, Padding(padding: EdgeInsets.all(10),child: fixedText(I18n.of(context).translation_butler_introduction,fontSize: 14),)); + },) + ],), + ) , + + + + + + Container( margin: EdgeInsets.all(10), child: Card( diff --git a/lib/home/realtimehelper/travel_butler_page.dart b/lib/home/realtimehelper/travel_butler_page.dart index fb98f7a..a3f228c 100644 --- a/lib/home/realtimehelper/travel_butler_page.dart +++ b/lib/home/realtimehelper/travel_butler_page.dart @@ -67,6 +67,27 @@ class TravelButlerPageState extends State { color: Color(0xffE8EAF0), child: ListView( children: [ + + + Padding( + padding: EdgeInsets.only(left: 20, right: 10, top: 15), + child: Row(children: [ + Expanded(child: Text( + I18n.of(context).travel_tips2, + textScaleFactor: 1.0, + style: TextStyle(color: Color(0xffABABAB), fontSize: 13), + )), + InkWell(child: Container( width: 40,height: 40,child: Align(child: Icon( + IconData(0xe681, fontFamily: Constants.IconFontFamily), + color: Color(0xFFFF7E00), + size: 28.0, + ),alignment: Alignment.center,),),onTap: (){ + CustomUI.buildTip(context, I18n.of(context).travel_butler, Padding(padding: EdgeInsets.all(10),child: fixedText(I18n.of(context).travel_introduction,fontSize: 14),)); + },) + ],), + ) , + + Container( margin: EdgeInsets.all(10), child: Card( diff --git a/lib/utils/HttpUtil.dart b/lib/utils/HttpUtil.dart index 459dcdd..ddc316a 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) { @@ -1111,7 +1111,6 @@ class HttpUtil { Map data = { "suserid": msgModel.from, "chatmsgid": msgModel.time, - "slanguage": 1, "tlanguage": UserData().language, "chattype": msgModel.msgType, "chatchanneltype": msgModel.channelType, diff --git a/lib/utils/msgHandler.dart b/lib/utils/msgHandler.dart index 921fa6f..d821f96 100644 --- a/lib/utils/msgHandler.dart +++ b/lib/utils/msgHandler.dart @@ -256,8 +256,6 @@ class MsgHandler { static int tempGroupId = 0; static int mLastClickTime = 0; static int timeInterval = 2500; -// static int receivedCount=0; - static int time; static handlerReceiveMsg(PushChat chat) async { bool isGroup = false; @@ -485,8 +483,8 @@ class MsgHandler { } } else { //聊天消息 - time = DateTime.now().millisecondsSinceEpoch; - print('******收到聊天消息 $time'); + //time = DateTime.now().millisecondsSinceEpoch; + //print('******收到聊天消息 $time'); int sessionId = chat.targetId; print('sessionId $sessionId'); if (isGroup) { diff --git a/pubspec.yaml b/pubspec.yaml index a9aac2c..a7df44e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: chat description: A new Flutter project. #修改版本号后get-clean -version: 1.0.9+14 +version: 1.1.0+15 environment: sdk: ">=2.1.0 <3.0.0"