diff --git a/assets/image/2x/activity_hot.png b/assets/image/2x/activity_hot.png new file mode 100644 index 00000000..99d96f82 Binary files /dev/null and b/assets/image/2x/activity_hot.png differ diff --git a/assets/image/2x/activity_q.png b/assets/image/2x/activity_q.png new file mode 100644 index 00000000..98422818 Binary files /dev/null and b/assets/image/2x/activity_q.png differ diff --git a/assets/image/2x/c_z.png b/assets/image/2x/c_z.png new file mode 100644 index 00000000..547e82d4 Binary files /dev/null and b/assets/image/2x/c_z.png differ diff --git a/assets/image/2x/icon_gz.png b/assets/image/2x/icon_gz.png new file mode 100644 index 00000000..d0895af4 Binary files /dev/null and b/assets/image/2x/icon_gz.png differ diff --git a/assets/image/2x/icon_pl.png b/assets/image/2x/icon_pl.png new file mode 100644 index 00000000..797562e6 Binary files /dev/null and b/assets/image/2x/icon_pl.png differ diff --git a/assets/image/2x/icon_z.png b/assets/image/2x/icon_z.png new file mode 100644 index 00000000..df1f19f5 Binary files /dev/null and b/assets/image/2x/icon_z.png differ diff --git a/assets/image/3x/activity_hot.png b/assets/image/3x/activity_hot.png new file mode 100644 index 00000000..65abff9d Binary files /dev/null and b/assets/image/3x/activity_hot.png differ diff --git a/assets/image/3x/activity_q.png b/assets/image/3x/activity_q.png new file mode 100644 index 00000000..abd4589d Binary files /dev/null and b/assets/image/3x/activity_q.png differ diff --git a/assets/image/3x/c_z.png b/assets/image/3x/c_z.png new file mode 100644 index 00000000..80055084 Binary files /dev/null and b/assets/image/3x/c_z.png differ diff --git a/assets/image/3x/icon_gz.png b/assets/image/3x/icon_gz.png new file mode 100644 index 00000000..2047e60b Binary files /dev/null and b/assets/image/3x/icon_gz.png differ diff --git a/assets/image/3x/icon_pl.png b/assets/image/3x/icon_pl.png new file mode 100644 index 00000000..b2b3cce5 Binary files /dev/null and b/assets/image/3x/icon_pl.png differ diff --git a/assets/image/3x/icon_z.png b/assets/image/3x/icon_z.png new file mode 100644 index 00000000..ef42dc7e Binary files /dev/null and b/assets/image/3x/icon_z.png differ diff --git a/assets/image/activity_hot.png b/assets/image/activity_hot.png new file mode 100644 index 00000000..c7eb44da Binary files /dev/null and b/assets/image/activity_hot.png differ diff --git a/assets/image/activity_q.png b/assets/image/activity_q.png new file mode 100644 index 00000000..46742d63 Binary files /dev/null and b/assets/image/activity_q.png differ diff --git a/assets/image/c_z.png b/assets/image/c_z.png new file mode 100644 index 00000000..71d21f72 Binary files /dev/null and b/assets/image/c_z.png differ diff --git a/assets/image/icon_gz.png b/assets/image/icon_gz.png new file mode 100644 index 00000000..e024a3c8 Binary files /dev/null and b/assets/image/icon_gz.png differ diff --git a/assets/image/icon_pl.png b/assets/image/icon_pl.png new file mode 100644 index 00000000..3424e8b3 Binary files /dev/null and b/assets/image/icon_pl.png differ diff --git a/assets/image/icon_z.png b/assets/image/icon_z.png new file mode 100644 index 00000000..20b0f313 Binary files /dev/null and b/assets/image/icon_z.png differ diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 814fbd6c..6e58a0cb 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -173,7 +173,7 @@ PODS: - SDWebImage (5.12.1): - SDWebImage/Core (= 5.12.1) - SDWebImage/Core (5.12.1) - - shared_preferences (0.0.1): + - shared_preferences_ios (0.0.1): - Flutter - sharesdk_plugin (1.1.2): - Flutter @@ -207,12 +207,12 @@ PODS: - mob_sharesdk/ShareSDKPlatforms/Twitter - mob_sharesdk/ShareSDKPlatforms/VKontakte - mob_sharesdk/ShareSDKPlatforms/WatermelonVideo - - mob_sharesdk/ShareSDKPlatforms/WeChat_Lite - mob_sharesdk/ShareSDKPlatforms/WhatsApp - mob_sharesdk/ShareSDKPlatforms/Yixin - mob_sharesdk/ShareSDKPlatforms/YouDaoNote - mob_sharesdk/ShareSDKRestoreScene - mob_sharesdk/ShareSDKUI + - WechatOpenSDK_Fuck (~> 1.9.2) - sqflite (0.0.2): - Flutter - FMDB (>= 2.7.5) @@ -248,7 +248,7 @@ DEPENDENCIES: - path_provider (from `.symlinks/plugins/path_provider/ios`) - permission_handler (from `.symlinks/plugins/permission_handler/ios`) - scan (from `.symlinks/plugins/scan/ios`) - - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) + - shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`) - sharesdk_plugin (from `.symlinks/plugins/sharesdk_plugin/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`) - SSZipArchive (~> 2.4.2) @@ -298,8 +298,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/permission_handler/ios" scan: :path: ".symlinks/plugins/scan/ios" - shared_preferences: - :path: ".symlinks/plugins/shared_preferences/ios" + shared_preferences_ios: + :path: ".symlinks/plugins/shared_preferences_ios/ios" sharesdk_plugin: :path: ".symlinks/plugins/sharesdk_plugin/ios" sqflite: @@ -321,13 +321,13 @@ SPEC CHECKSUMS: AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce BaiduMapKit: 907c6d9b74f66c3ff4741fc4b568ae0b339917f8 BMKLocationKit: 097814ef672b1e57e86e6c1968d7892fb78002bf - Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c + Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a flutter_baidu_mapapi_base: 90fddba11ec4435406a7211d6ee905b4311c31db flutter_baidu_mapapi_map: 771bf00671832b1fcddb17733518cd631529df16 flutter_baidu_mapapi_search: 4cffaa74e739a4114595c4f82f790e1783bb612d flutter_baidu_mapapi_utils: a5bd582b91ecd35be1bc45558b38f49d5684f70a flutter_bmflocation: 12f1ba91bae4b16d78d4f475023e0254ed351f1c - fluwx: c192ef1ea3617badb813fa1a761ffc5c9c12208a + fluwx: 02670633ce7509206f62b366e9734e7dda81e100 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a image_pickers: 5e6ec7083f9363d014c0fb061f1b9cd97bb5e451 mob_sharesdk: c771f001e00739d24301a9fa250247601efe7a3c @@ -337,17 +337,17 @@ SPEC CHECKSUMS: permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 scan: aea35bb4aa59ccc8839c576a18cd57c7d492cc86 SDWebImage: 4dc3e42d9ec0c1028b960a33ac6b637bb432207b - shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d - sharesdk_plugin: 5a59e49d2d5e55c8e8f67cc9ddf05172c2494a6b + shared_preferences_ios: aef470a42dc4675a1cdd50e3158b42e3d1232b32 + sharesdk_plugin: 31d5b9be9522985da8e3a90ff73f6e12e62f9049 sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 SSZipArchive: e7b4f3d9e780c2acc1764cd88fbf2de28f26e5b2 - thumbnails: bb4f4e9bb4b51c8ae4e6ad9a2fa81373f9b634ad + thumbnails: df4b2db0d4030d134e7665da9c3060b0d78726fe TPNS-iOS: 57a146496858ba2fb5d43e5f240feb19243b69cb tpns_flutter_plugin: a366649c8ad71f19dfb864d3c994ed0480b69daa url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef - video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e + video_player: ecd305f42e9044793efd34846e1ce64c31ea6fcb wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f - webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b + webview_flutter: 5fb4def2bbd4339889ee14d045b605cefc5bc232 WechatOpenSDK_Fuck: aa8f4b0af902837e887a1d40c62f06c060c1dc98 ZLPhotoBrowser-objc: c7657d3bc85ae231884e058d0e3638f619164736 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 2f996806..158dfa11 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -674,7 +674,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -930,7 +930,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 59; + CURRENT_PROJECT_VERSION = 61; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -980,7 +980,7 @@ "$(PROJECT_DIR)/baidu", "$(PROJECT_DIR)/Runner/baidu", ); - MARKETING_VERSION = 1.0.59; + MARKETING_VERSION = 1.0.61; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "$(inherited)", @@ -994,7 +994,6 @@ "-l\"flutter_baidu_mapapi_map\"", "-l\"flutter_baidu_mapapi_base\"", "-l\"permission_handler\"", - "-l\"shared_preferences\"", "-l\"sqflite\"", "-l\"sqlite3\"", "-l\"video_player\"", @@ -1051,7 +1050,6 @@ }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; @@ -1100,6 +1098,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 10.0; MTL_ENABLE_DEBUG_INFO = YES; + "MTL_ENABLE_DEBUG_INFO[arch=*]" = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -1160,7 +1159,7 @@ }; 97C147061CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = ""; @@ -1168,7 +1167,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 59; + CURRENT_PROJECT_VERSION = 61; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -1218,7 +1217,7 @@ "$(PROJECT_DIR)/baidu", "$(PROJECT_DIR)/Runner/baidu", ); - MARKETING_VERSION = 1.0.59; + MARKETING_VERSION = 1.0.61; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "$(inherited)", @@ -1232,7 +1231,6 @@ "-l\"flutter_baidu_mapapi_map\"", "-l\"flutter_baidu_mapapi_base\"", "-l\"permission_handler\"", - "-l\"shared_preferences\"", "-l\"sqflite\"", "-l\"sqlite3\"", "-l\"video_player\"", @@ -1297,7 +1295,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 59; + CURRENT_PROJECT_VERSION = 61; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -1347,7 +1345,7 @@ "$(PROJECT_DIR)/baidu", "$(PROJECT_DIR)/Runner/baidu", ); - MARKETING_VERSION = 1.0.59; + MARKETING_VERSION = 1.0.61; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "$(inherited)", @@ -1361,7 +1359,6 @@ "-l\"flutter_baidu_mapapi_map\"", "-l\"flutter_baidu_mapapi_base\"", "-l\"permission_handler\"", - "-l\"shared_preferences\"", "-l\"sqflite\"", "-l\"sqlite3\"", "-l\"video_player\"", diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index fb2dffc4..c87d15a3 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ createState() { + return _CommunityChildList(); + } +} + +class _CommunityChildList extends State { + RefreshController refreshController = RefreshController(); + final ScrollController scrollController = ScrollController(); + ApiService apiService; + int pageNum = 1; + String userId; + bool isLoadMore = false; + + List comments = []; + + @override + void initState() { + super.initState(); + _onRefresh(); + } + + _onRefresh() async { + queryCommunity(); + } + + ///动态列表 + queryCommunity() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + userId = value.getString('userId'); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + if(isLoadMore){ + pageNum += 1; + isLoadMore = false; + }else pageNum = 1; + BaseData> baseData = await apiService.trendList({ + "onlyFollow": widget.typeStr == "关注" ? true : false, + "onlyMe": false, + "pageNum": pageNum, + "pageSize": 10, + "searchKey": "" + }).catchError((error) { + refreshController.refreshFailed(); + refreshController.loadFailed(); + }); + + refreshController.refreshCompleted(); + refreshController.loadComplete(); + if (baseData.isSuccess) { + setState(() { + if (pageNum == 1) { + comments.clear(); + } + comments.addAll(baseData.data.list); + // comments.sort((a,b)=>b.createTime.compareTo(a.createTime)); + // print("comments: ${comments.length}"); + if (int.tryParse(baseData.data.total) < (pageNum * 10)) { + refreshController.loadNoData(); + } + }); + } + } + + @override + Widget build(BuildContext context) { + // return FutureBuilder( + // future: queryCommunity(), + // builder: (context, position) { + return SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: true, + physics: BouncingScrollPhysics(), + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: _onRefresh, + onLoading: () { + isLoadMore = true; + _onRefresh(); + }, + scrollController: scrollController, + child: Container( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + // color: Color(0xFFF7F7F7), + // margin: EdgeInsets.only(top: 16.h), + child: Column( + children: [ + CommunityList( + comments, + userId, + 0, + isList: true, + exitFull: () { + _onRefresh(); + }, + ), + ], + ), + ), + ), + ), + ); + // }, + // ); + } +} diff --git a/lib/community/community_child_page.dart b/lib/community/community_child_page.dart index fce17374..051bf228 100644 --- a/lib/community/community_child_page.dart +++ b/lib/community/community_child_page.dart @@ -1,6 +1,9 @@ +import 'dart:convert'; + import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:huixiang/community/community_view/community_dynamic.dart'; +import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/comunity_comment.dart'; import 'package:huixiang/retrofit/data/page.dart'; @@ -24,10 +27,11 @@ class CommunityChildPage extends StatefulWidget { class _CommunityChildPage extends State { RefreshController refreshController = RefreshController(); ApiService apiService; - int pageNum = 0; + int pageNum = 1; String userId; + bool isLoadMore = false; - List comments = []; + List
articles = []; @override void initState() { @@ -36,7 +40,6 @@ class _CommunityChildPage extends State { } _onRefresh() async { - pageNum = 0; setState(() {}); } @@ -51,7 +54,11 @@ class _CommunityChildPage extends State { token: value.getString("token"), ); } - pageNum += 1; + if(isLoadMore){ + pageNum += 1; + isLoadMore = false; + } + else pageNum = 1; BaseData> baseData = await apiService.trendList({ "onlyFollow": widget.typeStr == "关注" ? true : false, "onlyMe": false, @@ -67,11 +74,25 @@ class _CommunityChildPage extends State { refreshController.loadComplete(); if (baseData.isSuccess) { if (pageNum == 1) { - comments.clear(); + articles.clear(); } - comments.addAll(baseData.data.list); + baseData.data.list.forEach((element) { + var article = Article(); + article.id = element.id; + article.content = jsonEncode(element.subjectInfo); + article.mainTitle =element.subject; + article.liked = element.selfFollow; + article.authorHeadImg = element.memberInfo?.avatar; + article.authorName = element.memberInfo?.nickname; + article.createTime = element.createTime; + article.updateUser = element.memberInfo?.mid; + article.viewers = element?.viewers; + article.likes = element?.likes; + article.comments = element?.comments; + articles.add(article); + }); // comments.sort((a,b)=>b.createTime.compareTo(a.createTime)); - print("comments: ${comments.length}"); + // print("comments: ${comments.length}"); if (int.tryParse(baseData.data.total) < (pageNum * 10)) { refreshController.loadNoData(); } @@ -96,6 +117,7 @@ class _CommunityChildPage extends State { ), onRefresh: _onRefresh, onLoading: () { + isLoadMore = true; setState(() {}); }, child: ListView.builder( @@ -103,7 +125,7 @@ class _CommunityChildPage extends State { itemBuilder: (context, position) { return InkWell( child: CommunityDynamic( - comments[position], + articles[position], 0, userId: userId, isList: true, @@ -117,14 +139,14 @@ class _CommunityChildPage extends State { Navigator.of(context).pushNamed( '/router/community_details', arguments: { - "comment": comments[position], + "businessId": articles[position].id, "userId": userId, }, ); }, ); }, - itemCount: comments.length, + itemCount: articles.length, ), ); }, diff --git a/lib/community/community_details.dart b/lib/community/community_details.dart index ded19a6e..391b8702 100644 --- a/lib/community/community_details.dart +++ b/lib/community/community_details.dart @@ -6,7 +6,6 @@ import 'package:huixiang/generated/l10n.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; -import 'package:huixiang/retrofit/data/comunity_comment.dart'; import 'package:huixiang/retrofit/data/member_comment_list.dart'; import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; @@ -30,7 +29,7 @@ class CommunityDetails extends StatefulWidget { class _CommunityDetails extends State with WidgetsBindingObserver { double height = 0; double commentHeight = 60.h; - ComunityComment comunity; + // ComunityComment comunity; String parenId = "0"; final GlobalKey commentKey = GlobalKey(); final ScrollController scrollController = ScrollController(); @@ -43,6 +42,8 @@ class _CommunityDetails extends State with WidgetsBindingObser bool isKeyBoardShow = false; int commentTotal = 0; Article article; + String businessId; + @override void didChangeMetrics() { @@ -72,15 +73,16 @@ class _CommunityDetails extends State with WidgetsBindingObser @override void initState() { super.initState(); - comunity = widget.arguments["comment"]; + // comunity = widget.arguments["comment"]; + businessId = widget.arguments["businessId"]; WidgetsBinding.instance.addObserver(this); _queryMemberCommentList(); - queryDetails(); + queryDetails(businessId); } ///详情接口 - queryDetails() async { + queryDetails(id) async { SharedPreferences value = await SharedPreferences.getInstance(); if (apiService == null) apiService = ApiService( @@ -88,11 +90,15 @@ class _CommunityDetails extends State with WidgetsBindingObser context: context, token: value.getString("token"), ); - BaseData
baseData = await apiService.informationInfo(comunity.id) + BaseData
baseData = await apiService.informationInfo(id) .catchError((onError) { debugPrint(onError.toString()); }); - if (baseData != null && baseData.isSuccess) {} + if (baseData != null && baseData.isSuccess) { + setState(() { + article = baseData.data; + }); + } } @override @@ -114,13 +120,14 @@ class _CommunityDetails extends State with WidgetsBindingObser physics: BouncingScrollPhysics(), child: Column( children: [ + if(article != null) CommunityDynamic( - comunity, + article, 0, exitFull: () { setState(() {}); }, - userId:widget.arguments["userId"], + userId:widget.arguments !=null ? widget.arguments["userId"] :widget.arguments["mid"], itemCount: 3, isDetails: true, heightFun: (height) { @@ -136,9 +143,9 @@ class _CommunityDetails extends State with WidgetsBindingObser ), CommentList( commentKey, - comunity?.likes ?? comunity?.likes.toString() ?? 0, - comunity.id, - 1, + article?.likes ?? 0, + businessId, + 4, isKeyBoardShow, _reply, _delCommentTips, @@ -154,8 +161,7 @@ class _CommunityDetails extends State with WidgetsBindingObser margin: EdgeInsets.only(top: 40), padding: EdgeInsets.all(22.h), child: Text( - S - .of(context) + S.of(context) .zanwupinglun, style: TextStyle( fontSize: 12, @@ -180,7 +186,7 @@ class _CommunityDetails extends State with WidgetsBindingObser _toComment, _queryMemberComment, _queryInformationLikes, - isLike: comunity.selfLike, + isLike: article?.liked ?? false, ), ], ), @@ -190,15 +196,15 @@ class _CommunityDetails extends State with WidgetsBindingObser ///给文章/活动点赞 _queryInformationLikes() async { - BaseData baseData = await apiService.informationLikes(comunity.id).catchError((onError) {}); + BaseData baseData = await apiService.informationLikes(businessId).catchError((onError) {}); if (baseData != null && baseData.isSuccess) { commentKey.currentState.setState(() {}); setState(() { - if (comunity.selfLike ?? false) - comunity.likes -= 1; + if (article?.liked ?? false) + article?.likes -= 1; else - comunity.likes += 1; - comunity.selfLike = !comunity.selfLike ?? false; + article?.likes += 1; + article?.liked = !(article.liked ?? false); }); } else { // SmartDialog.showToast(baseData.msg, alignment: Alignment.center); @@ -210,8 +216,8 @@ class _CommunityDetails extends State with WidgetsBindingObser BaseData baseData = await apiService.memberComment({ "content": content, "parentId": parenId, - "relationalId": comunity.id, - "relationalType":1 + "relationalId": businessId, + "relationalType":4 }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { CommentListState state = commentKey.currentState; @@ -295,8 +301,8 @@ class _CommunityDetails extends State with WidgetsBindingObser await apiService.memberCommentList({ "pageNum": 1, "pageSize": 100, - "relationalId": comunity.id, - "relationalType":1, + "relationalId": businessId, + "relationalType":4, }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { commentTotal = baseData.data.size; diff --git a/lib/community/community_list.dart b/lib/community/community_list.dart new file mode 100644 index 00000000..011ee1df --- /dev/null +++ b/lib/community/community_list.dart @@ -0,0 +1,493 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/community/photo_view_gallery_screen.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/comunity_comment.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/border_text.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/icon_text.dart'; +import 'package:huixiang/view_widget/round_button.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class CommunityList extends StatefulWidget { + final List comments; + final String userId; + final int commentType; + final bool isList; + final Function exitFull; + + CommunityList( + this.comments, + this.userId, + this.commentType,{ + this.isList = false, + this.exitFull, + } + + ); + + @override + State createState() { + return _CommunityList(); + } +} + +class _CommunityList extends State { + ApiService apiService; + + @override + void initState() { + super.initState(); + + SharedPreferences.getInstance().then((value) => { + apiService = ApiService(Dio(), + context: context, token: value.getString("token")), + }); + } + + ///关注/取关会员 + _vipFollow(followId, isFollow) async { + BaseData baseData = await apiService.follow(followId); + if (baseData != null && baseData.isSuccess) { + widget.exitFull(); + SmartDialog.showToast(isFollow ? "关注成功" : "取关成功", + alignment: Alignment.center); + setState(() {}); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + + ///删除动态 + _deleteDynamic(id) async { + BaseData baseData = await apiService.deleteTrend(id); + if (baseData != null && baseData.isSuccess) { + widget.exitFull(); + SmartDialog.showToast("删除成功", alignment: Alignment.center); + setState(() {}); + } else { + // SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + ListView.builder( + padding: EdgeInsets.zero, + itemCount: widget.comments.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context) + .pushNamed('/router/new_community_details', arguments: { + "commentsId": widget.comments[position].id, + "userId":widget.userId, + // exitFull: () { + // setState(() {}); + // }, + }).then((value) { + widget.exitFull(); + setState(() { + }); + }); + setState(() {}); + }, + child: communityItem(widget.comments[position], position), + ); + }, + ), + ], + )); + } + + ///动态内容 + Widget buildMedia(SubjectInfo subjectInfo, position) { + if (subjectInfo == null) { + return Container(); + } + Widget itemWidget = Container(); + if (subjectInfo.type == "image" && subjectInfo.images.length > 0) { + if (subjectInfo.images.length == 1) { + itemWidget = Container( + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhotoViewGalleryScreen( + images: subjectInfo.images, //传入图片list + index: 0, //传入当前点击的图片的index + ))); + }, + child: MImage( + subjectInfo.images[0], + fit: BoxFit.contain, + radius: BorderRadius.circular(2), + width: MediaQuery.of(context).size.width / 1.5, + height: MediaQuery.of(context).size.width/1.5, + errorSrc: "assets/image/default_2_1.png", + fadeSrc: "assets/image/default_2_1.png", + )), + ); + } else { + itemWidget = GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: (subjectInfo.images.length == 2 || + subjectInfo.images.length == 4) + ? 2 + : 3, + crossAxisSpacing: 12.w, + mainAxisSpacing: 12.w, + childAspectRatio: 1, + ), + padding: EdgeInsets.zero, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return Container( + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhotoViewGalleryScreen( + images: subjectInfo.images, //传入图片list + index: position, //传入当前点击的图片的index + ))); + }, + child: MImage( + subjectInfo.images[position], + fit: BoxFit.cover, + aspectRatio: 1, + radius: BorderRadius.circular(1), + errorSrc: "assets/image/default_2_1.png", + fadeSrc: "assets/image/default_2_1.png", + ), + ), + ); + }, + itemCount: subjectInfo.images.length, + ); + } + } else if (subjectInfo.type == "video" && subjectInfo.video.isNotEmpty) { + itemWidget = Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.width / 7 * 5, + color: Colors.black, + child: Stack( + children: [ + Container( + width: double.infinity, + height: double.infinity, + child: MImage( + subjectInfo.video.replaceAll(".mp4", "_poster.jpg"), + fit: BoxFit.cover, + radius: BorderRadius.circular(2), + errorSrc: "assets/image/default_2_1.png", + fadeSrc: "assets/image/default_2_1.png", + ), + ), + Center( + child: Icon( + Icons.play_circle_outline, + color: Colors.white, + size: 60, + ), + ), + ], + ), + ); + } + return Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + height: 16.h, + ), + itemWidget, + ], + ); + } + + Widget communityItem(ComunityComment comments, position) { + return Container( + width: double.infinity, + padding: EdgeInsets.all(16), + margin: EdgeInsets.only(bottom: 12), + color: Colors.white, + child: Column( + children: [ + Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + height: 44, + child: Row( + children: [ + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + PhotoViewGalleryScreen( + images: [ + (comments?.memberInfo?.avatar ?? "") + .isEmpty + ? "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg" + : comments?.memberInfo?.avatar + ], //传入图片list + index: 0, //传入当前点击的图片的index + ), + )); + }, + child: MImage( + (comments?.memberInfo?.avatar ?? + "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg"), + width: 44, + height: 44, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + ), + SizedBox( + width: 8, + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + comments?.memberInfo?.nickname ?? "", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF1A1A1A), + ), + ), + Text( + comments?.createTime ?? "", + style: TextStyle( + fontSize: 13.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF808080), + ), + ), + ], + ), + ], + ), + ), + if ((comments?.memberInfo?.mid ?? "") != (widget.userId)) + GestureDetector( + onTap: () { + setState(() { + if (widget.commentType == 0) { + comments.selfFollow = !(comments.selfFollow ?? false); + _vipFollow(comments?.memberInfo?.mid,comments?.selfFollow ?? false); + } else { + showDeleteDialog(position); + } + }); + }, + child: + (widget.commentType == 0) ? + Container( + width: 56.w, + height: 25.h, + alignment: Alignment.center, + child: RoundButton( + height: 25.h, + backgroup: (comments?.selfFollow ?? false) + ? Color(0xFFE6E6E6) + : Color(0xFF32A060), + textColor: (comments?.selfFollow ?? false) + ? Color(0xFF808080) + : Colors.white, + text: (comments?.selfFollow ?? false) + ? "已关注" + : "关注", + radius: 20, + icons: Icon( + (comments?.selfFollow ?? false) + ? Icons.check + : Icons.add, + color: (comments?.selfFollow ?? false) + ? Color(0xFF808080) + : Colors.white, + size: 15, + ), + )) + : Padding( + padding: EdgeInsets.all(20), + child: Icon( + Icons.close, + color: Colors.black, + size: 16, + ), + ), + ), + ], + ), + SizedBox( + height: 12.h, + ), + Text( + comments.subject ?? "", + maxLines: 5, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular, + fontSize: 15.sp, + ), + ), + buildMedia(comments?.subjectInfo, position), + // if (!widget.isDetails) + SizedBox( + height: 12.h, + ), + // if (!comments.isDetails) + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + IconText( + "${comments?.viewers ?? ""}", + space: 4.w, + leftImage: "assets/svg/liulanliang.svg", + iconSize: 16, + textStyle: TextStyle( + fontSize: 14.sp, + ), + ), + IconText( + "${comments.comments ?? 0}", + space: 4.w, + leftImage: "assets/svg/pinglun.svg", + iconSize: 16, + textStyle: TextStyle( + fontSize: 14.sp, + ), + ), + GestureDetector( + onTap: () {}, + child: IconText( + "${comments.likes ?? 0}", + space: 4.w, + leftImage: "assets/svg/xihuan.svg", + iconSize: 16, + textStyle: TextStyle( + fontSize: 14.sp, + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + ); + } + + ///删除动态弹窗 + showDeleteDialog(index) { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + content: Container( + width: MediaQuery.of(context).size.width - 84, + height: 130.h, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "确定要删除这条动态?", + style: TextStyle( + fontSize: 17.sp, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + SizedBox( + height: 30.h, + ), + Row( + children: [ + Expanded( + child: InkWell( + child: BorderText( + text: "取消", + textColor: Color(0xFF32A060), + fontSize: 16.sp, + fontWeight: FontWeight.bold, + borderColor: Color(0xFF32A060), + radius: 4, + padding: EdgeInsets.all(12), + borderWidth: 1, + ), + onTap: () { + Navigator.of(context).pop(); + }, + ), + flex: 1, + ), + SizedBox( + width: 16.w, + ), + Expanded( + child: InkWell( + child: RoundButton( + text: "确定", + textColor: Colors.white, + radius: 4, + padding: EdgeInsets.all(12), + backgroup: Color(0xFF32A060), + fontSize: 16.sp, + fontWeight: FontWeight.bold, + ), + onTap: () { + _deleteDynamic(widget.comments[index].id); + Navigator.of(context).pop(); + }, + ), + flex: 1, + ), + ], + ) + ], + ), + ), + ); + }, + ); + } +} diff --git a/lib/community/community_page.dart b/lib/community/community_page.dart index 399124ff..6a695ff6 100644 --- a/lib/community/community_page.dart +++ b/lib/community/community_page.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:huixiang/community/community_child_list.dart'; import 'package:huixiang/community/community_child_page.dart'; import 'package:huixiang/home/huixiang_brand_page.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; @@ -20,6 +21,8 @@ class _CommunityPage extends State with SingleTickerProviderStateMixin { TabController tabcontroller; + CommunityChildPage guanzhu,tuijian ; + List lables = [ "关注", "推荐", @@ -38,14 +41,15 @@ class _CommunityPage extends State } _toRelease() async { - int tmpIndex = tabcontroller.index; - setState(() { - tabcontroller.index = (tabcontroller.index == lables.length -1)?0:tabcontroller.index+1; - }); var result = await Navigator.of(context).pushNamed('/router/release_dynamic'); - setState(() { - tabcontroller.index = tmpIndex; - }); + + // int tmpIndex = tabcontroller.index; + // setState(() { + // tabcontroller.index = (tabcontroller.index == lables.length -1)?0:tabcontroller.index+1; + // }); + // setState(() { + // tabcontroller.index = tmpIndex; + // }); } @override @@ -82,12 +86,17 @@ class _CommunityPage extends State onTap: () { _toRelease(); }, - action: SvgPicture.asset( - "assets/svg/shequ_fabu.svg", - fit: BoxFit.contain, - width: 24, - height: 24, - ), + action: GestureDetector( + behavior: HitTestBehavior.opaque, + child: Container(color: Colors.transparent, + padding: EdgeInsets.only(left: 20,right: 20), + child: SvgPicture.asset( + "assets/svg/shequ_fabu.svg", + fit: BoxFit.contain, + width: 24, + height: 24, + ),) + ) ), body: Container( padding: EdgeInsets.only(bottom: 76.h), @@ -102,7 +111,7 @@ class _CommunityPage extends State return CommunityCourse(); } else { - return CommunityChildPage(e); + return CommunityChildList(e); } }).toList(), controller: tabcontroller, diff --git a/lib/community/community_view/class_details.dart b/lib/community/community_view/class_details.dart index 9377d1b5..7cfbf095 100644 --- a/lib/community/community_view/class_details.dart +++ b/lib/community/community_view/class_details.dart @@ -200,7 +200,7 @@ class _ClassDetails extends State with WidgetsBindingObserver { Row( children: [ Container( - height:26.h, + // height: 22.h, padding:EdgeInsets.only(left:2,right:2), alignment: Alignment.center, decoration: BoxDecoration( @@ -216,6 +216,7 @@ class _ClassDetails extends State with WidgetsBindingObserver { course.tags.length > 0) ? course.tags[0] : "", + overflow:TextOverflow.ellipsis, style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.medium, diff --git a/lib/community/community_view/class_details_video.dart b/lib/community/community_view/class_details_video.dart index a051e0f6..5c60c698 100644 --- a/lib/community/community_view/class_details_video.dart +++ b/lib/community/community_view/class_details_video.dart @@ -11,6 +11,7 @@ class ClassDetailsVideo extends StatefulWidget { final bool isShowImg; final Function exitFull; final String coverImg; + final String videoUrl; ClassDetailsVideo( { @@ -19,7 +20,8 @@ class ClassDetailsVideo extends StatefulWidget { this.isShowImg, this.exitFull, this.heightFun, - this.coverImg + this.coverImg, + this.videoUrl }) : super(key: key); @override @@ -41,6 +43,9 @@ class ClassDetailsVideoState extends State { SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, ]); + if(widget.videoUrl != null){ + initVideo(widget.videoUrl); + } } @override @@ -91,14 +96,11 @@ class ClassDetailsVideoState extends State { @override Widget build(BuildContext context) { return Container( - key: globalKey,child:videoWidget( - MediaQuery.of(context).size.width, - videoPlayerController != null - ? (MediaQuery.of(context).size.width) / - videoPlayerController.value.aspectRatio - : MediaQuery.of(context).size.width / 2, - widget.coverImg, - )); + key: globalKey,child:(videoPlayerController?.value?.isInitialized ?? false) ?videoWidget( + MediaQuery.of(context).size.width, + (MediaQuery.of(context).size.width/videoPlayerController.value.aspectRatio)-43, + widget.coverImg, + ):Container()); } @override @@ -129,15 +131,16 @@ class ClassDetailsVideoState extends State { ? Container( color: Colors.black, width: width, - // height: - height: width / 7 * 5, + // height: width / 7 * 5, + height: height, child: chewies = Chewie( controller: chewieAudioController, ), ) : Container( width: width, - height:width / 7 * 5, + // height:width / 7 * 5, + height: height, )), if (widget.isShowImg) GestureDetector( @@ -150,7 +153,8 @@ class ClassDetailsVideoState extends State { }, child: Container( width: width, - height: width / 7 * 5, + // height: width / 7 * 5, + height: height, color: Colors.black, child: Stack( children: [ diff --git a/lib/community/community_view/community_dynamic.dart b/lib/community/community_view/community_dynamic.dart index b65c6da1..cb62e132 100644 --- a/lib/community/community_view/community_dynamic.dart +++ b/lib/community/community_view/community_dynamic.dart @@ -1,10 +1,11 @@ +import 'dart:convert'; import 'dart:ui'; import 'package:chewie/chewie.dart'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; -import 'package:huixiang/retrofit/data/comunity_comment.dart'; import 'package:chewie/src/chewie_progress_colors.dart' as chewie; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; @@ -13,14 +14,11 @@ import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/icon_text.dart'; import 'package:huixiang/view_widget/round_button.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:image_pickers/image_pickers.dart'; -import 'package:photo_view/photo_view.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:video_player/video_player.dart'; import '../photo_view_gallery_screen.dart'; - class CommunityDynamic extends StatefulWidget { final int itemCount; final Function(double height) heightFun; @@ -29,11 +27,11 @@ class CommunityDynamic extends StatefulWidget { final Function removalDynamic; final Function exitFull; final bool isList; - final ComunityComment comment; + final Article article; final String userId; CommunityDynamic( - this.comment, + this.article, this.commentType, { Key key, this.itemCount = 9, @@ -78,15 +76,16 @@ class _CommunityDynamic extends State { String filePath; initVideo() async { - if (widget.comment.subjectInfo.type == "video" && - widget.comment.subjectInfo.video.isNotEmpty) { + if (widget?.article?.content == null) return; + var cnt = jsonDecode(widget.article.content); + if (cnt["type"] == "video" && cnt["video"] != null) { if (widget.isList) { videoPlayerController = VideoPlayerController.network( - widget.comment.subjectInfo.video, + cnt["video"], )..initialize().then((value) {}); } else { videoPlayerController = VideoPlayerController.network( - widget.comment.subjectInfo.video, + cnt["video"], )..initialize().then((value) { chewieAudioController = ChewieController( videoPlayerController: videoPlayerController, @@ -114,11 +113,12 @@ class _CommunityDynamic extends State { } ///关注/取关会员 - _vipFollow(followId,isFollow) async { + _vipFollow(followId, isFollow) async { BaseData baseData = await apiService.follow(followId); if (baseData != null && baseData.isSuccess) { widget.exitFull(); - SmartDialog.showToast(isFollow?"关注成功":"取关成功", alignment: Alignment.center); + SmartDialog.showToast(isFollow ? "关注成功" : "取关成功", + alignment: Alignment.center); setState(() {}); } else { // SmartDialog.showToast(baseData.msg, alignment: Alignment.center); @@ -171,22 +171,29 @@ class _CommunityDynamic extends State { child: Row( children: [ GestureDetector( - onTap: (){ - Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen( - images:[widget?.comment?.memberInfo?.avatar ?? ""],//传入图片list - index: 0,//传入当前点击的图片的index - ), ), ); - }, - child: MImage( - widget?.comment?.memberInfo?.avatar ?? "", - width: 44, - height: 44, - isCircle: true, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), - ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhotoViewGalleryScreen( + images: [(widget?.article?.authorHeadImg ?? "").isEmpty? + "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg":widget?.article?.authorHeadImg + ], //传入图片list + index: 0, //传入当前点击的图片的index + ), + )); + }, + child: + MImage( + (widget?.article?.authorHeadImg ?? "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg"), + width: 44, + height: 44, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + ), SizedBox( width: 8, ), @@ -195,7 +202,7 @@ class _CommunityDynamic extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - widget?.comment?.memberInfo?.nickname ?? "", + widget?.article?.authorName ?? "", style: TextStyle( fontSize: 15.sp, fontWeight: MyFontWeight.semi_bold, @@ -203,7 +210,7 @@ class _CommunityDynamic extends State { ), ), Text( - widget?.comment?.createTime ?? "", + widget?.article?.createTime ?? "", style: TextStyle( fontSize: 13.sp, fontWeight: MyFontWeight.regular, @@ -215,14 +222,15 @@ class _CommunityDynamic extends State { ], ), ), - if (widget?.comment?.memberInfo?.mid != widget.userId ?? "") + if (widget?.article?.updateUser != widget.userId ?? "") GestureDetector( onTap: () { setState(() { if (widget.commentType == 0) { - widget.comment.selfFollow = - !(widget.comment.selfFollow ?? false); - _vipFollow(widget.comment.memberInfo?.mid,widget.comment.selfFollow ?? false); + widget.article.liked = + !(widget.article.liked ?? false); + _vipFollow(widget.article.updateUser, + widget.article.liked ?? false); } else { showDeleteDialog(); } @@ -235,31 +243,34 @@ class _CommunityDynamic extends State { alignment: Alignment.center, child: RoundButton( height: 25.h, - backgroup: (widget.comment.selfFollow ?? false) + backgroup: (widget?.article?.liked ?? false) ? Color(0xFFE6E6E6) : Color(0xFF32A060), - textColor: (widget.comment.selfFollow ?? false) + textColor: (widget?.article?.liked ?? false) ? Color(0xFF808080) : Colors.white, - text: (widget.comment.selfFollow ?? false) + text: (widget?.article?.liked ?? false) ? "已关注" : "关注", radius: 20, icons: Icon( - (widget.comment.selfFollow ?? false) + (widget?.article?.liked ?? false) ? Icons.check : Icons.add, - color: (widget.comment.selfFollow ?? false) + color: (widget?.article?.liked ?? false) ? Color(0xFF808080) : Colors.white, size: 15, ), )) - : Padding(padding: EdgeInsets.all(20),child:Icon( - Icons.close, - color: Colors.black, - size: 16, - ),), + : Padding( + padding: EdgeInsets.all(20), + child: Icon( + Icons.close, + color: Colors.black, + size: 16, + ), + ), ), ], ), @@ -267,7 +278,7 @@ class _CommunityDynamic extends State { height: 12.h, ), Text( - widget.comment.subject ?? "", + widget?.article?.mainTitle ?? "", maxLines: 5, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -276,7 +287,7 @@ class _CommunityDynamic extends State { fontSize: 15.sp, ), ), - buildMedia(widget.comment.subjectInfo), + buildMedia(widget?.article?.content), if (!widget.isDetails) SizedBox( height: 12.h, @@ -287,8 +298,8 @@ class _CommunityDynamic extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ IconText( - (widget.comment != null) - ? "${widget.comment.viewers}" + (widget.article != null) + ? "${widget.article.viewers}" : "", space: 4.w, leftImage: "assets/svg/liulanliang.svg", @@ -298,7 +309,7 @@ class _CommunityDynamic extends State { ), ), IconText( - "${widget.comment.comments ?? 0}", + "${widget.article.comments ?? 0}", space: 4.w, leftImage: "assets/svg/pinglun.svg", iconSize: 16, @@ -309,7 +320,7 @@ class _CommunityDynamic extends State { GestureDetector( onTap: () {}, child: IconText( - "${widget.comment.likes ?? 0}", + "${widget.article.likes ?? 0}", space: 4.w, leftImage: "assets/svg/xihuan.svg", iconSize: 16, @@ -332,39 +343,46 @@ class _CommunityDynamic extends State { } ///动态内容 - Widget buildMedia(SubjectInfo subjectInfo) { - if (subjectInfo == null) { + Widget buildMedia(String subjectInfo) { + if (subjectInfo == null || !subjectInfo.startsWith("{")) { return Container(); } + var cnt = jsonDecode(subjectInfo); Widget itemWidget = Container(); - if (subjectInfo.type == "image" && subjectInfo.images.length > 0) { - if (subjectInfo.images.length == 1) { + if (cnt["type"] == "image" && + cnt["images"] != null && + cnt["images"].length > 0) { + if (cnt["images"].length == 1) { itemWidget = Container( child: InkWell( - onTap: () { - ImagePickers.previewImages(subjectInfo.images,0); - // Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen( - // images:subjectInfo.images,//传入图片list - // index: 0,//传入当前点击的图片的index - // ), ), ); - }, - child: MImage( - subjectInfo.images[0], - fit: BoxFit.cover, - radius: BorderRadius.circular(2), - width: MediaQuery.of(context).size.width / 1.5, - height: MediaQuery.of(context).size.width / 1.5, - errorSrc: "assets/image/default_2_1.png", - fadeSrc: "assets/image/default_2_1.png", - )), + onTap: () { + // ImagePickers.previewImages(subjectInfo.images,0); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhotoViewGalleryScreen( + images: cnt["images"], //传入图片list + index: 0, //传入当前点击的图片的index + ), + ), + ); + }, + child: MImage( + cnt["images"][0], + fit: BoxFit.contain, + radius: BorderRadius.circular(2), + height:MediaQuery.of(context).size.width/1.5, + errorSrc: "assets/image/default_2_1.png", + fadeSrc: "assets/image/default_2_1.png", + )), ); } else { itemWidget = GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: (subjectInfo.images.length == 2 || - subjectInfo.images.length == 4) - ? 2 - : 3, + crossAxisCount: + (cnt["images"].length == 2 || cnt["images"].length == 4) + ? 2 + : 3, crossAxisSpacing: 12.w, mainAxisSpacing: 12.w, childAspectRatio: 1, @@ -377,13 +395,18 @@ class _CommunityDynamic extends State { child: InkWell( onTap: () { // ImagePickers.previewImages(subjectInfo.images, position); - Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen( - images:subjectInfo.images,//传入图片list - index: position,//传入当前点击的图片的index - ), ), ); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhotoViewGalleryScreen( + images: cnt["images"], //传入图片list + index: position, //传入当前点击的图片的index + ), + ), + ); }, child: MImage( - subjectInfo.images[position], + cnt["images"][position], fit: BoxFit.cover, aspectRatio: 1, radius: BorderRadius.circular(1), @@ -393,17 +416,19 @@ class _CommunityDynamic extends State { ), ); }, - itemCount: subjectInfo.images.length, + itemCount: cnt["images"].length, ); } - } else if (subjectInfo.type == "video" && subjectInfo.video.isNotEmpty) { + } else if (cnt["type"] == "video" && + cnt["video"] != null && + cnt["video"].isNotEmpty) { itemWidget = videoWidget( MediaQuery.of(context).size.width - 32, videoPlayerController != null ? (MediaQuery.of(context).size.width - 32) / videoPlayerController.value.aspectRatio : MediaQuery.of(context).size.width / 2, - !widget.isList ? subjectInfo.video : widget.comment.coverImg, + cnt["video"].replaceAll(".mp4", "_poster.jpg"), ); } return Column( @@ -460,7 +485,9 @@ class _CommunityDynamic extends State { color: Colors.black, child: Stack( children: [ - Center( + Container( + width: double.infinity, + height: double.infinity, child: MImage( src, aspectRatio: videoPlayerController != null @@ -500,7 +527,7 @@ class _CommunityDynamic extends State { return AlertDialog( content: Container( width: MediaQuery.of(context).size.width - 84, - height: 110.h, + height: 130.h, child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -551,7 +578,7 @@ class _CommunityDynamic extends State { fontWeight: FontWeight.bold, ), onTap: () { - _deleteDynamic(widget.comment.id); + _deleteDynamic(widget.article.id); Navigator.of(context).pop(); }, ), diff --git a/lib/community/community_view/home_class.dart b/lib/community/community_view/home_class.dart index 52acdfc8..78435916 100644 --- a/lib/community/community_view/home_class.dart +++ b/lib/community/community_view/home_class.dart @@ -220,7 +220,7 @@ class _HomeClass extends State { Container( margin: EdgeInsets.only(top: 8, right: 8), padding: EdgeInsets.only(left: 2, right: 2), - height: 16.h, + height: 20.h, alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(2), @@ -230,8 +230,9 @@ class _HomeClass extends State { (collect?.tags != null && collect.tags.length > 0) ? collect.tags[0] : "", + overflow:TextOverflow.ellipsis, style: TextStyle( - fontSize: 12.sp, + fontSize: 11.sp, fontWeight: MyFontWeight.medium, color: Color(0xFF634815), ), diff --git a/lib/community/headlines/activity_top_list.dart b/lib/community/headlines/activity_top_list.dart new file mode 100644 index 00000000..32e7bc3e --- /dev/null +++ b/lib/community/headlines/activity_top_list.dart @@ -0,0 +1,171 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; +import 'package:huixiang/retrofit/data/article.dart'; +import 'package:huixiang/retrofit/data/collect_class_list.dart'; +import 'package:huixiang/retrofit/data/course_list.dart'; +import 'package:huixiang/retrofit/data/headlines_list.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/new_people_reward.dart'; + +class ActivityTopList extends StatefulWidget { + final List
articleTop; + + ActivityTopList(this.articleTop); + + @override + State createState() { + return _ActivityTopList(); + } +} + +class _ActivityTopList extends State { + ApiService apiService; + BMFCoordinate latLng; + + final TextEditingController editingController = TextEditingController(); + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + height: 220.h, + margin: EdgeInsets.only(top: 10), + child: ListView.builder( + scrollDirection: Axis.horizontal, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.symmetric(horizontal: 10), + itemCount: widget.articleTop == null ? 0 : widget.articleTop.length, + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed('/router/web_page', + arguments: {"articleId": widget.articleTop[position].id}); + widget.articleTop[position].viewers = + (widget.articleTop[position].viewers + 1); + setState(() {}); + }, + child: headlinesCollectionItem(widget.articleTop[position], position), + ); + }, + ), + ); + } + + Widget headlinesCollectionItem(Article articles, index) { + return Container( + width: 340.w, + height: 220.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(10), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.black, + ), + margin: EdgeInsets.symmetric( + horizontal: 6, + ), + child:Column( + children: [ + Stack( + alignment: Alignment.bottomLeft, + children: [ + Stack( + children: [ + ClipRRect( + child: Opacity( + opacity: 0.8, + child: MImage( + widget?.articleTop[index]?.coverImg ?? "", + width: 340.w, + height: 220.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + ), + borderRadius: BorderRadius.vertical( + top: Radius.circular(4), + bottom: Radius.circular(4), + ), + ), + Container( + padding: EdgeInsets.only(left: 12.w, right: 12.w, top: 8), + alignment: Alignment.topLeft, + child: Row( + children: [ + Image.asset( + "assets/image/activity_hot.png", + width: 20, + height: 20, + fit: BoxFit.fill, + ), + SizedBox( + width: 4.w, + ), + Expanded( + child: Text( + "精选好文", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.white, + ), + ), + ), + ], + )), + ], + ), + Padding(padding:EdgeInsets.only(left: 12.w, right: 12.w, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget?.articleTop[index]?.mainTitle ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.white, + ), + ), + SizedBox(height: 5.h), + Opacity(opacity:0.8, + child: Text( + widget?.articleTop[index]?.viceTitle ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ),) + + ], + )), + ], + ), + ], + ) + ); + } +} diff --git a/lib/community/headlines/article_list.dart b/lib/community/headlines/article_list.dart index 9bf6a0e0..4bf58089 100644 --- a/lib/community/headlines/article_list.dart +++ b/lib/community/headlines/article_list.dart @@ -1,20 +1,10 @@ import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_easyloading/flutter_easyloading.dart'; -import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/article.dart'; -import 'package:huixiang/retrofit/data/banner.dart'; -import 'package:huixiang/retrofit/data/base_data.dart'; -import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; -import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/custom_image.dart'; -import 'package:huixiang/view_widget/hot_item.dart'; -import 'package:huixiang/view_widget/my_appbar.dart'; -import 'package:huixiang/view_widget/my_footer.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; diff --git a/lib/community/headlines/article_page.dart b/lib/community/headlines/article_page.dart index 5bcc9376..c3feaabf 100644 --- a/lib/community/headlines/article_page.dart +++ b/lib/community/headlines/article_page.dart @@ -14,12 +14,14 @@ import 'package:huixiang/retrofit/data/headlines_list.dart'; import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/event_type.dart'; +import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/my_footer.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'activity_top_list.dart'; import 'article_list.dart'; class ArticlePage extends StatefulWidget { @@ -39,6 +41,7 @@ class _ArticlePage extends State List brands = []; List bannerData = []; List
articles = []; + List
articleTop = []; List headlines = []; int pageNum = 1; @@ -52,7 +55,8 @@ class _ArticlePage extends State setState(() {}); } }); - queryArticleList(); + queryArticleList(false); + queryArticleList(true); queryHeadlinesBanner(); queryHeadlinesList(); } @@ -90,7 +94,7 @@ class _ArticlePage extends State } ///文章列表 - queryArticleList() async { + queryArticleList(bool isHot) async { if (apiService == null) { SharedPreferences value = await SharedPreferences.getInstance(); apiService = ApiService( @@ -104,7 +108,9 @@ class _ArticlePage extends State "pageSize": 10, "searchKey": "", "state": 1, - "type": 2 + "type": 2, + "storeId":"", + "isHot":isHot }).catchError((onError) { refreshController.refreshFailed(); refreshController.loadFailed(); @@ -113,9 +119,15 @@ class _ArticlePage extends State refreshController.refreshCompleted(); refreshController.loadComplete(); if (pageNum == 1) { + if(!isHot) articles.clear(); + else + articleTop.clear(); } + if(!isHot) articles.addAll(baseData.data.list); + else + articleTop.addAll(baseData.data.list); if (baseData.data.pageNum == baseData.data.pages) { refreshController.loadNoData(); } else { @@ -155,7 +167,8 @@ class _ArticlePage extends State _onRefresh() { queryHeadlinesBanner(); queryHeadlinesList(); //分类列表 - queryArticleList(); + queryArticleList(false); + queryArticleList(true); } @override @@ -177,7 +190,7 @@ class _ArticlePage extends State ), onRefresh: _onRefresh, onLoading: () { - queryArticleList(); + queryArticleList(false); }, physics: BouncingScrollPhysics(), scrollController: scrollController, @@ -207,12 +220,29 @@ class _ArticlePage extends State List classChildItem() { var widgets = [ ///文章banner - HeadlinesBanner( - bannerData, - ), + // HeadlinesBanner( + // bannerData, + // ), + + ActivityTopList(articleTop), SizedBox(height: 28), + Container( + width: double.infinity, + margin: EdgeInsets.only(left: 16,bottom:5), + child:Text( + "文章专栏", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ) + ), + ///头条合集列表 HeadlinesCollection(headlines, articles), diff --git a/lib/community/headlines/headlines_collection.dart b/lib/community/headlines/headlines_collection.dart index 58561595..6b99e86c 100644 --- a/lib/community/headlines/headlines_collection.dart +++ b/lib/community/headlines/headlines_collection.dart @@ -37,8 +37,8 @@ class _HeadlinesCollection extends State { @override Widget build(BuildContext context) { return Container( - height: 60.h, - margin: EdgeInsets.only(top: 10), + height: 100.h, + margin: EdgeInsets.only(top:10), child: ListView.builder( scrollDirection: Axis.horizontal, physics: BouncingScrollPhysics(), @@ -61,7 +61,7 @@ class _HeadlinesCollection extends State { Widget headlinesCollectionItem(HeadlinesList headlines) { return Container( width: 225.w, - height: 60.h, + height:100.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), boxShadow: [ @@ -75,7 +75,7 @@ class _HeadlinesCollection extends State { color: Colors.black, ), margin: EdgeInsets.symmetric( - horizontal: 6, + horizontal:6, ), child: Stack( children: [ @@ -85,7 +85,7 @@ class _HeadlinesCollection extends State { child: MImage( headlines?.coverImg ?? "", width: 225.w, - height: 60.h, + height: 100.h, fit: BoxFit.cover, errorSrc: "assets/image/default_1.png", fadeSrc: "assets/image/default_1.png", @@ -97,69 +97,40 @@ class _HeadlinesCollection extends State { ), ), Container( - padding: EdgeInsets.only(left: 12.w, right: 12.w), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded(child: Row( - children: [ - Container( - margin: EdgeInsets.only(right:4), - padding:EdgeInsets.only(left:2,right:2), - height: 16.h, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(2), - color: Color(0xFF32A060), - ), - child: Text( - "专栏", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, - ), - ), + padding: EdgeInsets.only(left:12.w,right: 12.w,bottom: 8), + alignment: Alignment.bottomLeft, + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right:4), + padding:EdgeInsets.only(left:2,right:2), + height:22.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + color: Color(0xFF007EFF), ), - Expanded(child:Text( - headlines?.name ?? "", - overflow: TextOverflow.ellipsis, - maxLines: 2, + child: Text( + "专栏", style: TextStyle( - fontSize: 15.sp, - fontWeight: MyFontWeight.semi_bold, + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, color: Colors.white, ), - ),), - ],)), - // Row( - // children: [ - // Expanded(child:Text( - // "更新3篇", - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.medium, - // color: Colors.white, - // ), - // )), - // Text( - // "查看专栏", - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.regular, - // color: Colors.white, - // ), - // ), - // SizedBox(width: 2), - // Image.asset( - // "assets/image/t_right.png", - // width: 14, - // height: 14, - // ), - // ],), - ],), + ), + ), + Expanded(child:Text( + headlines?.name ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.white, + ), + ),), + ],) ), ], ), diff --git a/lib/community/headlines/headlines_column_details.dart b/lib/community/headlines/headlines_column_details.dart index 699795d0..1bf752f8 100644 --- a/lib/community/headlines/headlines_column_details.dart +++ b/lib/community/headlines/headlines_column_details.dart @@ -78,7 +78,8 @@ class _HeadlinesColumnDetails extends State "searchKey": "", "state": 1, "type": 2, - "categoryId": categoryId + "categoryId": categoryId, + "isHot":false, }).catchError((onError) { refreshController.refreshFailed(); refreshController.loadFailed(); @@ -113,6 +114,7 @@ class _HeadlinesColumnDetails extends State children: [ Positioned( child: Container( + color: Colors.white, child: SmartRefresher( controller: refreshController, enablePullDown: true, @@ -142,14 +144,20 @@ class _HeadlinesColumnDetails extends State Stack( children: [ Positioned( - child: MImage( - headlinesListDetails?.bannerImg ?? "", - width: double.infinity, - height: 260.h, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), + child: Container( + color: Colors.black, + child:Opacity( + opacity:0.75, + child: MImage( + headlinesListDetails?.bannerImg ?? "", + width: double.infinity, + height: 260.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ) + ) + ) ), Container( margin: EdgeInsets.only( @@ -194,7 +202,7 @@ class _HeadlinesColumnDetails extends State decoration: BoxDecoration( borderRadius: BorderRadius.circular(2), - color: Color(0xFF32A060), + color: Color(0xFF007EFF), ), child: Text( "专栏", diff --git a/lib/community/new_community_details.dart b/lib/community/new_community_details.dart new file mode 100644 index 00000000..9c441cd3 --- /dev/null +++ b/lib/community/new_community_details.dart @@ -0,0 +1,556 @@ +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/community/photo_view_gallery_screen.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/article.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/member_comment_list.dart'; +import 'package:huixiang/retrofit/data/page.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:huixiang/view_widget/round_button.dart'; +import 'package:huixiang/view_widget/tips_dialog.dart'; +import 'package:huixiang/web/web_view/comment_list.dart'; +import 'package:huixiang/web/web_view/input_comment.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'dart:ui'; + +import 'community_view/class_details_video.dart'; + +class NewCommunityDetails extends StatefulWidget { + final Map arguments; + + NewCommunityDetails({this.arguments}); + + @override + State createState() { + return _NewCommunityDetails(); + } +} + +class _NewCommunityDetails extends State with WidgetsBindingObserver { + ApiService apiService; + final GlobalKey commentKey = GlobalKey(); + final GlobalKey videoKey = GlobalKey(); + double height = 0; + final ScrollController scrollController = ScrollController(); + bool isKeyBoardShow = false; + double commentHeight = 60.h; + var commentFocus = FocusNode(); + String parenId = "0"; + String hintText = S.current.liuxianinjingcaidepinglunba; + final GlobalKey inputKey = GlobalKey(); + final TextEditingController commentTextController = TextEditingController(); + int commentTotal = 0; + List memberList = []; + bool isShowImg = true; + Article article; + String commentsId; + String userId; + + @override + void initState() { + super.initState(); + commentsId = widget.arguments["commentsId"]; + userId = widget.arguments["userId"]; + WidgetsBinding.instance.addObserver(this); + queryDetails(commentsId); + } + + ///详情接口 + queryDetails(id) async { + SharedPreferences value = await SharedPreferences.getInstance(); + if (apiService == null) + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + BaseData
baseData = await apiService.informationInfo(id) + .catchError((onError) { + debugPrint(onError.toString()); + }); + if (baseData != null && baseData.isSuccess) { + setState(() { + article = baseData.data; + }); + } + } + + ///关注/取关会员 + _vipFollow(followId, isFollow) async { + BaseData baseData = await apiService.follow(followId); + if (baseData != null && baseData.isSuccess) { + SmartDialog.showToast(isFollow ? "关注成功" : "取关成功", + alignment: Alignment.center); + setState(() {}); + } else { + // SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + + @override + void didChangeMetrics() { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (!mounted) return; + if (MediaQuery.of(context).viewInsets.bottom == 0) { + if (isKeyBoardShow) { + FocusScope.of(context).requestFocus(FocusNode()); + if (mounted) + setState(() { + hintText = S.current.liuxianinjingcaidepinglunba; + isKeyBoardShow = false; + }); + } + } else { + if (mounted) + setState(() { + isKeyBoardShow = true; + }); + } + }); + } + + @override + Widget build(BuildContext context) { + return WillPopScope( + onWillPop: () async { + Navigator.of(context).pop(true); + return false; + }, + child:AnnotatedRegion( + value: SystemUiOverlayStyle.light, + child: Material(child: Scaffold( + appBar: MyAppBar( + title: "动态详情", + titleColor: Colors.black, + titleSize: 18.sp, + background: Colors.white, + leading: true, + leadingColor: Colors.black, + ), + body: Container( + margin: EdgeInsets.only(top:2.h), + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + Container( + padding: EdgeInsets.all(16), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + height: 44, + child: Row( + children: [ + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhotoViewGalleryScreen( + images: [ + (article?.authorHeadImg ?? "") + .isEmpty + ? "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg" + : article?.authorHeadImg + ], //传入图片list + index: 0, //传入当前点击的图片的index + ), + )); + }, + child: MImage( + (article?.authorHeadImg ?? + ""), + width: 44, + height: 44, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + ), + SizedBox( + width: 8, + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + article?.authorName ?? "", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF1A1A1A), + ), + ), + Text( + article?.createTime ?? "", + style: TextStyle( + fontSize: 13.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF808080), + ), + ), + ], + ), + ], + ), + ), + if (article?.updateUser != userId) + GestureDetector( + onTap: () { + setState(() { + article.liked = + !(article.liked ?? false); + _vipFollow(article.updateUser, + article.liked ?? false); + }); + }, + child: + Container( + width: 56.w, + height: 25.h, + alignment: Alignment.center, + child: RoundButton( + height: 25.h, + backgroup: (article?.liked ?? false) + ? Color(0xFFE6E6E6) + : Color(0xFF32A060), + textColor: (article?.liked ?? false) + ? Color(0xFF808080) + : Colors.white, + text: (article?.liked ?? false) + ? "已关注" + : "关注", + radius: 20, + icons: Icon( + (article?.liked ?? false) + ? Icons.check + : Icons.add, + color: (article?.liked ?? false) + ? Color(0xFF808080) + : Colors.white, + size: 15, + ), + )) + ), + ], + ), + SizedBox( + height: 12.h, + ), + Text( + article?.mainTitle ?? "", + maxLines: 5, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular, + fontSize: 15.sp, + ), + ), + buildMedia(article?.content), + ], + ), + ), + CommentList( + commentKey, + article?.likes ?? 0, + commentsId, + 4, + isKeyBoardShow, + _reply, + _delCommentTips, + 12.sp, + requestApiFinish: (total){setState(() { + commentTotal = total; + });}, + ), + if (memberList == null || memberList.length == 0) + Container( + width: double.infinity, + alignment: Alignment.topCenter, + margin: EdgeInsets.only(top: 40), + padding: EdgeInsets.all(22.h), + child: Text( + S.of(context) + .zanwupinglun, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: Color(0xFFA0A0A0), + ), + ), + ), + ], + ), + ), + flex: 1, + ), + /// 富文本评论的输入框 + InputComment( + inputKey, + hintText, + isKeyBoardShow, + commentFocus, + commentTextController, + _toComment, + _queryMemberComment, + _queryInformationLikes, + isLike: article?.liked ?? false, + ), + ], + ), + ), + ),) + )); + } + + ///动态内容 + Widget buildMedia(String subjectInfo) { + if (subjectInfo == null || !subjectInfo.startsWith("{")) { + return Container(); + } + var cnt = jsonDecode(subjectInfo); + Widget itemWidget = Container(); + if (cnt["type"] == "image" && + cnt["images"] != null && + cnt["images"].length > 0) { + if (cnt["images"].length == 1) { + itemWidget = Container( + child: InkWell( + onTap: () { + // ImagePickers.previewImages(subjectInfo.images,0); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhotoViewGalleryScreen( + images: cnt["images"], //传入图片list + index: 0, //传入当前点击的图片的index + ), + ), + ); + }, + child: MImage( + cnt["images"][0], + radius: BorderRadius.circular(2), + fit: BoxFit.contain, + width: MediaQuery.of(context).size.width / 1.5, + height: MediaQuery.of(context).size.width, + errorSrc: "assets/image/default_2_1.png", + fadeSrc: "assets/image/default_2_1.png", + )), + ); + } else { + itemWidget = GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: + (cnt["images"].length == 2 || cnt["images"].length == 4) + ? 2 + : 3, + crossAxisSpacing: 12.w, + mainAxisSpacing: 12.w, + childAspectRatio: 1, + ), + padding: EdgeInsets.zero, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return Container( + child: InkWell( + onTap: () { + // ImagePickers.previewImages(subjectInfo.images, position); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhotoViewGalleryScreen( + images: cnt["images"], //传入图片list + index: position, //传入当前点击的图片的index + ), + ), + ); + }, + child: MImage( + cnt["images"][position], + fit: BoxFit.cover, + aspectRatio: 1, + radius: BorderRadius.circular(1), + errorSrc: "assets/image/default_2_1.png", + fadeSrc: "assets/image/default_2_1.png", + ), + ), + ); + }, + itemCount: cnt["images"].length, + ); + } + } else if (cnt["type"] == "video" && + cnt["video"] != null && + cnt["video"].isNotEmpty) { + itemWidget = Container( + child:ClassDetailsVideo(key:videoKey,exitFull: (){setState(() {});}, + coverImg: cnt["video"].toString().replaceAll(".mp4", "_poster.jpg"),isShowImg: this.isShowImg, + changeShowImg: (isShowImg){setState(() { + this.isShowImg = isShowImg; + });},videoUrl: cnt["video"], + heightFun: (height) { + this.height = + height + + MediaQuery + .of(context) + .padding + .top + + kToolbarHeight + + 24; + if (mounted) setState(() {}); + },) + ); + } + return Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + height: 16.h, + ), + itemWidget, + ], + ); + } + + ///给文章/活动点赞 + _queryInformationLikes() async { + BaseData baseData = await apiService.informationLikes(commentsId).catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + commentKey.currentState.setState(() {}); + setState(() { + if (article?.liked ?? false) + article?.likes -= 1; + else + article?.likes += 1; + article?.liked = !(article.liked ?? false); + }); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + + ///动态发布评论 + _queryMemberComment(String content) async { + BaseData baseData = await apiService.memberComment({ + "content": content, + "parentId": parenId, + "relationalId": commentsId, + "relationalType":4 + }).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + CommentListState state = commentKey.currentState; + state.queryMemberCommentList(); + commentTextController.text = ""; + FocusScope.of(context).unfocus(); + _queryMemberCommentList(); + } + } + + ///滑动到评论列表 + _toComment() { + if (commentKey.currentContext == null) return; + RenderBox firstRenderBox = commentKey.currentContext.findRenderObject(); + Offset first = firstRenderBox.localToGlobal(Offset.zero); + scrollController.animateTo( + first.dy + + scrollController.offset - + (kToolbarHeight + MediaQuery + .of(context) + .padding + .top), + duration: Duration(milliseconds: 300), + curve: Curves.easeIn, + ); + } + + contentHeight() { + double contentHeight = MediaQuery + .of(context) + .size + .height - + kToolbarHeight - + MediaQuery + .of(context) + .padding + .top - + 160.h; + if ((contentHeight - 60.h) > (128.h * memberList.length)) { + commentHeight = contentHeight - (128.h * memberList.length); + } + } + + ///删除评论的提示 + _delCommentTips(memberComment) { + SmartDialog.show(widget: Tips(() { + delComment(memberComment); + })); + } + + ///删除评论 + delComment(memberComment) async { + BaseData baseData = await apiService.delComment(memberComment.id); + if (baseData != null && baseData.isSuccess) { + CommentListState state = commentKey.currentState; + state.queryMemberCommentList(); + } + } + + ///评论 回复 + _reply(memberComment) { + FocusScope.of(context).requestFocus(commentFocus); + parenId = memberComment.id; + hintText = S.of(context).huifu_("${memberComment.username}"); + } + + ///评论列表 + _queryMemberCommentList() async { + SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); + if (apiService == null) + apiService = ApiService( + Dio(), + context: context, + token: sharedPreferences.getString("token"), + showLoading: false, + ); + BaseData> baseData = + await apiService.memberCommentList({ + "pageNum": 1, + "pageSize": 100, + "relationalId": commentsId, + "relationalType":4, + }).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + commentTotal = baseData.data.size; + memberList = baseData.data.list; + contentHeight(); + if (mounted) setState(() {}); + } + } +} diff --git a/lib/community/photo_view_gallery_screen.dart b/lib/community/photo_view_gallery_screen.dart index 08c0e0f7..2076af6a 100644 --- a/lib/community/photo_view_gallery_screen.dart +++ b/lib/community/photo_view_gallery_screen.dart @@ -1,6 +1,9 @@ +import 'dart:io'; import 'package:flutter/material.dart'; -import 'package:photo_view/photo_view.dart'; +import 'package:huixiang/utils/ImgCachePath.dart'; +import 'package:network_to_file_image/network_to_file_image.dart'; import 'package:photo_view/photo_view_gallery.dart'; +import 'package:path/path.dart' as p; class PhotoViewGalleryScreen extends StatefulWidget { List images=[]; @@ -25,7 +28,10 @@ class _PhotoViewGalleryScreenState extends State { super.initState(); currentIndex=widget.index; } - + File fileFromDocsDir(String filename) { + String pathName = p.join(ImgCachePath.instance.path, filename); + return File(pathName); + } @override Widget build(BuildContext context) { return Scaffold( @@ -41,8 +47,12 @@ class _PhotoViewGalleryScreenState extends State { scrollPhysics: const BouncingScrollPhysics(), builder: (BuildContext context, int index) { return PhotoViewGalleryPageOptions( - imageProvider: NetworkImage(widget.images[index]), - + imageProvider: NetworkToFileImage( + url: widget.images[index], + file: fileFromDocsDir(widget.images[index].toString() + .replaceAll("https://pos.upload.gznl.top/", "").replaceAll("/", "")), + debug: true, + ), ); }, itemCount: widget.images.length, diff --git a/lib/community/release_dynamic.dart b/lib/community/release_dynamic.dart index 1ac329e9..6cffea20 100644 --- a/lib/community/release_dynamic.dart +++ b/lib/community/release_dynamic.dart @@ -85,6 +85,37 @@ class _ReleaseDynamic extends State { child: Column( children: [ buildEdit(), + Container( + width: double.infinity, + margin: EdgeInsets.all(16), + padding: EdgeInsets.only(left: 16,right: 16), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + "!", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize:18.sp, + color: Colors.red, + ), + ), + SizedBox(width: 10,), + Expanded(child: Text( + "用户发布内容需要等待系统审核,审核通过后才会在推荐广场展示", + maxLines:2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Color(0xFFA0A0A0), + ), + ),) + ], + ), + ), Expanded( child: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index 6d30b07d..6e523eba 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -21,14 +23,18 @@ import 'package:huixiang/retrofit/data/founder.dart'; import 'package:huixiang/retrofit/data/goods.dart'; import 'package:huixiang/retrofit/data/goods_category.dart'; import 'package:huixiang/retrofit/data/login_info.dart'; +import 'package:huixiang/retrofit/data/msg_stats.dart'; import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/event_type.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/activity_coupons.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/invite_success_dialog.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/new_people_reward.dart'; import 'package:huixiang/view_widget/request_permission.dart'; +import 'package:huixiang/view_widget/round_button.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -40,9 +46,10 @@ class HomePage extends StatefulWidget { final Function changeTab; final String invite; final List interviewCouponList; - final List newUserCouponList; + final List firstLoginCouponList; - HomePage(this.changeTab, {this.invite,this.interviewCouponList,this.newUserCouponList}); + HomePage(this.changeTab, + {this.invite, this.interviewCouponList, this.firstLoginCouponList}); @override State createState() { @@ -62,22 +69,23 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { setState(() {}); } }); + queryMsgStats(); - if((widget.invite??"") != "" || widget.interviewCouponList != null - && widget.interviewCouponList.length > 0) - showInvite = true; + if ((widget.invite ?? "") != "" || + widget.interviewCouponList != null && + widget.interviewCouponList.length > 0) showInvite = true; - if(widget.newUserCouponList != null && widget.newUserCouponList.length > 0) + if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0) showNew = true; } ///邀请成功弹窗 - inviteShowAlertDialog(invite,InterviewCouponList interviewCouponList) { + inviteShowAlertDialog(invite, InterviewCouponList interviewCouponList) { //显示对话框 showDialog( context: context, builder: (BuildContext context) { - return InviteSuccessDialog(invite,interviewCouponList); + return InviteSuccessDialog(invite, interviewCouponList); }, ); } @@ -114,6 +122,7 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { List gooods = []; Founder founder; bool isSigned = false; + int totalMsg = 0; queryHome() async { EasyLoading.show(status: S.of(context).zhengzaijiazai); @@ -231,16 +240,45 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { refreshController.refreshFailed(); } EasyLoading.dismiss(); - if(showInvite){ - inviteShowAlertDialog(widget.invite,widget.interviewCouponList[0]); + if (showInvite) { + inviteShowAlertDialog(widget.invite, widget.interviewCouponList[0]); showInvite = false; } - if(showNew){ - newShowAlertDialog(widget.newUserCouponList); + if (showNew) { + newShowAlertDialog(widget.firstLoginCouponList); showNew = false; } } + ///消息数量 + queryMsgStats() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = await apiService.stats().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + totalMsg = 0; + baseData.data.forEach((element) { + totalMsg += element.number; + }); + }); + // refreshController.loadComplete(); + // refreshController.refreshCompleted(); + } + EasyLoading.dismiss(); + } + + _onRefresh(){ + queryHome(); + queryMsgStats(); + } + @override void dispose() { super.dispose(); @@ -259,17 +297,56 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { leading: false, actions: [ Container( - margin: EdgeInsets.only(right: 12.w), - child: GestureDetector( - onTap: () { - Navigator.of(context).pushNamed('/router/system_msg_page'); - }, - child: SvgPicture.asset( - "assets/svg/tixing.svg", - width: 24, - height: 24, - ), + height: 24, + alignment: Alignment.center, + margin: EdgeInsets.only( + right: 12.w, ), + child: GestureDetector( + onTap: () { + Navigator.of(context).pushNamed('/router/system_msg_page'); + + }, + child: Container( + height: 24, + alignment:Alignment.center, + child:Stack( + children: [ + SvgPicture.asset( + "assets/svg/tixing.svg", + width: 24, + height: 24, + ), + if(totalMsg != 0) + Container( + width:36, + alignment: Alignment.topRight, + child:Container( + width:22, + height:14, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all( + width: 1, + color: Colors.white, + style: BorderStyle.solid, + ), + color:Color(0xFFFF441A), + ), + child:RoundButton( + text:totalMsg.toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize:8.sp, + radius: 100, + ) + ), + ) + ], + ), + ) + ) ), Container( margin: EdgeInsets.only(right: 16.w), @@ -295,12 +372,13 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { header: MyHeader(), physics: BouncingScrollPhysics(), onRefresh: () { - setState(() {}); + setState(() {_onRefresh(); + }); }, child: SingleChildScrollView( physics: NeverScrollableScrollPhysics(), child: FutureBuilder( - future: queryHome(), + future:queryHome(), builder: (context, snapshot) { return Column( children: [ @@ -308,14 +386,16 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { HomeBanner(bannerData, controller), ///快捷操作 - ShortcutOperation((){ + ShortcutOperation(() { widget.changeTab(1); }), ///签到 - SignView(isSigned,(value){setState(() { - isSigned = value; - });}), + SignView(isSigned, (value) { + setState(() { + isSigned = value; + }); + }), // ///热门文章 // HotArticle(articles), @@ -330,12 +410,16 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { ///超级优惠券 // CouponView(), - ///积分商城 - HomeIntegralStore(gooods), + SizedBox( + height: 28, + ), ///精选活动 FeaturedActivity(), + ///积分商城 + HomeIntegralStore(gooods), + ///积分商品头Tab PointsGoodsTitle( gooodsCategorys, @@ -384,7 +468,7 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { S.of(context).ninxiangjiquanxianweikaiqi, S.of(context).weilekaipaizhaoxuanzhetouxiang, S.of(context).kaiqiquanxian, - (result) async { + (result) async { if (result) { await openAppSettings(); } @@ -395,12 +479,22 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { } else if (await Permission.camera.isGranted) { // http://pos.app.gznl.top/placeorder/?tableId=1315903669597634560&tenantCode=1166&shopId=1300372027722432512 var result = await Navigator.of(context).pushNamed('/router/qr_scan'); + if(result.toString().contains("type\":\"coupon")){ + ///活动优惠券赠送弹窗 + activityShowAlertDialog(result.toString()); + return; + } // String result = await scanner.scan(); Uri uri = Uri.parse(result); String tableId = uri.queryParameters["tableId"]; String tenantCode = uri.queryParameters["tenantCode"]; String shopId = uri.queryParameters["shopId"]; - if (tableId != null && tableId != "" && tenantCode != null && tenantCode != "" && shopId != null && shopId != "") { + if (tableId != null && + tableId != "" && + tenantCode != null && + tenantCode != "" && + shopId != null && + shopId != "") { Navigator.of(context).pushNamed( '/router/store_order', arguments: { @@ -412,7 +506,22 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { ); } } else { - await Permission.camera.request(); + showCupertinoDialog( + context: context, + builder: (context) { + return RequestPermission( + "assets/image/icon_camera_permission_tips.png", + S.of(context).ninxiangjiquanxianweikaiqi, + S.of(context).weilekaipaizhaoxuanzhetouxiang, + S.of(context).kaiqiquanxian, + (result) async { + if (result) { + await Permission.camera.request(); + } + }, + heightRatioWithWidth: 0.82, + ); + }); } } @@ -423,6 +532,16 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { ); } + activityShowAlertDialog(String result) { + //显示对话框 + showDialog( + context: context, + builder: (BuildContext context) { + return ActivityCoupons(result); + }, + ); + } + @override bool get wantKeepAlive => true; } diff --git a/lib/home/home_view/coupon.dart b/lib/home/home_view/coupon.dart index 0f1f42b8..7114a1d7 100644 --- a/lib/home/home_view/coupon.dart +++ b/lib/home/home_view/coupon.dart @@ -87,12 +87,12 @@ class _CouponView extends State { Widget couponItem(Coupon coupon) { return Container( - width: 0.9.sw, + width: 0.9, height: 122.h, child: Stack( children: [ Container( - width: 0.9.sw, + width: 0.9, height: 122.h, child: SvgPicture.asset( "assets/svg/youhuiquan_bg.svg", @@ -102,7 +102,7 @@ class _CouponView extends State { ), ), Container( - width: 0.9.sw, + width: 0.9, height: 122.h, child: Row( children: [ diff --git a/lib/home/home_view/featured_acticvity.dart b/lib/home/home_view/featured_acticvity.dart index dfb3ac54..12324473 100644 --- a/lib/home/home_view/featured_acticvity.dart +++ b/lib/home/home_view/featured_acticvity.dart @@ -78,15 +78,15 @@ class _FeaturedActivity extends State { child: stackItem(18.sp, activityList[0]), margin: EdgeInsets.symmetric(horizontal: 5.w), width: (MediaQuery.of(context).size.width - 42) / 2, - height: 190.h, + height: 125.h, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4), + borderRadius: BorderRadius.circular(6), color: Colors.red, image: DecorationImage( image: NetworkImage( activityList[0].coverImg, ), - fit: BoxFit.fill, + fit: BoxFit.cover, ), ), ), @@ -106,44 +106,44 @@ class _FeaturedActivity extends State { child: stackItem(12.sp, activityList[1]), margin: EdgeInsets.symmetric(horizontal: 5.w), width: (MediaQuery.of(context).size.width - 42) / 2, - height: 190.h / 2, + height:125.h, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4), + borderRadius: BorderRadius.circular(6), color: Colors.green, image: DecorationImage( image: NetworkImage( activityList[1].coverImg, ), - fit: BoxFit.fill, - ), - ), - ), - ), - SizedBox( - height: 5, - ), - GestureDetector( - onTap: () { - Navigator.of(context).pushNamed('/router/web_page', - arguments: {"activityId": activityList[2].id}); - }, - child: Container( - child: stackItem(12.sp, activityList[2]), - margin: EdgeInsets.symmetric(horizontal: 5.w), - width: (MediaQuery.of(context).size.width - 42) / 2, - height: 190.h / 2, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4), - color: Colors.blue, - image: DecorationImage( - image: NetworkImage( - activityList[2].coverImg, - ), - fit: BoxFit.fill, + fit: BoxFit.cover, ), ), ), ), + // SizedBox( + // height: 5, + // ), + // GestureDetector( + // onTap: () { + // Navigator.of(context).pushNamed('/router/web_page', + // arguments: {"activityId": activityList[2].id}); + // }, + // child: Container( + // child: stackItem(12.sp, activityList[2]), + // margin: EdgeInsets.symmetric(horizontal: 5.w), + // width: (MediaQuery.of(context).size.width - 42) / 2, + // height: 190.h / 2, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(4), + // color: Colors.blue, + // image: DecorationImage( + // image: NetworkImage( + // activityList[2].coverImg, + // ), + // fit: BoxFit.fill, + // ), + // ), + // ), + // ), ], ), ), @@ -160,7 +160,10 @@ class _FeaturedActivity extends State { Widget stackItem(double textSize, Activity activity) { return Container( - color: Color.fromARGB(80, 0, 0, 0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6), + color: Color.fromARGB(80, 0, 0, 0), + ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, @@ -176,7 +179,7 @@ class _FeaturedActivity extends State { maxLines: 1, style: TextStyle( fontWeight: MyFontWeight.semi_bold, - fontSize: textSize, + fontSize: 14.sp, color: Colors.white, ), ), @@ -195,7 +198,7 @@ class _FeaturedActivity extends State { ), ), Container( - width: 58.w, + width: 48.w, margin: EdgeInsets.only(left: 8, bottom: 8), padding: EdgeInsets.symmetric( vertical: 4.h, diff --git a/lib/home/home_view/quick_order.dart b/lib/home/home_view/quick_order.dart index b21ff508..34ea054d 100644 --- a/lib/home/home_view/quick_order.dart +++ b/lib/home/home_view/quick_order.dart @@ -160,7 +160,7 @@ class _QuickOrder extends State { children: [ ItemTitle( text: "店铺推荐", - imgPath: "assets/image/icon_points_mall.png", + imgPath: "assets/image/icon_shop.png", ), Container( height: 170, diff --git a/lib/home/home_view/shortcut_operation.dart b/lib/home/home_view/shortcut_operation.dart index 771ae260..5f97060a 100644 --- a/lib/home/home_view/shortcut_operation.dart +++ b/lib/home/home_view/shortcut_operation.dart @@ -121,7 +121,7 @@ class _ShortcutOperation extends State { ), SizedBox(height: 5), Text( - "充值送会员!", + "会员享有赠送!", style: TextStyle( fontWeight: MyFontWeight.regular, fontSize: 12.sp, diff --git a/lib/home/points_mall_view/points_goods_title.dart b/lib/home/points_mall_view/points_goods_title.dart index a28e59c3..e9b12d45 100644 --- a/lib/home/points_mall_view/points_goods_title.dart +++ b/lib/home/points_mall_view/points_goods_title.dart @@ -3,6 +3,7 @@ import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/goods_category.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/item_title.dart'; import 'package:huixiang/view_widget/my_tab.dart'; class PointsGoodsTitle extends StatefulWidget { @@ -41,6 +42,10 @@ class _PointsGoodsTitle extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ + ItemTitle( + text: S.of(context).jifenshangcheng, + imgPath: "assets/image/icon_points_mall.png", + ), // ItemTitle( // text: S.of(context).jifenshangcheng, // imgPath: "assets/image/icon_points_mall.png", diff --git a/lib/integral/integral_detailed_page.dart b/lib/integral/integral_detailed_page.dart index c943880c..390dcd7c 100644 --- a/lib/integral/integral_detailed_page.dart +++ b/lib/integral/integral_detailed_page.dart @@ -10,6 +10,7 @@ import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/my_tab.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; diff --git a/lib/login/login_page.dart b/lib/login/login_page.dart index 76349a7b..e3b2f5ff 100644 --- a/lib/login/login_page.dart +++ b/lib/login/login_page.dart @@ -342,7 +342,7 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { Navigator.of(context).pushNamedAndRemoveUntil( '/router/main_page', (route) => false,arguments:{"invite":invite,"interviewCouponList":value.data.interviewCouponList, - "newUserCouponList":value.data.newUserCouponList}); + "firstLoginCouponList":value.data.firstLoginCouponList}); EasyLoading.dismiss(); } else { @@ -512,20 +512,16 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { ), ), ), - Column( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/image/icon_login_logo.png", - width: 91.w, - height: 91.h, - ), - SizedBox( - height: 0.596.sh, - ), - ], - ), + Container( + height: MediaQuery.of(context).size.height * 0.78, + margin: EdgeInsets.only(top: 56.h), + alignment: Alignment.topCenter, + child:Image.asset( + "assets/image/icon_login_logo.png", + width: 91.w, + height: 91.h, + ), + ) ], ), ), diff --git a/lib/main.dart b/lib/main.dart index 74dff435..4fa43925 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -62,6 +62,7 @@ import 'package:huixiang/store/store_order.dart'; import 'package:huixiang/settlement/settlement.dart'; import 'package:huixiang/test_page.dart'; import 'package:huixiang/union/location_map_page.dart'; +import 'package:huixiang/utils/ImgCachePath.dart'; import 'package:huixiang/web/web_page.dart'; import 'package:huixiang/union/union_details_page.dart'; @@ -77,10 +78,12 @@ import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'community/community_view/class_details.dart'; import 'community/headlines/headlines_column_details.dart'; +import 'community/new_community_details.dart'; import 'community/photo_view_gallery_screen.dart'; import 'home/guide_page.dart'; import 'home/home_view/activity_list.dart'; import 'main_page.dart'; +import 'message/system_details.dart'; import 'mine/manage_address_page.dart'; import 'mine/mine_view/community_follow.dart'; import 'mine/mine_vip/binding_assistant_card.dart'; @@ -105,10 +108,11 @@ void main() async { Locale locale; if (sharedPreferences.containsKey("language") && sharedPreferences.getString("language") == "zh") { - locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'CN'); - } else { locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW'); + } else { + locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'CH'); } + ImgCachePath(); initSdk(); bool isFirst = sharedPreferences.getBool("isFirst"); @@ -319,6 +323,8 @@ Map routers = { '/router/release_dynamic': (context, {arguments}) => ReleaseDynamic(), '/router/community_details': (context, {arguments}) => CommunityDetails(arguments: arguments), + '/router/new_community_details': (context, {arguments}) => + NewCommunityDetails(arguments: arguments), '/router/user_info_page': (context, {arguments}) => UserInfoPage(), '/router/recharge_page': (context, {arguments}) => RechargePage(), '/router/mine_wallet': (context, {arguments}) => MineWalletPage(), @@ -352,4 +358,6 @@ Map routers = { GroupPageDetails(arguments:arguments), '/router/photo_view_gallery_screen': (context, {arguments}) => PhotoViewGalleryScreen(), + '/router/system_details': (context, {arguments}) => + SystemDetails(arguments:arguments), }; diff --git a/lib/main_page.dart b/lib/main_page.dart index 0e31968a..e38f1926 100644 --- a/lib/main_page.dart +++ b/lib/main_page.dart @@ -82,15 +82,15 @@ class _MainPage extends State with WidgetsBindingObserver { String invite = ""; var interviewCouponList; - var newUserCouponList; + var firstLoginCouponList; if(widget.arguments != null && (widget.arguments["invite"]??"") != "" && widget.arguments["interviewCouponList"] != null ){ invite = widget.arguments["invite"]; interviewCouponList = widget.arguments["interviewCouponList"]; } - if(widget.arguments != null && widget.arguments["newUserCouponList"] != null ){ - newUserCouponList = widget.arguments["newUserCouponList"]; + if(widget.arguments != null && widget.arguments["firstLoginCouponList"] != null ){ + firstLoginCouponList = widget.arguments["firstLoginCouponList"]; } _widgetOptions = [ @@ -99,7 +99,7 @@ class _MainPage extends State with WidgetsBindingObserver { setState(() { pageController.jumpToPage(index); }); - },invite:invite,interviewCouponList:interviewCouponList,newUserCouponList:newUserCouponList,), + },invite:invite,interviewCouponList:interviewCouponList,firstLoginCouponList:firstLoginCouponList,), // MainHomePage(), UnionPage(), CommunityPage(), @@ -196,11 +196,11 @@ class _MainPage extends State with WidgetsBindingObserver { Map params = {}; switch (pushMap["typed"]) { case 1: - routeName = "/router/store_detail_page"; + routeName = "/router/web_page"; params["articleId"] = pushMap["info"]; break; case 2: - routeName = "/router/store_detail_page"; + routeName = "/router/web_page"; params["activityId"] = pushMap["info"]; break; case 3: diff --git a/lib/message/system_details.dart b/lib/message/system_details.dart new file mode 100644 index 00000000..af482424 --- /dev/null +++ b/lib/message/system_details.dart @@ -0,0 +1,1106 @@ +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/article.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/message.dart'; +import 'package:huixiang/retrofit/data/page.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/comment_menu.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; +import 'package:huixiang/view_widget/round_button.dart'; +import 'package:huixiang/web/web_view/comment_list.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class SystemDetails extends StatefulWidget { + final Map arguments; + + SystemDetails({this.arguments}); + @override + State createState() { + return _SystemDetails(); + } +} + +class _SystemDetails extends State { + ApiService apiService; + int pageNum = 1; + List messages = []; + int msgType = 0; + // String parenId = "0"; + var commentFocus = FocusNode(); + String hintText = S.current.liuxianinjingcaidepinglunba; + bool isKeyBoardShow = false; + final GlobalKey commentKey = GlobalKey(); + final GlobalKey inputKey = GlobalKey(); + final TextEditingController commentTextController = TextEditingController(); + int indexMsg = 0; + + + @override + void initState() { + super.initState(); + msgType = widget.arguments["msgType"]; + + SharedPreferences.getInstance().then((value) { + apiService = + ApiService(Dio(), token: value.getString("token"), context: context); + queryMessage(); + }); + } + + + _refresh() { + pageNum = 1; + queryMessage(); + } + + queryMessage() async { + BaseData> baseData = await apiService.msgList({ + "pageNum": pageNum, + "pageSize": 10, + "searchKey": "", + "state": "", + "typed": msgType + }).catchError((onError) { + _refreshController.loadFailed(); + _refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + if (pageNum == 1) { + messages.clear(); + } + messages.addAll(baseData.data.list); + _refreshController.loadComplete(); + _refreshController.refreshCompleted(); + if (mounted) setState(() {}); + if (pageNum * 10 > int.tryParse(baseData.data.total)) { + _refreshController.loadNoData(); + } else { + pageNum += 1; + } + } else { + _refreshController.loadFailed(); + _refreshController.refreshFailed(); + } + } + + //关注/取关会员 + _vipFollow(followId,isFollow) async { + BaseData baseData = await apiService.follow(followId); + if (baseData != null && baseData.isSuccess) { + // widget.refresh(); + queryMessage(); + SmartDialog.showToast(isFollow?"取关成功":"关注成功", alignment: Alignment.center); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + + ///评论 回复 + _reply(messageRelational) { + var messageRelational = jsonDecode(messages[indexMsg].relational); + messageRelational["additionId"].toString(); + hintText = S.of(context).huifu_("${messageRelational["nickname"]}"); + } + + ///动态发布评论 + _queryMemberComment(String content) async { + var messageRelational = jsonDecode(messages[indexMsg].relational); + BaseData baseData = await apiService.memberComment({ + "content": content, + "parentId": messageRelational["additionId"].toString(), + "relationalId":messageRelational["businessId"].toString(), + "relationalType":4 + }).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + commentTextController.text = ""; + FocusScope.of(context).unfocus(); + Navigator.of(context).pop(); + SmartDialog.showToast("发布成功", alignment: Alignment.center); + } + else{ + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + + RefreshController _refreshController = RefreshController(); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppBar( + background: Colors.white, + leadingColor: Colors.black, + title: (msgType == 2) ?"订单通知":(msgType == 3) ?"充值消息":(msgType == 4) ?"关注":(msgType == 5) ?"点赞":"评论", + titleSize: 18.sp, + titleColor: Colors.black, + ), + body:SmartRefresher( + enablePullDown: true, + enablePullUp: true, + header: MyHeader(), + physics: BouncingScrollPhysics(), + footer: CustomFooter( + loadStyle: LoadStyle.ShowWhenLoading, + builder: (BuildContext context, LoadStatus mode) { + return (messages.length == 0)?Container():MyFooter(mode); + }, + ), + controller: _refreshController, + onRefresh: _refresh, + onLoading: () { + queryMessage(); + }, + child: + Container( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: + Container( + child: Column( + children: [ + if(msgType == 2) + orderMessage(), + if(msgType == 3) + rechargeMessage(), + if(msgType == 5) + fabulousMessage(), + if(msgType == 6) + commentMessage(), + if(msgType == 4) + followMessage(), + ], + ), + ), + ), + ), + ), + ); + } + + ///订单通知 + Widget orderMessage(){ + return Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.only(top:10.h,bottom:20.h,left: 20.w,right: 20.w), + child:Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (messages == null || messages.length == 0) + ? NoDataView( + isShowBtn: false, + text: S.of(context).haimeiyouxiaoxi, + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ) + : ListView.builder( + padding: EdgeInsets.only(top: 16), + itemCount: messages.length, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + // if (messages[position].typed == 2) { + // Navigator.of(context) + // .pushNamed('/router/exchange_order_details'); + // } + }, + child: orderMessageItem(messages[position]), + ); + }), + ], + ) + ); + } + Widget orderMessageItem(Message message) { + return Container( + margin: EdgeInsets.only(top: 8.h, bottom: 8.h), + child: + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + children: [ + Image.asset( + (message.typed == 1) + ? "assets/image/icon_system_message.png" + : (message.typed == 2) + ? "assets/image/icon_system_message.png" + : "assets/image/c_z.png", + width: 24.w, + height: 24.h, + ), + SizedBox( + width:8.w, + ), + Text( + (message.typed == 1) + ? S.of(context).xitongtongzhi + : (message.typed == 2) + ? S.of(context).dingdanxiaoxi + : S.of(context).chongzhixiaoxi, + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.bold, + color: Color(0xFF060606), + ), + ) + ], + ), + Text( + message.updateTime, + style: TextStyle( + fontSize: 10.sp, + color: Color(0xFFA29E9E), + ), + ), + ], + ), + Container( + width: double.infinity, + margin: EdgeInsets.only(left:30.w, top:20.h), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded(child: Text( + message.content, + maxLines: 2, + overflow:TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF353535), + ), + ),), + Icon( + Icons.keyboard_arrow_right, + color: Colors.black, + ) + ], + ), + Container( + margin: EdgeInsets.only(top: 14.h), + height: 1, + width: double.infinity, + color: Color(0XFFF7F7F7), + ) + ], + ), + ) + ], + ), + ); + } + + ///充值消息通知 + Widget rechargeMessage(){ + return Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.only(top:10.h,bottom:20.h,left: 20.w,right: 20.w), + child:Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (messages == null || messages.length == 0) + ? NoDataView( + isShowBtn: false, + text: S.of(context).haimeiyouxiaoxi, + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ) + : ListView.builder( + padding: EdgeInsets.only(top: 16), + itemCount: messages.length, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + // if (messages[position].typed == 2) { + // Navigator.of(context) + // .pushNamed('/router/exchange_order_details'); + // } + }, + child: rechargeMessageItem(messages[position]), + ); + }), + ], + ) + ); + } + Widget rechargeMessageItem(Message message) { + return Container( + margin: EdgeInsets.only(top: 8.h, bottom: 8.h), + child: + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + children: [ + Image.asset( + (message.typed == 1) + ? "assets/image/icon_system_message.png" + : (message.typed == 2) + ? "assets/image/icon_system_message.png" + : "assets/image/c_z.png", + width: 24.w, + height: 24.h, + ), + SizedBox( + width:8.w, + ), + Text( + (message.typed == 1) + ? S.of(context).xitongtongzhi + : (message.typed == 2) + ? S.of(context).dingdanxiaoxi + : "充值通知", + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.bold, + color: Color(0xFF060606), + ), + ) + ], + ), + Text( + message.updateTime, + style: TextStyle( + fontSize: 10.sp, + color: Color(0xFFA29E9E), + ), + ), + ], + ), + Container( + width: double.infinity, + margin: EdgeInsets.only(left:30.w, top:20.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "充值成功", + style: TextStyle( + fontSize: 20.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF353535), + ), + ), + SizedBox(height:8.h,), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded(child: Text( + message.content, + maxLines: 2, + overflow:TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF353535), + ), + ),), + Icon( + Icons.keyboard_arrow_right, + color: Colors.black, + ) + ], + ), + Container( + margin: EdgeInsets.only(top: 14.h), + height: 1, + width: double.infinity, + color: Color(0XFFF7F7F7), + ) + ], + ), + ) + ], + ), + ); + } + + ///点赞通知 + Widget fabulousMessage(){ + return Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.only(bottom:20.h,left: 20.w,right: 20.w), + child:Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (messages == null || messages.length == 0) + ? NoDataView( + isShowBtn: false, + text: S.of(context).haimeiyouxiaoxi, + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ) + : ListView.builder( + padding: EdgeInsets.only(top: 16), + itemCount: messages.length, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/community_details', + arguments: { + "businessId":jsonDecode(messages[position].relational)["businessId"].toString(), + "mid":messages[position].mid + }, + ); + }, + child: fabulousMessageItem(messages[position]), + ); + }), + ], + ) + ); + } + Widget fabulousMessageItem(Message message) { + var messageRelational = jsonDecode(message.relational); + return Container( + child: + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MImage( + messageRelational["avatar"] ?? "", + width: 44, + height: 44, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + SizedBox(width: 8,), + Expanded(child:Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + messageRelational["nickname"] ?? "", + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 14.sp, + color: Color(0xFF1A1A1A)) + ), + SizedBox(width:8.w,), + Text( + "点赞了", + style:TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Color(0xFF32A060), + ), + ), + ], + ), + SizedBox(height: 8,), + Text( + message.updateTime, + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFFA29E9E), + ), + ), + SizedBox(height:12.h,), + Container( + width: double.infinity, + color:Color(0xFFF2F2F2), + padding:EdgeInsets.all(5), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // Text( + // "我的评论:", + // style: TextStyle( + // fontSize: 12.sp, + // height: 1.3, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFF1A1A1A), + // ), + // ), + MImage( + messageRelational["nickname"] , + width: 38, + height: 38, + isCircle: true, + fit: BoxFit.cover, + radius: BorderRadius.circular(2), + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + SizedBox(width:2.w), + Expanded(child:Text( + messageRelational["content"], + maxLines: 2, + overflow:TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + height: 1.3, + fontWeight: MyFontWeight.regular, + color: Color(0xFF808080), + ), + ),) + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 16.h,bottom:16.h), + height: 1.h, + width: double.infinity, + color: Color(0xFFF7F7F7), + ), + ], + )), + ], + ), + ); + } + + ///评论通知 + Widget commentMessage(){ + return Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.only(bottom:20.h,left: 20.w,right: 20.w), + child:Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (messages == null || messages.length == 0) + ? NoDataView( + isShowBtn: false, + text: S.of(context).haimeiyouxiaoxi, + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ) + : ListView.builder( + padding: EdgeInsets.only(top: 16), + itemCount: messages.length, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/community_details', + arguments: { + "businessId":jsonDecode(messages[position].relational)["businessId"].toString(), + "mid":messages[position].mid + }, + ); + }, + child: commentMessageItem(messages[position],position), + ); + }), + ], + ) + ); + } + Widget commentMessageItem(Message message,index) { + var messageRelational = jsonDecode(message.relational); + return Container( + child: + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MImage( + messageRelational["avatar"], + width: 44, + height: 44, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + SizedBox(width: 8,), + Expanded(child:Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded(child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + messageRelational["nickname"], + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 14.sp, + color: Color(0xFF1A1A1A)) + ), + SizedBox(width:8.w,), + Text( + "评论了", + style:TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Color(0xFF32A060), + ), + ), + ], + ), + SizedBox(height: 8,), + Text( + message.updateTime, + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFFA29E9E), + ), + ), + ], + ),), + GestureDetector( + onTap: (){ + setState(() { + indexMsg = index; + showDeleteDialog(); + _reply(messageRelational); + }); + }, + child: Container( + height:22.h, + width: 40.w, + padding:EdgeInsets.only(left:2,right:2), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(11), + border: Border.all( + width: 1, + color: Color(0xFF00A359), + style: BorderStyle.solid, + ), + ), + child: Text( + "回复", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF00A359), + ), + ), + ), + ) + ], + ), + SizedBox(height:8.h,), + // Text( + // messageRelational["content"], + // maxLines: 2, + // overflow: TextOverflow.ellipsis, + // style: TextStyle( + // fontSize: 12.sp, + // height: 1.3, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFF1A1A1A), + // ), + // ), + // SizedBox(height:12.h,), + // Container( + // width: double.infinity, + // color:Color(0xFFF2F2F2), + // padding:EdgeInsets.all(5), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // "我的评论:", + // style: TextStyle( + // fontSize: 12.sp, + // height: 1.3, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFF1A1A1A), + // ), + // ), + // // MImage( + // // "", + // // width: 38, + // // height: 38, + // // isCircle: true, + // // fit: BoxFit.cover, + // // radius: BorderRadius.circular(2), + // // errorSrc: "assets/image/default_1.png", + // // fadeSrc: "assets/image/default_1.png", + // // ), + // SizedBox(width:2.w), + // Expanded(child:Text( + // "文本,是指书面语言的表现形式文本,文本,是指书面语言的表现形式文本。", + // maxLines: 2, + // overflow:TextOverflow.ellipsis, + // style: TextStyle( + // fontSize: 12.sp, + // height: 1.3, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFF808080), + // ), + // ),) + // ], + // ), + // ), + Container( + width: double.infinity, + color:Color(0xFFF2F2F2), + padding:EdgeInsets.all(5), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // Text( + // "我的评论:", + // style: TextStyle( + // fontSize: 12.sp, + // height: 1.3, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFF1A1A1A), + // ), + // ), + MImage( + messageRelational["nickname"], + width: 38, + height: 38, + isCircle: true, + fit: BoxFit.cover, + radius: BorderRadius.circular(2), + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + SizedBox(width:2.w), + Expanded(child:Text( + messageRelational["content"], + maxLines: 2, + overflow:TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + height: 1.3, + fontWeight: MyFontWeight.regular, + color: Color(0xFF808080), + ), + ),) + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 16.h,bottom:16.h), + height: 1.h, + width: double.infinity, + color: Color(0xFFF7F7F7), + ), + ], + )), + ], + ), + ); + } + + ///关注通知 + Widget followMessage(){ + return Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.only(bottom:20.h,left: 20.w,right: 20.w), + child:Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (messages == null || messages.length == 0) + ? NoDataView( + isShowBtn: false, + text: S.of(context).haimeiyouxiaoxi, + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ) + : ListView.builder( + padding: EdgeInsets.only(top: 16), + itemCount: messages.length, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + // if (messages[position].typed == 2) { + // Navigator.of(context) + // .pushNamed('/router/exchange_order_details'); + // } + }, + child: followMessageItem(messages[position]), + ); + }), + ], + ) + ); + } + Widget followMessageItem(Message message) { + var messageRelational = jsonDecode(message.relational); + if(message.relational.startsWith("{")) + return Container( + child: + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + MImage( + messageRelational["avatar"], + width: 44, + height: 44, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + SizedBox(width: 8,), + Expanded(child:Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded(child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + messageRelational["nickname"], + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 14.sp, + color: Color(0xFF1A1A1A)) + ), + SizedBox(width:8.w,), + Text( + "关注了你", + style:TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Color(0xFF32A060), + ), + ), + ], + ), + SizedBox(height: 8,), + Text( + message.updateTime, + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFFA29E9E), + ), + ), + ], + ),), + GestureDetector( + onTap: (){ + setState(() { + _vipFollow(messageRelational["mid"].toString(),message?.followed ?? false); + }); + }, + child: + RoundButton( + height: 21.h, + width:56.w, + padding: EdgeInsets.all(2), + backgroup: (message?.followed ?? false) + ? Color(0xFFE6E6E6) + : Color(0xFF32A060), + textColor: (message?.followed ?? false) + ? Color(0xFF808080) + : Colors.white, + text: (message?.followed ?? false) ? "已关注" : "回关", + radius:20, + icons: Icon( + (message?.followed ?? false) + ? Icons.check + : Icons.add, + color: (message?.followed?? false) + ? Color(0xFF808080) + : Colors.white, + size: 12, + ), + ) + // Container( + // height: 21.h, + // width:56.w, + // padding:EdgeInsets.only(left:5,right:5), + // alignment: Alignment.center, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(11), + // border: Border.all( + // width: 1, + // color: Color(0xFF00A359), + // style: BorderStyle.solid, + // ), + // color: (message?.followed ?? false) + // ? Color(0xFFE6E6E6) + // : Color(0xFF32A060), + // ), + // child: Row( + // children: [ + // Icon((message?.followed ?? false) + // ? Icons.check + // : Icons.add, + // color:(message?.followed?? false) + // ? Color(0xFF808080) + // : Colors.white, + // size: 16, + // ), + // Text( + // (message?.followed ?? false) ? "已关注" : "回关", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.medium, + // color:(message?.followed ?? false) + // ? Color(0xFF808080) + // : Colors.white, + // ), + // ), + // ], + // ), + // ) + ), + ], + ), + SizedBox(height:8.h,), + Container( + margin: EdgeInsets.only(top: 16.h,bottom:16.h), + height: 1.h, + width: double.infinity, + color: Color(0xFFF7F7F7), + ), + ], + )), + ], + ), + ); + } + + ///动态弹窗 + showDeleteDialog() { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + content: Container( + height: 150.h, + // padding: EdgeInsets.all(16), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 2), + blurRadius: 14, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.vertical( + top: Radius.circular(8), + ), + ), + child: Row( + children: [ + Expanded( + flex: 1, + child: Container( + decoration: BoxDecoration( + color: Color(0xffF2F2F2), + borderRadius: BorderRadius.circular(2.0), + ), + child: Container( + margin: EdgeInsets.symmetric(horizontal: 4.w), + alignment: Alignment.topLeft, + child: TextField( + maxLines: 8, + minLines: 1, + focusNode:commentFocus, + controller:commentTextController, + decoration: InputDecoration( + border: InputBorder.none, + hintText:hintText, + hintStyle: TextStyle( + fontSize: 14.sp, + color: Color(0xFF868686), + ), + ), + ), + ), + ), + ), + if (!isKeyBoardShow) + GestureDetector( + onTap: () { + setState(() { + var commentText = commentTextController.text; + if (commentText.trim() == "") { + return; + } + _queryMemberComment(commentText); + }); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 20.w), + child: Text( + S.of(context).fasong, + style: TextStyle( + fontSize: 16.sp, + fontWeight: FontWeight.bold, + color: Color(0XFF1A1A1A), + ), + ), + ), + ), + ], + ), + ), + ); + }, + ); + } +} diff --git a/lib/message/system_message.dart b/lib/message/system_message.dart index f880c5e0..f8276451 100644 --- a/lib/message/system_message.dart +++ b/lib/message/system_message.dart @@ -1,8 +1,10 @@ import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/message.dart'; +import 'package:huixiang/retrofit/data/msg_stats.dart'; import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; @@ -10,6 +12,7 @@ import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/no_data_view.dart'; +import 'package:huixiang/view_widget/round_button.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -23,6 +26,17 @@ class SystemMessagePage extends StatefulWidget { class _SystemMessagePage extends State { ApiService apiService; + int pageNum = 1; + List messages = []; + Map msgNumber = { + "1":0, + "2":0, + "3":0, + "4":0, + "5":0, + "6":0, + }; + int state = 0; @override void initState() { @@ -32,15 +46,14 @@ class _SystemMessagePage extends State { apiService = ApiService(Dio(), token: value.getString("token"), context: context); queryMessage(); + queryMsgStats(); }); } - int pageNum = 1; - List messages = []; - _refresh() { pageNum = 1; queryMessage(); + queryMsgStats(); } queryMessage() async { @@ -59,7 +72,13 @@ class _SystemMessagePage extends State { if (pageNum == 1) { messages.clear(); } - messages.addAll(baseData.data.list); + List message = []; + message.addAll(baseData.data.list); + message.forEach((element) { + if(element.typed==2 || element.typed==3){ + messages.add(element); + } + }); _refreshController.loadComplete(); _refreshController.refreshCompleted(); if (mounted) setState(() {}); @@ -74,17 +93,65 @@ class _SystemMessagePage extends State { } } + queryMsgStats() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = await apiService.stats().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + msgNumber.forEach((key, value) { + msgNumber[key] = 0; + }); + baseData.data.forEach((element) { + if(msgNumber.containsKey(element.name)){ + msgNumber[element.name] = element.number; + } + }); + }); + _refreshController.loadComplete(); + _refreshController.refreshCompleted(); + } + EasyLoading.dismiss(); + } + RefreshController _refreshController = RefreshController(); @override Widget build(BuildContext context) { return Scaffold( appBar: MyAppBar( - background: Color(0xFFF7F7F7), + background: Colors.white, leadingColor: Colors.black, - title: S.of(context).xitongxiaoxi, + title: S.of(context).xiaoxi, titleSize: 18.sp, titleColor: Colors.black, + actions: [ + Container( + margin: EdgeInsets.only(right: 16.w), + alignment: Alignment.centerRight, + child: GestureDetector( + onTap: () { + setState(() { + queryMsgStats(); + }); + }, + child: Text( + "标为已读", + style: TextStyle( + fontSize: 16.sp, + fontWeight:MyFontWeight.semi_bold, + color: Color(0xFF353535), + ), + ), + ), + ), + ], ), body: SmartRefresher( enablePullDown: true, @@ -94,159 +161,490 @@ class _SystemMessagePage extends State { footer: CustomFooter( loadStyle: LoadStyle.ShowWhenLoading, builder: (BuildContext context, LoadStatus mode) { - return MyFooter(mode); + return (messages.length == 0)?Container():MyFooter(mode); }, ), controller: _refreshController, onRefresh: _refresh, onLoading: () { - queryMessage(); + setState(() { + _refresh(); + }); }, - child: (messages == null || messages.length == 0) - ? NoDataView( - isShowBtn: false, - text: S.of(context).haimeiyouxiaoxi, - fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h), - ) - : ListView.builder( - padding: EdgeInsets.only(top: 16), - itemCount: messages.length, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - if (messages[position].typed == 2) { - Navigator.of(context) - .pushNamed('/router/exchange_order_details'); - } - }, - child: buildMessageItem(messages[position]), - ); - }), + child: Container( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + child: Column( + children: [ + newsSurvey(), + SizedBox(height: 16.h,), + buildMessage(), + ], + ), + ), + ), + ), + ), ); } - Widget buildMessageItem(Message message) { + Widget newsSurvey(){ return Container( - margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 8.h, bottom: 8.h), - padding: EdgeInsets.all(20.w), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, + color: Colors.white, + padding: EdgeInsets.only(top: 16.h,bottom: 16.h), + child: Row( + children: [ + Expanded(child: GestureDetector( + onTap: (){ + Navigator.of(context) + .pushNamed('/router/system_details',arguments: {"msgType":5}); + }, + child:Column( + children: [ + Stack( + children: [ + Image.asset( + "assets/image/icon_z.png", + width: 40, + height: 40, + ), + if(msgNumber["5"].toString() != "0") + Container( + width:48, + alignment: Alignment.topRight, + child:Container( + width:20, + height:17, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all( + width: 1, + color: Colors.white, + style: BorderStyle.solid, + ), + color:Color(0xFFFF441A), + ), + child:RoundButton( + text:msgNumber["5"].toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize:8.sp, + radius: 100, + ) + ), + ) + ], + ), + SizedBox(height: 6.h), + Text( + "点赞", + style: TextStyle( + fontSize: 14.sp, + fontWeight:MyFontWeight.medium, + color: Color(0xFF060606), + ), + ) + ], + ) ) + ), + Expanded(child: + GestureDetector( + onTap: (){ + Navigator.of(context) + .pushNamed('/router/system_details',arguments: {"msgType":6}); + }, + child: Column( + children: [ + Stack( + children: [ + Image.asset( + "assets/image/icon_pl.png", + width: 40, + height: 40, + ), + if(msgNumber["6"].toString() != "0") + Container( + width:48, + alignment: Alignment.topRight, + child:Container( + width:16, + height:16, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all( + width: 1, + color: Colors.white, + style: BorderStyle.solid, + ), + color:Color(0xFFFF441A), + ), + child:RoundButton( + text: msgNumber["6"].toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize:8.sp, + radius: 100, + ) + ), + ) + ], + ), + SizedBox(height: 6.h), + Text( + S.of(context).pinglun, + style: TextStyle( + fontSize: 14.sp, + fontWeight:MyFontWeight.medium, + color: Color(0xFF060606), + ), + ), + ], + ) + )), + Expanded(child: + GestureDetector( + onTap: (){ + Navigator.of(context) + .pushNamed('/router/system_details',arguments: {"msgType":4}); + }, + child:Column( + children: [ + Stack( + children: [ + Image.asset( + "assets/image/icon_gz.png", + width: 40, + height: 40, + ), + if(msgNumber["4"].toString() != "0") + Container( + width:48, + alignment: Alignment.topRight, + child:Container( + width:16, + height:16, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all( + width: 1, + color: Colors.white, + style: BorderStyle.solid, + ), + color:Color(0xFFFF441A), + ), + child:RoundButton( + text: msgNumber["4"].toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize:8.sp, + radius: 100, + ) + ), + ) + ], + ), + SizedBox(height: 6.h), + Text( + S.of(context).guanzhu, + style: TextStyle( + fontSize: 14.sp, + fontWeight:MyFontWeight.medium, + color: Color(0xFF060606), + ), + ), + ], + ) + ) + ), ], - borderRadius: BorderRadius.circular(8), ), + ); + } + + Widget buildMessage(){ + return Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.all(20.w), + child:Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + S.of(context).xitongxiaoxi, + style: TextStyle( + fontSize: 16.sp, + fontWeight:MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + (messages == null || messages.length == 0) + ? NoDataView( + isShowBtn: false, + text: S.of(context).haimeiyouxiaoxi, + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ) + :ListView.builder( + padding: EdgeInsets.only(top: 16), + itemCount: messages.length, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + if(messages[position].typed == 2) + Navigator.of(context) + .pushNamed('/router/system_details',arguments: {"msgType":2}); + else if(messages[position].typed == 3) + Navigator.of(context) + .pushNamed('/router/system_details',arguments: {"msgType":3}); + }, + child: buildMessageItem(messages[position]), + ); + }), + ], + ) + ); + } + + Widget buildMessageItem(Message message) { + return Container( + margin: EdgeInsets.only(top: 8.h, bottom: 8.h), + // margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 8.h, bottom: 8.h), + // padding: EdgeInsets.all(20.w), + // decoration: BoxDecoration( + // color: Colors.white, + // boxShadow: [ + // BoxShadow( + // color: Colors.black.withAlpha(12), + // offset: Offset(0, 3), + // blurRadius: 14, + // spreadRadius: 0, + // ) + // ], + // borderRadius: BorderRadius.circular(8), + // ), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - Image.asset( - (message.typed == 1) - ? "assets/image/icon_system_notices.png" - : (message.typed == 2) - ? "assets/image/icon_system_order.png" - : "assets/image/icon_system_recharge.png", - width: 24.w, - height: 24.h, - ), - SizedBox( - width: 4.w, - ), - Text( - (message.typed == 1) - ? S.of(context).xitongtongzhi - : (message.typed == 2) - ? S.of(context).dingdanxiaoxi - : S.of(context).chongzhixiaoxi, - style: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.bold, - color: Color(0xFF060606), - ), - ) - ], + Image.asset( + (message.typed == 1) + ? "assets/image/icon_system_message.png" + : (message.typed == 2) + ? "assets/image/icon_system_message.png" + : "assets/image/c_z.png", + width: 40.w, + height: 40.h, ), - Text( - message.updateTime, - style: TextStyle( - fontSize: 10.sp, - color: Color(0xFFA29E9E), - ), + SizedBox( + width:12.w, ), - ], - ), - if (message.typed != 3) - Container( - margin: EdgeInsets.only(left: 28.w, top: 12.h), - child: Text( - S.of(context).ninyouyigexindedingdan, - style: TextStyle( - fontSize: 10.sp, - color: Color(0xFF353535), - ), - ), - ) - else - Container( - margin: EdgeInsets.only(left: 28.w, top: 18.h), - child: Text( - message.title, - style: TextStyle( - fontSize: 20.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFF353535), - ), - ), - ), - if (message.typed != 3) - Container( - margin: EdgeInsets.only(left: 28.w, top: 22.h), - child: Row( + Expanded(child:Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - S.of(context).chakangengduo, - style: TextStyle( - fontSize: 12.sp, - fontWeight: FontWeight.bold, - color: Color(0xFF353535), - ), + Row( + children: [ + Expanded(child:Text( + (message.typed == 1) + ? S.of(context).xitongtongzhi + : (message.typed == 2) + ? S.of(context).dingdanxiaoxi + : S.of(context).chongzhixiaoxi, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF060606), + ), + )), + Text( + message.updateTime, + style: TextStyle( + fontSize: 10.sp, + color: Color(0xFFA29E9E), + ), + ), + ], + ), + SizedBox(height:4.h,), + (message.typed != 3) ? + Row( + mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded(child: + Text( + S.of(context).ninyouyigexindedingdan, + style: TextStyle( + fontSize: 10.sp, + color: Color(0xFF353535), + ), + ),), + if(msgNumber["2"].toString() != "0") + RoundButton( + width: 16, + height: 16, + text:msgNumber["2"].toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize:10.sp, + radius: 100, + ), + ], + ): + Row( + mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded(child: + Text( + message.content, + style: TextStyle( + fontSize: 10.sp, + color: Color(0xFF353535), + ), + )), + if(msgNumber["3"].toString() != "0") + RoundButton( + width: 16, + height: 16, + text:msgNumber["3"].toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize:10.sp, + radius: 100, + ), + ], ), - Icon( - Icons.keyboard_arrow_right, - color: Colors.black, - ) ], - ), - ) - else - Container( - margin: EdgeInsets.only(left: 28.w, top: 22.h), - child: Text( - message.content, - style: TextStyle( - fontSize: 10.sp, - color: Color(0xFF353535), - ), - ), - ), + )), + ], + ), + Container( + margin: EdgeInsets.only(top: 16.h,bottom:8.h), + height: 1.h, + width: double.infinity, + color: Color(0xFFF7F7F7), + ), ], ), + // Column( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Row( + // children: [ + // Image.asset( + // (message.typed == 1) + // ? "assets/image/icon_system_notices.png" + // : (message.typed == 2) + // ? "assets/image/icon_system_order.png" + // : "assets/image/icon_system_recharge.png", + // width: 24.w, + // height: 24.h, + // ), + // SizedBox( + // width: 4.w, + // ), + // Text( + // (message.typed == 1) + // ? S.of(context).xitongtongzhi + // : (message.typed == 2) + // ? S.of(context).dingdanxiaoxi + // : S.of(context).chongzhixiaoxi, + // style: TextStyle( + // fontSize: 14.sp, + // fontWeight: FontWeight.bold, + // color: Color(0xFF060606), + // ), + // ) + // ], + // ), + // Text( + // message.updateTime, + // style: TextStyle( + // fontSize: 10.sp, + // color: Color(0xFFA29E9E), + // ), + // ), + // ], + // ), + // if (message.typed != 3) + // Container( + // margin: EdgeInsets.only(left: 28.w, top: 12.h), + // child: Text( + // S.of(context).ninyouyigexindedingdan, + // style: TextStyle( + // fontSize: 10.sp, + // color: Color(0xFF353535), + // ), + // ), + // ) + // else + // Container( + // margin: EdgeInsets.only(left: 28.w, top: 18.h), + // child: Text( + // message.title, + // style: TextStyle( + // fontSize: 20.sp, + // fontWeight: MyFontWeight.semi_bold, + // color: Color(0xFF353535), + // ), + // ), + // ), + // if (message.typed != 3) + // Container( + // margin: EdgeInsets.only(left: 28.w, top: 22.h), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Text( + // S.of(context).chakangengduo, + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: FontWeight.bold, + // color: Color(0xFF353535), + // ), + // ), + // Icon( + // Icons.keyboard_arrow_right, + // color: Colors.black, + // ) + // ], + // ), + // ) + // else + // Container( + // margin: EdgeInsets.only(left: 28.w, top: 22.h), + // child: Text( + // message.content, + // style: TextStyle( + // fontSize: 10.sp, + // color: Color(0xFF353535), + // ), + // ), + // ), + // ], + // ), ); } } diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index 1e8b585d..31fa1484 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -212,7 +212,6 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ), ), - ///关注度/粉丝/发布 attention(), @@ -313,8 +312,8 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ///关注度/粉丝/成就数量 Widget attention(){ return Container( - padding: EdgeInsets.only(bottom: 16,top: 16), - margin: EdgeInsets.only(left: 16,top:16,right: 16), + margin: EdgeInsets.only(left: 16, top: 10, right: 16), + // padding: EdgeInsets.only(top: 16,bottom: 16), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8), @@ -327,109 +326,123 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ), ], ), - child:GestureDetector( - onTap:(){ - Navigator.of(context).pushNamed( - '/router/communityFollow', - arguments: {}, - ); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureDetector( - onTap:(){ + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { Navigator.of(context).pushNamed( '/router/communityFollow', arguments: {}, ); }, - child: - Column( + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( children: [ Text( - S.of(context).guanzhu, + infoNumber != null ? infoNumber.follow.toString() : "0", style: TextStyle( color: Color(0xFF000000), - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, ), ), - SizedBox(height: 5,), + SizedBox( + height: 4, + ), Text( - infoNumber != null ?infoNumber.follow.toString() :"0", + S.of(context).guanzhu, style: TextStyle( color: Color(0xFF000000), - fontSize: 15.sp, - fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, ), ), ], - ), + )), ), - GestureDetector( - onTap:(){ + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { Navigator.of(context).pushNamed( '/router/communityFollow', arguments: {}, ); }, - child: - Column( - children: [ - Text( - S.of(context).fensi, - style: TextStyle( - color: Color(0xFF000000), - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, - ), - ), - SizedBox(height: 5,), - Text( - infoNumber != null ?infoNumber.fans.toString() :"0", - style: TextStyle( - color: Color(0xFF000000), - fontSize: 15.sp, - fontWeight: MyFontWeight.medium, - ), - ), - ], - ), + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + infoNumber != null ? infoNumber.fans.toString() : "0", + style: TextStyle( + color: Color(0xFF000000), + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, + ), + ), + SizedBox( + height: 4, + ), + Text( + S.of(context).fensi, + style: TextStyle( + color: Color(0xFF000000), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + )), ), - GestureDetector( - onTap:(){ - Navigator.of(context).pushNamed( - '/router/mine_attainment_page', - arguments: {"userInfo":userInfo}, - ); - }, - child: - Column( - children: [ - Text( - "成就", - style: TextStyle( - color: Color(0xFF000000), - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, - ), - ), - SizedBox(height: 5,), - Text( - infoNumber != null ?infoNumber.achievementNumber.toString() :"0", - style: TextStyle( - color: Color(0xFF000000), - fontSize: 15.sp, - fontWeight: MyFontWeight.medium, - ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context).pushNamed( + '/router/mine_attainment_page', + arguments: {"userInfo": userInfo}, + ); + }, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + infoNumber != null + ? infoNumber.achievementNumber.toString() + : "0", + style: TextStyle( + color: Color(0xFF000000), + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, + ), + ), + SizedBox( + height: 4, + ), + Text( + "成就", + style: TextStyle( + color: Color(0xFF000000), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], ), - ], - ), - ), - ], - ), + )), + ], ), ); } diff --git a/lib/mine/mine_view/mine_view.dart b/lib/mine/mine_view/mine_view.dart index b5f418ea..c05c043e 100644 --- a/lib/mine/mine_view/mine_view.dart +++ b/lib/mine/mine_view/mine_view.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/activity_coupons.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; @@ -42,8 +43,8 @@ class _MineView extends State { padding: EdgeInsets.all(8.h), child: Image.asset( "assets/image/icon_scan_qr_code.png", - width: 24.w, - height: 24.h, + width:32.w, + height: 32.h, ), ), ), @@ -56,8 +57,8 @@ class _MineView extends State { margin: EdgeInsets.only(right: 12.w), child: Image.asset( "assets/image/icon_mine_setting.png", - width: 24.w, - height: 24.h, + width: 32.w, + height: 32.h, ), ), ), @@ -93,6 +94,11 @@ class _MineView extends State { } else if (await Permission.camera.isGranted) { // http://pos.app.gznl.top/placeorder/?tableId=1315903669597634560&tenantCode=1166&shopId=1300372027722432512 var result = await Navigator.of(context).pushNamed('/router/qr_scan'); + if(result.toString().contains("type\":\"coupon")){ + ///活动优惠券赠送弹窗 + activityShowAlertDialog(result.toString()); + return; + } // String result = await scanner.scan(); Uri uri = Uri.parse(result); String tableId = uri.queryParameters["tableId"]; @@ -119,6 +125,16 @@ class _MineView extends State { } } + activityShowAlertDialog(String result) { + //显示对话框 + showDialog( + context: context, + builder: (BuildContext context) { + return ActivityCoupons(result); + }, + ); + } + ///我的信息部分 Widget mineView() { return Container( @@ -197,6 +213,7 @@ class _MineView extends State { ), ), ), + if(widget.userInfo.level != 1) Image.asset( "assets/image/icon_user.png", width: 18.w, @@ -253,19 +270,24 @@ class _MineView extends State { child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ + Image.asset( + "assets/image/ji_fen.png", + width: 16.w, + height: 16.h, + ), Text( - S.of(context).jifenxiangqing, + "签到得积分", style: TextStyle( color: Colors.black, fontSize: 12.sp, fontWeight: MyFontWeight.regular, ), ), - Icon( - Icons.keyboard_arrow_right, - size: 16, - color: Colors.black, - ) + // Icon( + // Icons.keyboard_arrow_right, + // size: 16, + // color: Colors.black, + // ) ], ), )), diff --git a/lib/mine/mine_view/wallet_coupon_view.dart b/lib/mine/mine_view/wallet_coupon_view.dart index 0702b853..8ea70420 100644 --- a/lib/mine/mine_view/wallet_coupon_view.dart +++ b/lib/mine/mine_view/wallet_coupon_view.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/utils/font_weight.dart'; @@ -30,11 +31,8 @@ class _WalletCoupon extends State { ), ], ), - child: Row( - children: [ - Expanded( - flex: 1, - child: GestureDetector( + child: (Theme.of(context).platform == TargetPlatform.android) + ? GestureDetector( onTap: () { SharedPreferences.getInstance().then((value) { if (value.getString("token") == null || @@ -46,8 +44,6 @@ class _WalletCoupon extends State { }); }, child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( "assets/image/icon_mine_invoice_assistant.png", @@ -58,70 +54,128 @@ class _WalletCoupon extends State { width: 12.w, ), Expanded( - child: Text( - S.of(context).lingquanzhongxin, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - color: Color(0xFF353535), - ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + S.of(context).lingquanzhongxin, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + color: Color(0xFF353535), + ), + ), + SizedBox( + height: 3, + ), + Text( + "联盟下单享不停、海量优惠券等你来领!", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 12.sp, + color: Color(0xFF7B7B7B), + ), + ), + ], ), - flex: 1, - ), + ) ], - ), - ), - ), - Container( - width: 2.w, - height: 32.h, - margin: EdgeInsets.only(left: 20.w, right: 20.w), - color: Color(0xFFF7F7F7), - ), - Expanded( - flex: 1, - child: GestureDetector( - onTap: () { - SharedPreferences.getInstance().then((value) { - if (value.getString("token") == null || - value.getString("token") == "") { - LoginTipsDialog().show(context); - return; - } - Navigator.of(context).pushNamed('/router/mine_wallet'); - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/image/icon_mine_wallet.png", - width: 48.h, - height: 48.h, - ), - SizedBox( - width: 12.w, + )) + : Row( + children: [ + Expanded( + flex: 1, + child: GestureDetector( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context) + .pushNamed('/router/roll_center_page'); + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/icon_mine_invoice_assistant.png", + width: 48.h, + height: 48.h, + ), + SizedBox( + width: 12.w, + ), + Expanded( + child: Text( + S.of(context).lingquanzhongxin, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + color: Color(0xFF353535), + ), + ), + flex: 1, + ), + ], + ), ), - Expanded( - child: Text( - S.of(context).wodeqianbao, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - color: Color(0xFF353535), - ), + ), + Container( + width: 2.w, + height: 32.h, + margin: EdgeInsets.only(left: 20.w, right: 20.w), + color: Color(0xFFF7F7F7), + ), + Expanded( + flex: 1, + child: GestureDetector( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context).pushNamed('/router/mine_wallet'); + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/icon_mine_wallet.png", + width: 48.h, + height: 48.h, + ), + SizedBox( + width: 12.w, + ), + Expanded( + child: Text( + S.of(context).wodeqianbao, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + color: Color(0xFF353535), + ), + ), + flex: 1, + ), + ], ), - flex: 1, ), - ], - ), + ), + ], ), - ), - ], - ), ); } } diff --git a/lib/mine/mine_wallet_page.dart b/lib/mine/mine_wallet_page.dart index 01ff8ccd..faf730b8 100644 --- a/lib/mine/mine_wallet_page.dart +++ b/lib/mine/mine_wallet_page.dart @@ -12,6 +12,7 @@ import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; import 'package:huixiang/view_widget/round_button.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; @@ -57,7 +58,8 @@ class _MineWalletPage extends State { } queryUserBalance() async { - BaseData baseData = await apiService.queryInfo().catchError((onError) {}); + BaseData baseData = + await apiService.queryInfo().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { userInfo = baseData.data; mBalance = double.tryParse(userInfo.money); @@ -168,14 +170,21 @@ class _MineWalletPage extends State { ), Container( margin: EdgeInsets.only(top: 14.h), - child: ListView.builder( - itemCount: userBills != null ? userBills.length : 0, - shrinkWrap: true, - padding: EdgeInsets.only(bottom: 20.h), - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, position) { - return historyItem(userBills[position], position); - }), + child: (userBills == null || userBills.length == 0) + ? NoDataView( + isShowBtn: false, + text: "目前暂未记录哦", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ) + : ListView.builder( + itemCount: userBills != null ? userBills.length : 0, + shrinkWrap: true, + padding: EdgeInsets.only(bottom: 20.h), + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return historyItem(userBills[position], position); + }), ), ], ), @@ -200,6 +209,7 @@ class _MineWalletPage extends State { Expanded( flex: 1, child: Container( + // height: 34.h, child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/mine/release_page.dart b/lib/mine/release_page.dart index f4191078..7a52ff00 100644 --- a/lib/mine/release_page.dart +++ b/lib/mine/release_page.dart @@ -1,8 +1,11 @@ +import 'dart:convert'; + import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:huixiang/community/community_view/community_dynamic.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/comunity_comment.dart'; import 'package:huixiang/retrofit/data/page.dart'; @@ -26,7 +29,7 @@ class _ReleasePage extends State { int pageNum = 0; String userId; - List comments = []; + List
articles = []; @override void initState() { @@ -66,10 +69,24 @@ class _ReleasePage extends State { refreshController.loadComplete(); if (baseData.isSuccess) { if (pageNum == 1) { - comments.clear(); + articles.clear(); } - comments.addAll(baseData.data.list); - print("comments: ${comments.length}"); + baseData.data.list.forEach((element) { + var article = Article(); + article.id = element.id; + article.content = jsonEncode(element.subjectInfo); + article.mainTitle =element.subject; + article.liked = element.selfFollow; + article.authorHeadImg = element.memberInfo?.avatar; + article.authorName = element.memberInfo?.nickname; + article.createTime = element.createTime; + article.updateUser = element.memberInfo?.mid; + article.viewers = element?.viewers; + article.likes = element?.likes; + article.comments = element?.comments; + articles.add(article); + }); + // print("comments: ${comments.length}"); if (int.tryParse(baseData.data.total) < (pageNum * 10)) { refreshController.loadNoData(); } @@ -109,8 +126,9 @@ class _ReleasePage extends State { itemBuilder: (context, position) { return InkWell( child: CommunityDynamic( - comments[position], - 1,exitFull: (){setState(() { + articles[position], + 1, + exitFull: (){setState(() { _onRefresh(); });}, removalDynamic: () { @@ -121,13 +139,13 @@ class _ReleasePage extends State { Navigator.of(context).pushNamed( '/router/community_details', arguments: { - "comment": comments[position],"userId":userId, + "businessId": articles[position].id,"userId":userId, }, ); }, ); }, - itemCount: comments.length, + itemCount: articles.length, )), ); }, diff --git a/lib/order/order_view/order_commodity.dart b/lib/order/order_view/order_commodity.dart index 1856edec..8ceae95e 100644 --- a/lib/order/order_view/order_commodity.dart +++ b/lib/order/order_view/order_commodity.dart @@ -169,7 +169,7 @@ class _OrderCommodity extends State { margin: EdgeInsets.only( left: 16.w, ), - height: 44.h, + // height: 44.h, child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/retrofit/data/article.dart b/lib/retrofit/data/article.dart index 72a130e3..5af314d9 100644 --- a/lib/retrofit/data/article.dart +++ b/lib/retrofit/data/article.dart @@ -14,7 +14,7 @@ class Article { dynamic _viceTitle; String _content; String _coverImg; - Author _author; + dynamic _author; int _type; String _startTime; String _categoryId; @@ -26,6 +26,8 @@ class Article { bool _liked; int _viewers; int _comments; + String _authorName; + String _authorHeadImg; bool isFollow; dynamic _storeName; @@ -39,7 +41,7 @@ class Article { dynamic get viceTitle => _viceTitle; String get content => _content; String get coverImg => _coverImg; - Author get author => _author; + dynamic get author => _author; int get type => _type; String get startTime => _startTime; String get categoryId => _categoryId; @@ -51,8 +53,14 @@ class Article { bool get liked => _liked; int get viewers => _viewers; int get comments => _comments; + String get authorName => _authorName; + String get authorHeadImg => _authorHeadImg; dynamic get storeName => _storeName; + set id(String value) { + _id = value; + } + set likes(int value) { _likes = value; } @@ -69,27 +77,38 @@ class Article { _comments = value; } + set authorName(String value) { + _authorName = value; + } + + set authorHeadImg(String value) { + _authorHeadImg = value; + } + Article({ - String id, - String createTime, - dynamic createUser, - String updateTime, - dynamic updateUser, - String storeId, - String mainTitle, - dynamic viceTitle, - String content, + String id, + String createTime, + dynamic createUser, + String updateTime, + dynamic updateUser, + String storeId, + String mainTitle, + dynamic viceTitle, + String content, String coverImg, Author author, - int type, - String startTime, - String endTime, - int state, - int isDelete, + int type, + String startTime, + String endTime, + int state, + int isDelete, int likes, bool isHot, int viewers, int comments, + String authorName, + String authorHeadImg, + dynamic storeName}){ _id = id; _createTime = createTime; @@ -113,6 +132,8 @@ class Article { _liked = liked; _viewers = viewers; _comments = comments; + _authorName = authorName; + _authorHeadImg = authorHeadImg; _storeName = storeName; } @@ -127,7 +148,7 @@ class Article { _viceTitle = json["viceTitle"]; _content = json["content"]; _coverImg = json["coverImg"]; - _author = json["author"] == null ? null : Author.fromJson(jsonDecode(json["author"])); + _author = json["author"] == null ? null : json["author"].toString().startsWith("{") ? Author.fromJson(jsonDecode(json["author"])):null; _type = json["type"]; _startTime = json["startTime"]; _categoryId = json["categoryId"]; @@ -139,6 +160,8 @@ class Article { _liked = json["liked"]; _viewers = json["viewers"]; _comments = json["comments"]; + _authorName = json["authorName"]; + _authorHeadImg = json["authorHeadImg"]; _storeName = json["storeName"]; } @@ -166,8 +189,81 @@ class Article { map["liked"] = _liked; map["viewers"] = _viewers; map["comments"] = _comments; + map["authorName"] = _authorName; + map["authorHeadImg"] = _authorHeadImg; map["storeName"] = _storeName; return map; } + set createTime(String value) { + _createTime = value; + } + + set createUser(dynamic value) { + _createUser = value; + } + + set updateTime(String value) { + _updateTime = value; + } + + set updateUser(dynamic value) { + _updateUser = value; + } + + set storeId(String value) { + _storeId = value; + } + + set mainTitle(String value) { + _mainTitle = value; + } + + set viceTitle(dynamic value) { + _viceTitle = value; + } + + set content(String value) { + _content = value; + } + + set coverImg(String value) { + _coverImg = value; + } + + set author(dynamic value) { + _author = value; + } + + set type(int value) { + _type = value; + } + + set startTime(String value) { + _startTime = value; + } + + set categoryId(String value) { + _categoryId = value; + } + + set endTime(String value) { + _endTime = value; + } + + set state(int value) { + _state = value; + } + + set isDelete(int value) { + _isDelete = value; + } + + set isHot(bool value) { + _isHot = value; + } + + set storeName(dynamic value) { + _storeName = value; + } } \ No newline at end of file diff --git a/lib/retrofit/data/login_info.dart b/lib/retrofit/data/login_info.dart index 912454e1..4ba91f8e 100644 --- a/lib/retrofit/data/login_info.dart +++ b/lib/retrofit/data/login_info.dart @@ -1,16 +1,19 @@ -/// authInfo : {"token":"eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJQTEFURk9STV9BUFAiLCJuYW1lIjoi5Zue5LmhXzg4ODg4OCIsInRva2VuX3R5cGUiOiJ0b2tlbiIsInVzZXJpZCI6IjE0NzA3MDI1OTIzMDM1NjI3NTIiLCJhY2NvdW50IjoiMTU2MTU2OTg3NDUiLCJleHAiOjE2NDIwNjk3OTksIm5iZiI6MTYzOTQ3Nzc5OX0.KHiw51SQ2RkARJhGKFTXgI7IrYXOhN-YqFZCwJ1jkEc","tokenType":"token","refreshToken":"eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaF90b2tlbiIsInVzZXJpZCI6IjE0NzA3MDI1OTIzMDM1NjI3NTIiLCJleHAiOjE2NDIwNjk3OTksIm5iZiI6MTYzOTQ3Nzc5OX0.jjI0dTviahPq6p4J_tx_Sn-Fg-q51kE3WPpqdVcEIMw","name":"回乡_888888","account":"15615698745","avatar":null,"workDescribe":null,"userId":"1470702592303562752","userType":"PLATFORM_APP","expire":"2592000","expiration":"2022-01-13 18:29:59","mobile":"15615698745"} -/// interviewCouponList : [{"id":"1463398002331746304","createTime":"2021-11-24 14:44:07","createUser":"1333246101196636160","updateTime":"2021-11-24 14:44:07","updateUser":"1333246101196636160","storeId":"0","couponName":"满10-2","bizType":1,"allProduct":true,"productSkuId":[],"fullAmount":"10.00","discountAmount":"2.00","fullNumber":1,"discountPercent":100,"sellPrice":"0.00","sellCount":0,"bizId":"","publishStartTime":"2021-11-24 12:00:00","publishEndTime":"2021-11-30 12:00:00","useStartTime":"2021-11-24 12:00:00","useEndTime":"2021-11-30 12:00:00","promotionId":"0","dateOrDay":false,"startAfterDays":0,"daysValidate":0,"businessType":0,"centreDisplay":true,"tenantCode":"1175","isDelete":0,"storeName":"海峡姐妹奶茶店","number":1}] -/// newUserCouponList : [{"id":"1463398002331746304","createTime":"2021-11-24 14:44:07","createUser":"1333246101196636160","updateTime":"2021-11-24 14:44:07","updateUser":"1333246101196636160","storeId":"0","couponName":"满10-2","bizType":1,"allProduct":true,"productSkuId":[],"fullAmount":"10.00","discountAmount":"2.00","fullNumber":1,"discountPercent":100,"sellPrice":"0.00","sellCount":0,"bizId":"","publishStartTime":"2021-11-24 12:00:00","publishEndTime":"2021-11-30 12:00:00","useStartTime":"2021-11-24 12:00:00","useEndTime":"2021-11-30 12:00:00","promotionId":"0","dateOrDay":false,"startAfterDays":0,"daysValidate":0,"businessType":0,"centreDisplay":true,"tenantCode":"1175","isDelete":0,"storeName":"海峡姐妹奶茶店","number":1},{"id":"1463398002331746304","createTime":"2021-11-24 14:44:07","createUser":"1333246101196636160","updateTime":"2021-11-24 14:44:07","updateUser":"1333246101196636160","storeId":"0","couponName":"满10-2","bizType":1,"allProduct":true,"productSkuId":[],"fullAmount":"10.00","discountAmount":"2.00","fullNumber":1,"discountPercent":100,"sellPrice":"0.00","sellCount":0,"bizId":"","publishStartTime":"2021-11-24 12:00:00","publishEndTime":"2021-11-30 12:00:00","useStartTime":"2021-11-24 12:00:00","useEndTime":"2021-11-30 12:00:00","promotionId":"0","dateOrDay":false,"startAfterDays":0,"daysValidate":0,"businessType":0,"centreDisplay":true,"tenantCode":"1175","isDelete":0,"storeName":"海峡姐妹奶茶店","number":1},{"id":"1463398002331746304","createTime":"2021-11-24 14:44:07","createUser":"1333246101196636160","updateTime":"2021-11-24 14:44:07","updateUser":"1333246101196636160","storeId":"0","couponName":"满10-2","bizType":1,"allProduct":true,"productSkuId":[],"fullAmount":"10.00","discountAmount":"2.00","fullNumber":1,"discountPercent":100,"sellPrice":"0.00","sellCount":0,"bizId":"","publishStartTime":"2021-11-24 12:00:00","publishEndTime":"2021-11-30 12:00:00","useStartTime":"2021-11-24 12:00:00","useEndTime":"2021-11-30 12:00:00","promotionId":"0","dateOrDay":false,"startAfterDays":0,"daysValidate":0,"businessType":0,"centreDisplay":true,"tenantCode":"1175","isDelete":0,"storeName":"海峡姐妹奶茶店","number":1}] +/// authInfo : {"token":"eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJQTEFURk9STV9BUFAiLCJuYW1lIjoi5Zue5LmhXzg4ODg4OCIsInRva2VuX3R5cGUiOiJ0b2tlbiIsInVzZXJpZCI6IjE0ODQ0Nzc5NDQ4Mzg0ODgwNjQiLCJhY2NvdW50IjoiMTU0NDc4OTg3NTYiLCJleHAiOjE2NDUzNTQwOTksIm5iZiI6MTY0Mjc2MjA5OX0.dIGWaCR6uuJ4YcgTfEEeVGJtOmpAlLaxQ2sEnd_9_zw","tokenType":"token","refreshToken":"eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaF90b2tlbiIsInVzZXJpZCI6IjE0ODQ0Nzc5NDQ4Mzg0ODgwNjQiLCJleHAiOjE2NDUzNTQwOTksIm5iZiI6MTY0Mjc2MjA5OX0.ZrG-JCemN_HtFzE512311Tksh2o21ywgjHhhGeXXWrE","name":"回乡_888888","account":"15447898756","avatar":null,"workDescribe":null,"userId":"1484477944838488064","userType":"PLATFORM_APP","expire":"2592000","expiration":"2022-02-20 18:48:19","mobile":"15447898756"} +/// interviewCouponList : [{"id":"1478615682588344320","createTime":"2022-01-05 14:33:45","createUser":"1333246101196636160","updateTime":"2022-01-05 14:33:45","updateUser":"1333246101196636160","storeId":"0","couponName":"新品10-5","bizType":1,"allProduct":true,"productSkuId":[],"fullAmount":"10.00","discountAmount":"5.00","fullNumber":1,"discountPercent":100,"sellPrice":"0.00","sellCount":0,"bizId":"","publishStartTime":"2022-01-01 00:00:00","publishEndTime":"2022-01-31 00:00:00","useStartTime":"2022-01-02 00:00:00","useEndTime":"2022-01-30 00:00:00","promotionId":"0","dateOrDay":false,"startAfterDays":0,"daysValidate":0,"businessType":0,"centreDisplay":false,"tenantCode":"1175","isDelete":0,"storeName":"海峡姐妹茶","number":1}] +/// newUserCouponList : null +/// firstLoginCouponList : [{"id":"1484456566340976640","createTime":"2022-01-21 17:23:20","createUser":"1333246101196636160","updateTime":"2022-01-21 17:23:20","updateUser":"1333246101196636160","storeId":"1333246101343436800","couponName":"新会员","bizType":1,"allProduct":true,"productSkuId":[],"fullAmount":"14.00","discountAmount":"7.00","fullNumber":1,"discountPercent":100,"sellPrice":"0.00","sellCount":0,"bizId":"","publishStartTime":"2022-01-01 00:00:00","publishEndTime":"2022-01-31 00:00:00","useStartTime":"2022-01-01 00:00:00","useEndTime":"2022-02-01 00:00:00","promotionId":"0","dateOrDay":false,"startAfterDays":0,"daysValidate":0,"businessType":0,"centreDisplay":false,"tenantCode":"1175","isDelete":0,"storeName":"海峡姐妹茶(汉街店)","number":1},{"id":"1484456980566245376","createTime":"2022-01-21 17:24:59","createUser":"1336877238389309440","updateTime":"2022-01-21 17:24:59","updateUser":"1336877238389309440","storeId":"1328618782985289728","couponName":"新会员8-8","bizType":1,"allProduct":true,"productSkuId":[],"fullAmount":"8.00","discountAmount":"8.00","fullNumber":1,"discountPercent":100,"sellPrice":"0.00","sellCount":0,"bizId":"","publishStartTime":"2022-01-01 00:00:00","publishEndTime":"2022-01-31 00:00:00","useStartTime":"2022-01-01 00:00:00","useEndTime":"2022-01-31 00:00:00","promotionId":"0","dateOrDay":false,"startAfterDays":0,"daysValidate":0,"businessType":0,"centreDisplay":false,"tenantCode":"1174","isDelete":0,"storeName":"前进麦味(凯德1818店)","number":1}] class LoginInfo { LoginInfo({ - AuthInfo authInfo, - List interviewCouponList, - List newUserCouponList,}){ + AuthInfo authInfo, + List interviewCouponList, + dynamic newUserCouponList, + List firstLoginCouponList,}){ _authInfo = authInfo; _interviewCouponList = interviewCouponList; _newUserCouponList = newUserCouponList; - } + _firstLoginCouponList = firstLoginCouponList; +} LoginInfo.fromJson(dynamic json) { _authInfo = json['authInfo'] != null ? AuthInfo.fromJson(json['authInfo']) : null; @@ -20,20 +23,23 @@ class LoginInfo { _interviewCouponList.add(InterviewCouponList.fromJson(v)); }); } - if (json['newUserCouponList'] != null) { - _newUserCouponList = []; - json['newUserCouponList'].forEach((v) { - _newUserCouponList.add(NewUserCouponList.fromJson(v)); + _newUserCouponList = json['newUserCouponList']; + if (json['firstLoginCouponList'] != null) { + _firstLoginCouponList = []; + json['firstLoginCouponList'].forEach((v) { + _firstLoginCouponList.add(FirstLoginCouponList.fromJson(v)); }); } } AuthInfo _authInfo; List _interviewCouponList; - List _newUserCouponList; + dynamic _newUserCouponList; + List _firstLoginCouponList; AuthInfo get authInfo => _authInfo; List get interviewCouponList => _interviewCouponList; - List get newUserCouponList => _newUserCouponList; + dynamic get newUserCouponList => _newUserCouponList; + List get firstLoginCouponList => _firstLoginCouponList; Map toJson() { final map = {}; @@ -43,79 +49,80 @@ class LoginInfo { if (_interviewCouponList != null) { map['interviewCouponList'] = _interviewCouponList.map((v) => v.toJson()).toList(); } - if (_newUserCouponList != null) { - map['newUserCouponList'] = _newUserCouponList.map((v) => v.toJson()).toList(); + map['newUserCouponList'] = _newUserCouponList; + if (_firstLoginCouponList != null) { + map['firstLoginCouponList'] = _firstLoginCouponList.map((v) => v.toJson()).toList(); } return map; } } -/// id : "1463398002331746304" -/// createTime : "2021-11-24 14:44:07" +/// id : "1484456566340976640" +/// createTime : "2022-01-21 17:23:20" /// createUser : "1333246101196636160" -/// updateTime : "2021-11-24 14:44:07" +/// updateTime : "2022-01-21 17:23:20" /// updateUser : "1333246101196636160" -/// storeId : "0" -/// couponName : "满10-2" +/// storeId : "1333246101343436800" +/// couponName : "新会员" /// bizType : 1 /// allProduct : true /// productSkuId : [] -/// fullAmount : "10.00" -/// discountAmount : "2.00" +/// fullAmount : "14.00" +/// discountAmount : "7.00" /// fullNumber : 1 /// discountPercent : 100 /// sellPrice : "0.00" /// sellCount : 0 /// bizId : "" -/// publishStartTime : "2021-11-24 12:00:00" -/// publishEndTime : "2021-11-30 12:00:00" -/// useStartTime : "2021-11-24 12:00:00" -/// useEndTime : "2021-11-30 12:00:00" +/// publishStartTime : "2022-01-01 00:00:00" +/// publishEndTime : "2022-01-31 00:00:00" +/// useStartTime : "2022-01-01 00:00:00" +/// useEndTime : "2022-02-01 00:00:00" /// promotionId : "0" /// dateOrDay : false /// startAfterDays : 0 /// daysValidate : 0 /// businessType : 0 -/// centreDisplay : true +/// centreDisplay : false /// tenantCode : "1175" /// isDelete : 0 -/// storeName : "海峡姐妹奶茶店" +/// storeName : "海峡姐妹茶(汉街店)" /// number : 1 -class NewUserCouponList { - NewUserCouponList({ - String id, - String createTime, - String createUser, - String updateTime, - String updateUser, - String storeId, - String couponName, - int bizType, - bool allProduct, - List productSkuId, - String fullAmount, - String discountAmount, - int fullNumber, - int discountPercent, - String sellPrice, - int sellCount, - String bizId, - String publishStartTime, - String publishEndTime, - String useStartTime, - String useEndTime, - String promotionId, - bool dateOrDay, - int startAfterDays, - int daysValidate, - int businessType, - bool centreDisplay, - String tenantCode, - int isDelete, - String storeName, - int number,}){ +class FirstLoginCouponList { + FirstLoginCouponList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + String couponName, + int bizType, + bool allProduct, + List productSkuId, + String fullAmount, + String discountAmount, + int fullNumber, + int discountPercent, + String sellPrice, + int sellCount, + String bizId, + String publishStartTime, + String publishEndTime, + String useStartTime, + String useEndTime, + String promotionId, + bool dateOrDay, + int startAfterDays, + int daysValidate, + int businessType, + bool centreDisplay, + String tenantCode, + int isDelete, + String storeName, + int number,}){ _id = id; _createTime = createTime; _createUser = createUser; @@ -147,9 +154,9 @@ class NewUserCouponList { _isDelete = isDelete; _storeName = storeName; _number = number; - } +} - NewUserCouponList.fromJson(dynamic json) { + FirstLoginCouponList.fromJson(dynamic json) { _id = json['id']; _createTime = json['createTime']; _createUser = json['createUser']; @@ -291,71 +298,71 @@ class NewUserCouponList { } -/// id : "1463398002331746304" -/// createTime : "2021-11-24 14:44:07" +/// id : "1478615682588344320" +/// createTime : "2022-01-05 14:33:45" /// createUser : "1333246101196636160" -/// updateTime : "2021-11-24 14:44:07" +/// updateTime : "2022-01-05 14:33:45" /// updateUser : "1333246101196636160" /// storeId : "0" -/// couponName : "满10-2" +/// couponName : "新品10-5" /// bizType : 1 /// allProduct : true /// productSkuId : [] /// fullAmount : "10.00" -/// discountAmount : "2.00" +/// discountAmount : "5.00" /// fullNumber : 1 /// discountPercent : 100 /// sellPrice : "0.00" /// sellCount : 0 /// bizId : "" -/// publishStartTime : "2021-11-24 12:00:00" -/// publishEndTime : "2021-11-30 12:00:00" -/// useStartTime : "2021-11-24 12:00:00" -/// useEndTime : "2021-11-30 12:00:00" +/// publishStartTime : "2022-01-01 00:00:00" +/// publishEndTime : "2022-01-31 00:00:00" +/// useStartTime : "2022-01-02 00:00:00" +/// useEndTime : "2022-01-30 00:00:00" /// promotionId : "0" /// dateOrDay : false /// startAfterDays : 0 /// daysValidate : 0 /// businessType : 0 -/// centreDisplay : true +/// centreDisplay : false /// tenantCode : "1175" /// isDelete : 0 -/// storeName : "海峡姐妹奶茶店" +/// storeName : "海峡姐妹茶" /// number : 1 class InterviewCouponList { InterviewCouponList({ - String id, - String createTime, - String createUser, - String updateTime, - String updateUser, - String storeId, - String couponName, - int bizType, - bool allProduct, - List productSkuId, - String fullAmount, - String discountAmount, - int fullNumber, - int discountPercent, - String sellPrice, - int sellCount, - String bizId, - String publishStartTime, - String publishEndTime, - String useStartTime, - String useEndTime, - String promotionId, - bool dateOrDay, - int startAfterDays, - int daysValidate, - int businessType, - bool centreDisplay, - String tenantCode, - int isDelete, - String storeName, - int number,}){ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + String couponName, + int bizType, + bool allProduct, + List productSkuId, + String fullAmount, + String discountAmount, + int fullNumber, + int discountPercent, + String sellPrice, + int sellCount, + String bizId, + String publishStartTime, + String publishEndTime, + String useStartTime, + String useEndTime, + String promotionId, + bool dateOrDay, + int startAfterDays, + int daysValidate, + int businessType, + bool centreDisplay, + String tenantCode, + int isDelete, + String storeName, + int number,}){ _id = id; _createTime = createTime; _createUser = createUser; @@ -387,7 +394,7 @@ class InterviewCouponList { _isDelete = isDelete; _storeName = storeName; _number = number; - } +} InterviewCouponList.fromJson(dynamic json) { _id = json['id']; @@ -531,33 +538,33 @@ class InterviewCouponList { } -/// token : "eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJQTEFURk9STV9BUFAiLCJuYW1lIjoi5Zue5LmhXzg4ODg4OCIsInRva2VuX3R5cGUiOiJ0b2tlbiIsInVzZXJpZCI6IjE0NzA3MDI1OTIzMDM1NjI3NTIiLCJhY2NvdW50IjoiMTU2MTU2OTg3NDUiLCJleHAiOjE2NDIwNjk3OTksIm5iZiI6MTYzOTQ3Nzc5OX0.KHiw51SQ2RkARJhGKFTXgI7IrYXOhN-YqFZCwJ1jkEc" +/// token : "eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJQTEFURk9STV9BUFAiLCJuYW1lIjoi5Zue5LmhXzg4ODg4OCIsInRva2VuX3R5cGUiOiJ0b2tlbiIsInVzZXJpZCI6IjE0ODQ0Nzc5NDQ4Mzg0ODgwNjQiLCJhY2NvdW50IjoiMTU0NDc4OTg3NTYiLCJleHAiOjE2NDUzNTQwOTksIm5iZiI6MTY0Mjc2MjA5OX0.dIGWaCR6uuJ4YcgTfEEeVGJtOmpAlLaxQ2sEnd_9_zw" /// tokenType : "token" -/// refreshToken : "eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaF90b2tlbiIsInVzZXJpZCI6IjE0NzA3MDI1OTIzMDM1NjI3NTIiLCJleHAiOjE2NDIwNjk3OTksIm5iZiI6MTYzOTQ3Nzc5OX0.jjI0dTviahPq6p4J_tx_Sn-Fg-q51kE3WPpqdVcEIMw" +/// refreshToken : "eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaF90b2tlbiIsInVzZXJpZCI6IjE0ODQ0Nzc5NDQ4Mzg0ODgwNjQiLCJleHAiOjE2NDUzNTQwOTksIm5iZiI6MTY0Mjc2MjA5OX0.ZrG-JCemN_HtFzE512311Tksh2o21ywgjHhhGeXXWrE" /// name : "回乡_888888" -/// account : "15615698745" +/// account : "15447898756" /// avatar : null /// workDescribe : null -/// userId : "1470702592303562752" +/// userId : "1484477944838488064" /// userType : "PLATFORM_APP" /// expire : "2592000" -/// expiration : "2022-01-13 18:29:59" -/// mobile : "15615698745" +/// expiration : "2022-02-20 18:48:19" +/// mobile : "15447898756" class AuthInfo { AuthInfo({ - String token, - String tokenType, - String refreshToken, - String name, - String account, - dynamic avatar, - dynamic workDescribe, - String userId, - String userType, - String expire, - String expiration, - String mobile,}){ + String token, + String tokenType, + String refreshToken, + String name, + String account, + dynamic avatar, + dynamic workDescribe, + String userId, + String userType, + String expire, + String expiration, + String mobile,}){ _token = token; _tokenType = tokenType; _refreshToken = refreshToken; @@ -570,7 +577,7 @@ class AuthInfo { _expire = expire; _expiration = expiration; _mobile = mobile; - } +} AuthInfo.fromJson(dynamic json) { _token = json['token']; diff --git a/lib/retrofit/data/message.dart b/lib/retrofit/data/message.dart index cc9a30d3..395b2bea 100644 --- a/lib/retrofit/data/message.dart +++ b/lib/retrofit/data/message.dart @@ -1,44 +1,18 @@ -/// id : "1420215467561189376" -/// createTime : "2021-07-28 10:58:26" +/// id : "1483062749750624256" +/// createTime : "2022-01-17 21:04:48" /// createUser : "0" -/// updateTime : "2021-07-28 10:58:29" +/// updateTime : "2022-01-17 21:04:48" /// updateUser : "0" -/// mid : "1406879717390286848" -/// title : "充值成功" -/// content : "你于2021-07-28 10:52:02充值0.01元,当前余额:0.08元。" -/// typed : 3 -/// relational : "" -/// state : 1 +/// mid : "1478548672881885184" +/// title : "粉丝关注" +/// content : "哈哈哈关注了你!" +/// typed : 4 +/// relational : "{\"businessId\":1483062749356359680,\"mid\":1379254113602109440,\"avatar\":\"https://pos.upload.gznl.top/admin/2021/08/1f8d55ed-85d2-42a2-b155-6737a66226e8.jpg\",\"typed\":\"MEMBER\",\"nickname\":\"哈哈哈\",\"action\":\"FOLLOW\",\"receiveMid\":1478548672881885184}" +/// state : 0 /// isDelete : 0 +/// followed : false class Message { - - String _id; - String _createTime; - String _createUser; - String _updateTime; - String _updateUser; - String _mid; - String _title; - String _content; - int _typed; - String _relational; - int _state; - int _isDelete; - - String get id => _id; - String get createTime => _createTime; - String get createUser => _createUser; - String get updateTime => _updateTime; - String get updateUser => _updateUser; - String get mid => _mid; - String get title => _title; - String get content => _content; - int get typed => _typed; - String get relational => _relational; - int get state => _state; - int get isDelete => _isDelete; - Message({ String id, String createTime, @@ -51,7 +25,8 @@ class Message { int typed, String relational, int state, - int isDelete}){ + int isDelete, + bool followed,}){ _id = id; _createTime = createTime; _createUser = createUser; @@ -64,37 +39,67 @@ class Message { _relational = relational; _state = state; _isDelete = isDelete; + _followed = followed; } Message.fromJson(dynamic json) { - _id = json["id"]; - _createTime = json["createTime"]; - _createUser = json["createUser"]; - _updateTime = json["updateTime"]; - _updateUser = json["updateUser"]; - _mid = json["mid"]; - _title = json["title"]; - _content = json["content"]; - _typed = json["typed"]; - _relational = json["relational"]; - _state = json["state"]; - _isDelete = json["isDelete"]; + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _mid = json['mid']; + _title = json['title']; + _content = json['content']; + _typed = json['typed']; + _relational = json['relational']; + _state = json['state']; + _isDelete = json['isDelete']; + _followed = json['followed']; } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _mid; + String _title; + String _content; + int _typed; + String _relational; + int _state; + int _isDelete; + bool _followed; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get mid => _mid; + String get title => _title; + String get content => _content; + int get typed => _typed; + String get relational => _relational; + int get state => _state; + int get isDelete => _isDelete; + bool get followed => _followed; Map toJson() { - var map = {}; - map["id"] = _id; - map["createTime"] = _createTime; - map["createUser"] = _createUser; - map["updateTime"] = _updateTime; - map["updateUser"] = _updateUser; - map["mid"] = _mid; - map["title"] = _title; - map["content"] = _content; - map["typed"] = _typed; - map["relational"] = _relational; - map["state"] = _state; - map["isDelete"] = _isDelete; + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['mid'] = _mid; + map['title'] = _title; + map['content'] = _content; + map['typed'] = _typed; + map['relational'] = _relational; + map['state'] = _state; + map['isDelete'] = _isDelete; + map['followed'] = _followed; return map; } diff --git a/lib/retrofit/data/msg_stats.dart b/lib/retrofit/data/msg_stats.dart new file mode 100644 index 00000000..cb3f4d17 --- /dev/null +++ b/lib/retrofit/data/msg_stats.dart @@ -0,0 +1,29 @@ +/// name : "4" +/// number : 8 + +class MsgStats { + MsgStats({ + String name, + int number,}){ + _name = name; + _number = number; +} + + MsgStats.fromJson(dynamic json) { + _name = json['name']; + _number = json['number']; + } + String _name; + int _number; + + String get name => _name; + int get number => _number; + + Map toJson() { + final map = {}; + map['name'] = _name; + map['number'] = _number; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 248d1ea5..d95056e3 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -14,21 +14,15 @@ import 'package:huixiang/retrofit/data/wx_pay.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:retrofit/retrofit.dart'; -import 'data/activity_actRecord_details.dart'; -import 'data/activity_area_list.dart'; -import 'data/activity_details.dart'; import 'data/findMiNiGroupList.dart'; -import 'data/activity_order_list.dart'; -import 'data/home_recommend_list.dart'; import 'data/miNiDetail.dart'; import 'data/settleOrderInfo.dart'; import 'data/shoppingCart.dart'; -import 'data/shopping_home_config.dart'; part 'min_api.g.dart'; -// const base_url = "https://pos.api.lotus-wallet.com/app/"; ///正式 -// const baseUrl = "https://pos.api.lotus-wallet.com/app/"; ///正式 +const base_url = "https://pos.api.lotus-wallet.com/app/"; ///正式 +const baseUrl = "https://pos.api.lotus-wallet.com/app/"; ///正式 // const base_url = "http://user.prod.kunqi.lotus-wallet.com/app/"; ///222 @@ -37,12 +31,14 @@ part 'min_api.g.dart'; // const base_url = "http://192.168.10.236:8765/app/";///费韬 // const baseUrl = "http://192.168.10.236:8765/app/";///费韬 + +// const base_url = "http://192.168.10.142:8765/app/";///詹云久 +// const baseUrl = "http://192.168.10.142:8765/app/";///詹云久 + + // const base_url = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/"; -const base_url = "http://192.168.10.142:8765/app/";///詹云久 -const baseUrl = "http://192.168.10.142:8765/app/";///詹云久 - ///调用小程序的接口 @RestApi(baseUrl: baseUrl) abstract class MinApiService { @@ -171,7 +167,7 @@ abstract class MinApiService { ///修改购物车商品数量 @PUT("shoppingcart/single") - Future shoppingCartSingle(@Body() Map param); + Future>> shoppingCartSingle(@Body() Map param); ///订单结算信息 @POST("order/getOrderInfo") diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index e63121a6..6b1f9de2 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -37,6 +37,7 @@ import 'data/headlines_list_details.dart'; import 'data/logistics.dart'; import 'data/member_comment_list.dart'; import 'data/message.dart'; +import 'data/msg_stats.dart'; import 'data/page.dart'; import 'data/rank.dart'; import 'data/second_card_list.dart'; @@ -54,8 +55,8 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -// const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -// const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 // const base_url = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 // const baseUrl = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 @@ -67,8 +68,8 @@ part 'retrofit_api.g.dart'; // const baseUrl = "http://192.168.10.37:8766/app/"; -const base_url = "http://192.168.10.142:8766/app/";///詹云久 -const baseUrl = "http://192.168.10.142:8766/app/";///詹云久 +// const base_url = "http://192.168.10.88:8766/app/";///詹云久 +// const baseUrl = "http://192.168.10.88:8766/app/";///詹云久 @RestApi(baseUrl: baseUrl) abstract class ApiService { @@ -346,6 +347,10 @@ abstract class ApiService { @GET("/app-msg/{id}") Future queryMsg(@Path("id") String id); + ///App消息 统计各类消息数量 + @GET("/app-msg/stats") + Future>> stats(); + ///给文章/活动点赞 @GET("/information/likes/{id}") Future informationLikes(@Path("id") String id); diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 1e3aebc3..b39600ce 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -1032,6 +1032,28 @@ class _ApiService implements ApiService { return value; } + @override + Future>> stats() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/app-msg/stats', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map((i) => MsgStats.fromJson(i as Map)) + .toList()); + return value; + } + @override Future> informationLikes(id) async { ArgumentError.checkNotNull(id, 'id'); diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index eb7905b2..3d120e31 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -307,7 +307,9 @@ class _Settlement extends State { } BaseData baseData = await minService .settlementWx(placeOrderFirst.toJson()) - .catchError((error) {}); + .catchError((error) { + print(error); + }); if (baseData != null && baseData.isSuccess) { WxPay wxPay = baseData.data; await registerWxApi( @@ -332,7 +334,9 @@ class _Settlement extends State { } else { BaseData baseData = await minService .settlementApi(placeOrderFirst.toJson()) - .catchError((error) {}); + .catchError((error) { + print(error); + }); if (baseData != null && baseData.isSuccess) { toOrderDetails(placeOrderFirst.id); } else { diff --git a/lib/settlement/settlement_view/coupon.dart b/lib/settlement/settlement_view/coupon.dart index bae2b62b..2eb17ba3 100644 --- a/lib/settlement/settlement_view/coupon.dart +++ b/lib/settlement/settlement_view/coupon.dart @@ -171,8 +171,8 @@ class _CouponWidget extends State { }, child: Image.asset( widget.selected - ? "assets/image/icon_radio_unselected.png" - : "assets/image/icon_radio_selected.png", + ? "assets/image/icon_radio_selected.png" + : "assets/image/icon_radio_unselected.png", width: 24, height: 24, ), diff --git a/lib/settlement/settlement_view/settlement_coupon.dart b/lib/settlement/settlement_view/settlement_coupon.dart index d9bf735f..a8469317 100644 --- a/lib/settlement/settlement_view/settlement_coupon.dart +++ b/lib/settlement/settlement_view/settlement_coupon.dart @@ -115,7 +115,7 @@ class _SettlementCoupon extends State { return CouponWidget( couponCan[position], widget.storeInfo, - selected: widget.couponBean == couponCan[position], + selected: widget?.couponBean?.id == couponCan[position]?.id, ); }, ), diff --git a/lib/settlement/settlement_view/settlement_order_commodity.dart b/lib/settlement/settlement_view/settlement_order_commodity.dart index 67529d5b..ea89f6ab 100644 --- a/lib/settlement/settlement_view/settlement_order_commodity.dart +++ b/lib/settlement/settlement_view/settlement_order_commodity.dart @@ -122,7 +122,7 @@ class _SettlementOrderCommodity extends State { children: [ MImage( productList.skuImg, - width: 44.w, + width: 44, height: 44, fit: BoxFit.cover, errorSrc: "assets/image/default_1.png", @@ -342,10 +342,7 @@ class _SettlementOrderCommodity extends State { ), Container( child: Text( - "已优惠:¥${(widget.minOrderInfo != null) ? (double.parse(widget.minOrderInfo.discountAmount ?? "0") + double.parse(widget.settleOrderInfo.benefitDiscountAmount ?? "0")) : - (double.parse(widget.tableId <= 0 ? "0" : (widget.settleOrderInfo.discountAmount ?? "0")) - + double.parse(widget?.settleOrderInfo?.benefitDiscountAmount ?? "0")) - }", + "已优惠:¥${discountPrice()}", style: TextStyle( fontSize: 12.sp, color: Color(0xFF7B7B7B), @@ -384,6 +381,16 @@ class _SettlementOrderCommodity extends State { ); } + String discountPrice(){ + if(widget.minOrderInfo != null){ + return (widget.minOrderInfo.discountAmount ?? "0") + double.parse(widget.settleOrderInfo.benefitDiscountAmount ?? "0"); + }else if(widget.tableId < 0){ + return "0"; + }else { + return widget?.settleOrderInfo?.discountAmount ?? "0"; + } + } + String totalPrice() { if (widget.minOrderInfo != null && widget.minOrderInfo.orderProductVOList != null) { diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 22ce3360..f6dc08ee 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -242,10 +242,14 @@ class _StoreOrderPage extends State stretch: false, brightness: Brightness.light, leading: GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () { Navigator.of(context).pop(); }, child: Container( + width: double.infinity, + height: double.infinity, + color: Colors.transparent, alignment: Alignment.centerRight, margin: EdgeInsets.only(left: 10), padding: EdgeInsets.all(10), @@ -257,9 +261,8 @@ class _StoreOrderPage extends State ), ), flexibleSpace: FlexibleSpaceBar( - title: Title( - controller, - storeInfo != null ? storeInfo.storeName : ''), + title: Title(controller, + storeInfo != null ? storeInfo.storeName : ''), collapseMode: CollapseMode.pin, stretchModes: [ StretchMode.zoomBackground, @@ -283,7 +286,7 @@ class _StoreOrderPage extends State ], ), top: 0, - bottom:0, + bottom: 0, left: 0, right: 0, ), @@ -314,8 +317,8 @@ class _StoreOrderPage extends State ], ), ), - top:80.h, - bottom:0, + top: 100.h, + bottom: 0, left: 0, right: 0, ), @@ -550,6 +553,7 @@ class _StoreOrderPage extends State return; } } + await Navigator.of(context).pushNamed( '/router/settlement', arguments: { @@ -648,16 +652,27 @@ class _StoreOrderPage extends State ///选规格 _queryMiNiDetail(String id,int count) async { EasyLoading.show(status: S.current.zhengzaijiazai); + if(count < 0){ + shopCarGoods.shoppingCartSkuItemList.forEach((element) { + if(element.productId == id){ + shopCartReduce(element); + setState(() { + }); + } + }); + return; + } BaseData baseData = await minService.miNiDetail(id); if (baseData != null && baseData.isSuccess) { - showStoreSelector(baseData.data, id,count); + showStoreSelector(baseData.data, id, count); } } ///选规格弹窗 - showStoreSelector(MiNiDetail miNiDetail, String id,int count) async { - if (miNiDetail.attrList != null && miNiDetail.attrList.length == 1 - && miNiDetail.attrList[0].attrValueList.length == 1) { + showStoreSelector(MiNiDetail miNiDetail, String id, int count) async { + if (miNiDetail.attrList != null && + miNiDetail.attrList.length == 1 && + miNiDetail.attrList[0].attrValueList.length == 1) { _addShopCar(miNiDetail, [], count); } else { EasyLoading.dismiss(); @@ -670,7 +685,6 @@ class _StoreOrderPage extends State _addShopCar, add, reduce, - buttonType: 0, ), onDismiss: () { dialogShowing = false; @@ -683,7 +697,7 @@ class _StoreOrderPage extends State ///添加购物车 Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async { ProductSkuVOListBean productSku; - if (selectSkus!= null && selectSkus.length == 0) { + if (selectSkus != null && selectSkus.length == 0) { productSku = miNiDetail.productSkuVOList.first; } else { productSku = miNiDetail.productSkuVOList.firstWhere((element) { @@ -797,11 +811,13 @@ class _StoreOrderPage extends State BaseData> baseDate = await minService.shoppingCartSingle(shopCarTemp); if (baseDate.isSuccess) { + EasyLoading.dismiss(); this.shopCarGoods = await queryShopCar(); - if (shopCartKey != null) { + if (shopCartKey?.currentState != null) { shopCartKey.currentState.setState(() {}); } - setState(() {}); + setState(() { + }); } return this.shopCarGoods; } @@ -860,9 +876,9 @@ class _StoreOrderPage extends State } ShoppingCartSkuItemListBean shopSkuItem = shopCarGoods .shoppingCartSkuItemList - .firstWhere((element) => skuId == element.skuId); + .firstWhere((element) => skuId == element.id); int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList - .indexWhere((element) => skuId == element.skuId); + .indexWhere((element) => skuId == element.id); if (shopSkuItem != null) { if (shopSkuItem.buyNum > 1) { diff --git a/lib/store/store_view/product_sku.dart b/lib/store/store_view/product_sku.dart index c6092ff4..9f142870 100644 --- a/lib/store/store_view/product_sku.dart +++ b/lib/store/store_view/product_sku.dart @@ -36,8 +36,8 @@ class ProductSku extends StatefulWidget { class _ProductSku extends State { List selectSkus = []; - int count = 1; + String selectedPrice = ""; @override void initState() { @@ -61,6 +61,7 @@ class _ProductSku extends State { return; } if (productSku == null) return; + selectedPrice = productSku.skuPrice; String skuId = productSku.id; if (widget.shopCarGoods == null || widget.shopCarGoods.shoppingCartSkuItemList == null) return; int shopSkuIndex = widget.shopCarGoods.shoppingCartSkuItemList.indexWhere((element) => skuId == element.id); @@ -100,6 +101,7 @@ class _ProductSku extends State { height: MediaQuery.of(context).size.height / 3 * 2, width: double.infinity, decoration: BoxDecoration( + // color: Color(0xFFFAFAFA), color: Color(0xFFFAFAFA), borderRadius: BorderRadius.only( topLeft: Radius.circular(8), @@ -125,7 +127,7 @@ class _ProductSku extends State { SizedBox( width: 10, ), - Expanded(child: Column( + Expanded(child:Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( @@ -161,7 +163,7 @@ class _ProductSku extends State { ), ), Text( - widget.miNiDetail.price, + selectedPrice, style: TextStyle( color: Color(0xFFFF7A1A), fontSize: 14.sp, @@ -172,7 +174,6 @@ class _ProductSku extends State { ), ], )), - Spacer(), InkWell( onTap: () { // Navigator.of(context).pop(); @@ -723,18 +724,26 @@ class _ProductSku extends State { Widget sweetnessItem(String name, bool isCheck) { return Container( child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - RoundButton( - width: 68.w, - height: 29.h, - text: name, - textColor: !isCheck ? Color(0xFF727272) : Colors.white, - fontWeight: MyFontWeight.regular, - radius: 4, - backgroup: !isCheck ? Color(0xFFE5E5E5) : Color(0xFF32A060), - fontSize: 12.sp, + Container( + width: 70.w, + height:30.h, + alignment: Alignment.center, + decoration: BoxDecoration( + color: !isCheck ? Color(0xFFE5E5E5) : Color(0xFF32A060), + borderRadius: BorderRadius.all(Radius.circular(4)), + ), + child:Text( + name, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color:!isCheck ? Color(0xFF727272) : Colors.white, + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), ), ], ), diff --git a/lib/store/store_view/shop_goods.dart b/lib/store/store_view/shop_goods.dart index 56fd25d3..d8051136 100644 --- a/lib/store/store_view/shop_goods.dart +++ b/lib/store/store_view/shop_goods.dart @@ -198,7 +198,7 @@ class _ShopGoods extends State { ), ), if (widget.isShopCart || (widget.productListBean?.attrStyle??0) == 0) - InkWell( + GestureDetector( onTap: () { widget.add(widget.shoppingCartSkuItemListBean); }, diff --git a/lib/store/store_view/store_info.dart b/lib/store/store_view/store_info.dart index b11d70c5..cf0e46be 100644 --- a/lib/store/store_view/store_info.dart +++ b/lib/store/store_view/store_info.dart @@ -30,7 +30,7 @@ class _StoreInfoView extends State { top: 5.h, bottom: 6.h, ), - height: 160.h, + height: 140.h, padding: EdgeInsets.all(12.w), decoration: BoxDecoration( color: Colors.white, diff --git a/lib/store/store_view/store_order_list.dart b/lib/store/store_view/store_order_list.dart index b087530b..0f4e50f4 100644 --- a/lib/store/store_view/store_order_list.dart +++ b/lib/store/store_view/store_order_list.dart @@ -21,7 +21,7 @@ class StoreOrderListPage extends StatefulWidget { final ScrollController controller; final String minToken; final String tenant; - final Function(String id, int count) queryMiNiDetail; + final Function(String id,int count) queryMiNiDetail; ShoppingCart shopCarGoods; @@ -31,8 +31,8 @@ class StoreOrderListPage extends StatefulWidget { this.storeInfo, this.shopCarGoods, this.controller, - this.minToken, - this.tenant, + this.minToken, + this.tenant, this.queryMiNiDetail, ); @@ -230,24 +230,19 @@ class _StoreOrderListPage extends State { } }); } - return InkWell( - onTap: () { - widget.queryMiNiDetail(productListBeans[position].id, 1); - }, - child: ShopGoods( + return ShopGoods( (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { - widget.queryMiNiDetail(productListBeans[position].id, 1); + widget.queryMiNiDetail(productListBeans[position].id,1); }, (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { - if (count > 0) - widget.queryMiNiDetail(productListBeans[position].id, -1); + if(count > 0) + widget.queryMiNiDetail(productListBeans[position].id,-1); }, productListBean: productListBeans[position], count: count, isShopCart: false, queryMiNiDetail: widget.queryMiNiDetail, shoppingCartSkuItemListBean: shoppingCartSkuItemListBean, - ), ); } } diff --git a/lib/utils/ImgCachePath.dart b/lib/utils/ImgCachePath.dart new file mode 100644 index 00000000..fa3c41a0 --- /dev/null +++ b/lib/utils/ImgCachePath.dart @@ -0,0 +1,35 @@ +import 'dart:io'; + +import 'package:path_provider/path_provider.dart'; + +class ImgCachePath{ + factory ImgCachePath() => _getInstance(); + + static ImgCachePath get instance => _getInstance(); + + static ImgCachePath _instance; + + String _path; + + String get path => _path; + + ImgCachePath._internal(){ + fileFromDocsDir(); + } + + fileFromDocsDir() async { + Directory tempDir = await getTemporaryDirectory(); + Directory directory = new Directory('${tempDir.path}/ImgCache'); + if (!directory.existsSync()) { + directory.createSync(); + } + _path = directory.path; + } + + static ImgCachePath _getInstance(){ + if(_instance == null){ + _instance = ImgCachePath._internal(); + } + return _instance; + } +} \ No newline at end of file diff --git a/lib/view_widget/activity_coupons.dart b/lib/view_widget/activity_coupons.dart new file mode 100644 index 00000000..eeb6357b --- /dev/null +++ b/lib/view_widget/activity_coupons.dart @@ -0,0 +1,256 @@ +import 'dart:collection'; +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/coupon.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class ActivityCoupons extends StatefulWidget { + final String result; + + ActivityCoupons(this.result); + + @override + State createState() { + return _ActivityCoupons(); + } +} + +class _ActivityCoupons extends State { + var resultData; + int pageNum = 1; + List coupons = []; + ApiService apiService; + var receiveCou = new Queue(); + + @override + void initState() { + super.initState(); + resultData = jsonDecode(widget.result); + } + + receiveCoupon() async { + var id = receiveCou.removeFirst(); + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData baseData = await apiService.receiveCoupon(id).catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + if (receiveCou.length > 0) { + receiveCoupon(); + } else { + Navigator.of(context).pop(); + SmartDialog.showToast("领取成功", alignment: Alignment.center); + } + } + else{ + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + Navigator.of(context).pop(); + } + } + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(top: 150.h), + height: MediaQuery.of(context).size.height / 2, + child: Column( + children: [ + Container( + width: double.infinity, + height: MediaQuery.of(context).size.height / 2, + padding: EdgeInsets.only(top: 210.h), + margin: EdgeInsets.only(top: 20.h, left: 20, right: 20), + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage("assets/image/activity_q.png"), + ), + ), + child: Column( + children: [ + Expanded( + child: couponsActivity(), + ), + GestureDetector( + onTap: () { + (resultData["list"] as List).forEach((element) { + receiveCou..add(element["id"]); + }); + receiveCoupon(); + }, + child: Container( + margin: EdgeInsets.only( + left: 60.w, right: 60.w, top: 20.h, bottom: 20.h), + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [ + Color(0xFFFFDCA1), + Color(0xFFFAE4C0), + ]), + borderRadius: BorderRadius.circular(22.5), + ), + width: MediaQuery.of(context).size.width, + height: 40, + alignment: Alignment.center, + child: Text( + "立即领取", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 14.sp, + color: Color(0xFF4A4748), + ), + ), + ), + ), + ], + ), + ), + SizedBox(height: 35), + GestureDetector( + onTap: () { + setState(() { + Navigator.of(context).pop(); + }); + }, + child: Image.asset( + "assets/image/yq_qx.png", + width: 34, + height: 34, + ), + ) + ], + ), + ); + } + + Widget couponsActivity() { + return ListView.builder( + padding: EdgeInsets.zero, + itemCount: (resultData == null || resultData["list"] == null) + ? 0 + : (resultData["list"] as List).length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () {}, + child: couponsItem(resultData["list"][position]), + ); + }, + ); + } + + Widget couponsItem(listData) { + return Container( + height: 69.h, + width: double.infinity, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage("assets/image/xin_rq.png"), + ), + ), + margin: EdgeInsets.symmetric(horizontal: 60, vertical: 5), + padding: EdgeInsets.only(left: 16.w, right: 10.w), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + if (listData["type"] == 1) + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFFDE5F3B), + ), + ), + TextSpan( + text: listData["discount"] ?? "", + style: TextStyle( + fontSize: 20.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFFDE5F3B), + ), + ), + ], + ), + ), + if (listData["type"] == 3) + Text( + "兑换券", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFFDE5F3B), + ), + ), + if (listData["type"] == 2) + Padding( + padding: EdgeInsets.only(right: 20), + child: Text.rich( + TextSpan( + children: [ + TextSpan( + text: (listData["percent"] / 10).toString() ?? "", + style: TextStyle( + fontSize: 25.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFFDE5F3B), + ), + ), + TextSpan( + text: "折", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFFDE5F3B), + ), + ), + ], + ), + )), + Expanded( + child: Padding( + padding: EdgeInsets.only(top: 4, bottom: 4, left: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + listData["name"] ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF181818), + ), + ), + ], + ))), + ], + ), + ); + } +} diff --git a/lib/view_widget/custom_image.dart b/lib/view_widget/custom_image.dart index dbe05a58..4caaa7b9 100644 --- a/lib/view_widget/custom_image.dart +++ b/lib/view_widget/custom_image.dart @@ -1,8 +1,8 @@ import 'dart:io'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter/material.dart'; +import 'package:huixiang/utils/ImgCachePath.dart'; +import 'package:network_to_file_image/network_to_file_image.dart'; +import 'package:path/path.dart' as p; class MImage extends StatelessWidget { final String src; @@ -29,17 +29,33 @@ class MImage extends StatelessWidget { this.radius = BorderRadius.zero, }); + File fileFromDocsDir(String filename) { + String pathName = p.join(ImgCachePath.instance.path, filename); + return File(pathName); + } + @override Widget build(BuildContext context) { Widget image = LayoutBuilder( builder: (context, constraints) { String imageUrl = ""; - if (src != null && src != "" && src.startsWith("http")) { - imageUrl = - "$src?imageMogr2/thumbnail/${constraints.constrainWidth() * scaleIndex}" - "x${constraints.constrainHeight() * scaleIndex}/format/webp/quality/100"; + ///压缩图片 + // if (src != null && src != "" && src.startsWith("http")) { + // String oper = src.contains("?") ? "" :"?"; + // imageUrl = + // "$src$oper/imageMogr2/thumbnail/${constraints.constrainWidth() * scaleIndex}" + // "x${constraints.constrainHeight() * scaleIndex}/format/webp/quality/100"; + // } + int _w = ((constraints.constrainWidth()==double.infinity? + MediaQuery.of(context).size.width:constraints.constrainWidth()) * scaleIndex).toInt(); + int _h = ((constraints.constrainHeight()==double.infinity? + MediaQuery.of(context).size.height:constraints.constrainHeight()) * scaleIndex).toInt(); + ///压缩图片 + if ((src??"").startsWith("http")) { + imageUrl = "$src?imageView2/1/w/${_w}/h/${_h}/format/jpg/q/75"; } + // print("imageUrl:$imageUrl"); // print("constrainWidth: ${constraints.constrainWidth()}"); // print("constrainHeight: ${constraints.constrainHeight()}"); @@ -50,43 +66,38 @@ class MImage extends StatelessWidget { ); } Widget cachedNetworkImage; - if (src.startsWith("http")) { - cachedNetworkImage = CachedNetworkImage( - imageUrl: imageUrl, - cacheManager: DefaultCacheManager(), - fadeInDuration: Duration(milliseconds: 300), - fadeOutDuration: Duration(milliseconds: 300), - imageBuilder: (context, provide) { - return Image( - image: provide, - fit: fit, - ); - }, - errorWidget: (context, error, stackTrace) { - return Image.asset( - errorSrc, - fit: fit, - ); - }, - placeholder: (context, placeholder) { - return Image.asset( - fadeSrc, - fit: fit, - ); - }, - ); - } else if (src.startsWith("file")) { - cachedNetworkImage = Image.file( - File(src), - fit: fit, - errorBuilder: (context, error, stackTrace) { - return Image.asset( - errorSrc, - fit: fit, - ); - }, - ); - } + if (src.startsWith("http")) { + cachedNetworkImage = Image( + image: ResizeImage(NetworkToFileImage( + url: imageUrl, + file: fileFromDocsDir("resize"+src.replaceAll("https:", "") + .replaceAll("http:", "") + .replaceAll("pos.upload.gznl.top", "") + .replaceAll("/", "")), + debug: true, + ), + width: _w, + height: _h), + errorBuilder: (context, error, stackTrace) { + return Image.asset( + errorSrc, + fit: fit, + ); + }, + fit: fit, + ); + } else if (src.startsWith("file")) { + cachedNetworkImage = Image.file( + File(src), + fit: fit, + errorBuilder: (context, error, stackTrace) { + return Image.asset( + errorSrc, + fit: fit, + ); + }, + ); + } return cachedNetworkImage; }, ); diff --git a/lib/view_widget/item_input_widget.dart b/lib/view_widget/item_input_widget.dart index c79ba14f..a5e15006 100644 --- a/lib/view_widget/item_input_widget.dart +++ b/lib/view_widget/item_input_widget.dart @@ -147,7 +147,8 @@ class ItemInputWidget extends StatelessWidget { margin: EdgeInsets.only(left: 5, bottom: 12.h), ), Container( - height: 0.035.sh, + // height: 0.035.sh, + margin: EdgeInsets.only(bottom:10.h), child: TextField( controller: controller, style: style, diff --git a/lib/view_widget/login_tips.dart b/lib/view_widget/login_tips.dart index 50574fe7..62aa0c07 100644 --- a/lib/view_widget/login_tips.dart +++ b/lib/view_widget/login_tips.dart @@ -19,8 +19,11 @@ class LoginTips extends StatelessWidget { type: MaterialType.transparency, child: Center( child: Container( - width: 0.7867.sw, - height: 0.7867.sw / (Platform.isAndroid ? 0.86 : 0.9), + // width: 0.7867.sw, + // height: 0.7867.sw / (Platform.isAndroid ? 0.86 : 0.9), + width:double.infinity, + height:MediaQuery.of(context).size.width / 1, + margin: EdgeInsets.symmetric(horizontal:28.w), padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w), decoration: BoxDecoration( color: Colors.white, @@ -33,8 +36,8 @@ class LoginTips extends StatelessWidget { children: [ Image.asset( "assets/image/icon_login_tips.png", - width: 0.7867.sw * 0.6, - height: 0.7867.sw * 0.6 * 0.7, + // width: 0.7867.sw * 0.6, + // height: 0.7867.sw * 0.6 * 0.7, fit: BoxFit.fill, ), SizedBox( diff --git a/lib/view_widget/new_people_reward.dart b/lib/view_widget/new_people_reward.dart index 8f1d68bc..d2f89108 100644 --- a/lib/view_widget/new_people_reward.dart +++ b/lib/view_widget/new_people_reward.dart @@ -1,17 +1,13 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/login_info.dart'; -import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/font_weight.dart'; -import 'package:huixiang/view_widget/round_button.dart'; -import 'package:huixiang/view_widget/separator.dart'; class NewPeopleReward extends StatefulWidget { - final List newUserCouponList; + final List firstLoginCouponList; - NewPeopleReward(this.newUserCouponList); + NewPeopleReward(this.firstLoginCouponList); @override State createState() { @@ -97,22 +93,22 @@ class _NewPeopleReward extends State { Widget reward() { return ListView.builder( padding: EdgeInsets.zero, - itemCount: widget.newUserCouponList.length, + itemCount: widget.firstLoginCouponList.length, scrollDirection: Axis.vertical, shrinkWrap: true, physics: BouncingScrollPhysics(), itemBuilder: (context, position) { return GestureDetector( onTap: () {}, - child: rewardItem(widget.newUserCouponList[position]), + child: rewardItem(widget.firstLoginCouponList[position]), ); }, ); } - Widget rewardItem(NewUserCouponList newUserCouponList) { + Widget rewardItem(FirstLoginCouponList firstLoginCouponList) { return Container( - height: 69.h, + height:90.h, width: double.infinity, decoration: BoxDecoration( image: DecorationImage( @@ -139,7 +135,7 @@ class _NewPeopleReward extends State { ), TextSpan( text: double.tryParse( - "${newUserCouponList.discountAmount}" ?? "0") + "${firstLoginCouponList.discountAmount}" ?? "0") .toInt() .toString() ?? "", @@ -153,13 +149,13 @@ class _NewPeopleReward extends State { ), ), Expanded(child:Padding( - padding: EdgeInsets.only(top: 4, bottom: 4,left:10), + padding: EdgeInsets.only(top: 4, bottom: 4,left:30), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - newUserCouponList.storeName, + firstLoginCouponList.storeName, overflow: TextOverflow.ellipsis, maxLines: 2, style: TextStyle( @@ -169,9 +165,9 @@ class _NewPeopleReward extends State { ), ), Text( - newUserCouponList.couponName, + firstLoginCouponList.couponName, overflow: TextOverflow.ellipsis, - maxLines: 2, + maxLines: 1, style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.medium, @@ -179,9 +175,9 @@ class _NewPeopleReward extends State { ), ), Text( - "有效期至:${(newUserCouponList.useEndTime != null && newUserCouponList.useEndTime != "") - ? newUserCouponList.useEndTime.split(" ")[0] - : "$newUserCouponList.useEndTime"}", + "有效期至:${(firstLoginCouponList.useEndTime != null && firstLoginCouponList.useEndTime != "") + ? firstLoginCouponList.useEndTime.split(" ")[0] + : "$firstLoginCouponList.useEndTime"}", overflow: TextOverflow.ellipsis, maxLines: 2, style: TextStyle( diff --git a/lib/view_widget/request_permission.dart b/lib/view_widget/request_permission.dart index 9558dd43..e02beb4d 100644 --- a/lib/view_widget/request_permission.dart +++ b/lib/view_widget/request_permission.dart @@ -37,7 +37,9 @@ class _RequestPermission extends State { type: MaterialType.transparency, child: Center( child: Container( - width: widget.width ?? 0.7867.sw, + // width: widget.width ?? 0.7867.sw, + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal: 24.w), padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w), decoration: BoxDecoration( color: Colors.white, @@ -50,8 +52,8 @@ class _RequestPermission extends State { children: [ Image.asset( widget.src, - width: 0.7867.sw * 0.6, - height: 0.7867.sw * 0.6 * 0.7, + // width: 0.7867.sw * 0.6, + // height: 0.7867.sw * 0.6 * 0.7, fit: BoxFit.fill, ), SizedBox( diff --git a/lib/view_widget/text_image_dialog.dart b/lib/view_widget/text_image_dialog.dart index 825171fb..074f64ce 100644 --- a/lib/view_widget/text_image_dialog.dart +++ b/lib/view_widget/text_image_dialog.dart @@ -37,7 +37,8 @@ class _TextImageWidget extends State { type: MaterialType.transparency, child: Center( child: Container( - width: widget.width ?? 0.7867.sw, + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal:26.w), padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w), decoration: BoxDecoration( color: Colors.white, @@ -50,8 +51,8 @@ class _TextImageWidget extends State { children: [ Image.asset( widget.src, - width: 0.7867.sw * 0.9, - height: 0.7867.sw * 0.9 * 0.7, + // width: 0.7867.sw * 0.9, + // height: 0.7867.sw * 0.9 * 0.7, fit: BoxFit.fill, ), SizedBox( diff --git a/lib/web/web_view/comment_list.dart b/lib/web/web_view/comment_list.dart index b78968b2..68d92bb6 100644 --- a/lib/web/web_view/comment_list.dart +++ b/lib/web/web_view/comment_list.dart @@ -131,7 +131,6 @@ class CommentListState extends State { ), if (memberList != null && memberList.length > 0) Container( - height: commentHeight, decoration: BoxDecoration( color: Color(0xFFF2F2F2), boxShadow: [ @@ -144,7 +143,7 @@ class CommentListState extends State { ], ), alignment: Alignment.topCenter, - padding: EdgeInsets.only(top: 22.h), + padding: EdgeInsets.only(top: 22.h, bottom: 22.h), child: Text( S.of(context).yixiansquanbupinglun, style: TextStyle( diff --git a/pubspec.lock b/pubspec.lock index ccd41931..eede16d8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -50,13 +50,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.1.6" - cached_network_image: - dependency: "direct main" - description: - name: cached_network_image - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.0" characters: dependency: transitive description: @@ -209,13 +202,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.4" - flutter_cache_manager: - dependency: transitive - description: - name: flutter_cache_manager - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.3" flutter_easyloading: dependency: "direct main" description: @@ -269,7 +255,7 @@ packages: name: flutter_screenutil url: "https://pub.flutter-io.cn" source: hosted - version: "5.0.3" + version: "5.1.0" flutter_smart_dialog: dependency: "direct main" description: @@ -350,13 +336,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.15.0" - http: - dependency: transitive - description: - name: http - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.12.2" http_parser: dependency: transitive description: @@ -434,6 +413,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" + network_to_file_image: + dependency: "direct main" + description: + name: network_to_file_image + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.3.8" numerus: dependency: transitive description: @@ -677,20 +663,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.8.1" - sqflite: - dependency: transitive - description: - name: sqflite - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.3.2+4" - sqflite_common: - dependency: transitive - description: - name: sqflite_common - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.3+3" stack_trace: dependency: transitive description: @@ -712,13 +684,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" - synchronized: - dependency: transitive - description: - name: synchronized - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.2.0+2" term_glyph: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 4eacd0fa..383dc45c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -60,12 +60,12 @@ dependencies: #多图, 裁剪 image_pickers: ^2.0.0 -# flutter_scankit: ^1.2.0 + # flutter_scankit: ^1.2.0 # qrscan: ^0.3.1 scan: ^1.5.0 path_provider: ^1.2.0 - cached_network_image: ^2.0.0 + network_to_file_image: ^2.0.0 flutter_html: ^2.1.5 #2.1.0 chewie_audio: ^1.1.2