diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 1a8ccb08..e8e3aca3 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -616,7 +616,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 87; + CURRENT_PROJECT_VERSION = 93; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -666,7 +666,7 @@ "$(PROJECT_DIR)/baidu", "$(PROJECT_DIR)/Runner/baidu", ); - MARKETING_VERSION = 1.0.87; + MARKETING_VERSION = 1.0.93; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "$(inherited)", @@ -816,7 +816,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 87; + CURRENT_PROJECT_VERSION = 93; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -866,7 +866,7 @@ "$(PROJECT_DIR)/baidu", "$(PROJECT_DIR)/Runner/baidu", ); - MARKETING_VERSION = 1.0.87; + MARKETING_VERSION = 1.0.93; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "$(inherited)", @@ -907,7 +907,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 87; + CURRENT_PROJECT_VERSION = 93; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -957,7 +957,7 @@ "$(PROJECT_DIR)/baidu", "$(PROJECT_DIR)/Runner/baidu", ); - MARKETING_VERSION = 1.0.87; + MARKETING_VERSION = 1.0.93; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "$(inherited)", diff --git a/lib/community/community_child_page.dart b/lib/community/community_child_page.dart index 36f51ba6..76c67f54 100644 --- a/lib/community/community_child_page.dart +++ b/lib/community/community_child_page.dart @@ -34,8 +34,9 @@ class CommunityChildPageState extends State with AutomaticKe int pageNum = 1; String userId; bool isLoadMore = false; + bool isRefresh = true; + bool isLoadingData = false; ScrollController sc = ScrollController(); - List
articles = []; @override @@ -52,7 +53,15 @@ class CommunityChildPageState extends State with AutomaticKe } ///动态列表 - queryCommunity() async { + queryCommunity(String searchKey) async { + if(!isRefresh){ + isRefresh = true; + return; + } + if(isLoadingData){ + return; + } + isLoadingData = true; if (apiService == null) { SharedPreferences value = await SharedPreferences.getInstance(); userId = value.getString('userId'); @@ -60,60 +69,88 @@ class CommunityChildPageState extends State with AutomaticKe Dio(), context: context, token: value.getString("token"), + showLoading: false ); } if(isLoadMore){ pageNum += 1; isLoadMore = false; } - else pageNum = 1; + else if(searchKey == null)pageNum = 1; BaseData> baseData = await apiService.trendList({ "mid":"", "onlyFollow": widget.typeStr == "关注" ? true : false, "onlyMe": false, - "pageNum": pageNum, + "pageNum": searchKey == null?pageNum:1, "pageSize": 10, - "searchKey": "" + "searchKey": searchKey??"" }).catchError((error) { - refreshController.refreshFailed(); - refreshController.loadFailed(); + if(searchKey == null) { + refreshController.refreshFailed(); + refreshController.loadFailed(); + } }); - - refreshController.refreshCompleted(); - refreshController.loadComplete(); + if(searchKey == null) { + refreshController.refreshCompleted(); + refreshController.loadComplete(); + } if (baseData.isSuccess) { - if (pageNum == 1) { - articles.clear(); - } - baseData.data.list.forEach((element) { - var article = Article(); - article.id = element.id; - article.content = jsonEncode(element.subjectInfo); - article.mainTitle =element.subject; - article.followed = element.selfFollow; - article.authorHeadImg = element.memberInfo?.avatar; - article.authorName = element.memberInfo?.nickname; - article.location = element.location; - article.createTime = element.createTime; - article.author = 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}"); - if (int.tryParse(baseData.data.total) < (pageNum * 10)) { - refreshController.loadNoData(); + if(searchKey != null){ + if(baseData?.data?.list != null && baseData.data.list.isNotEmpty) + articles.forEach((element) { + if(element.id == searchKey){ + element.content = jsonEncode(baseData.data.list[0].subjectInfo); + element.mainTitle =baseData.data.list[0].subject; + element.followed = baseData.data.list[0].selfFollow; + element.authorHeadImg = baseData.data.list[0].memberInfo?.avatar; + element.authorName = baseData.data.list[0].memberInfo?.nickname; + element.location = baseData.data.list[0].location; + element.createTime = baseData.data.list[0].createTime; + element.author = baseData.data.list[0].memberInfo?.mid; + element.viewers = baseData.data.list[0]?.viewers; + element.likes = baseData.data.list[0]?.likes; + element.comments = baseData.data.list[0]?.comments; + this.isRefresh = false; + setState(() { + }); + } + }); + }else{ + if (pageNum == 1) { + articles.clear(); + } + baseData.data.list.forEach((element) { + var article = Article(); + article.id = element.id; + article.content = jsonEncode(element.subjectInfo); + article.mainTitle =element.subject; + article.followed = element.selfFollow; + article.authorHeadImg = element.memberInfo?.avatar; + article.authorName = element.memberInfo?.nickname; + article.location = element.location; + article.createTime = element.createTime; + article.author = 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}"); + if (int.tryParse(baseData.data.total) < (pageNum * 10)) { + refreshController.loadNoData(); + } } } + + isLoadingData = false; } @override Widget build(BuildContext context) { super.build(context); return FutureBuilder( - future: queryCommunity(), + future: queryCommunity(null), builder: (context, position) { return SmartRefresher( controller: refreshController, diff --git a/lib/community/community_course.dart b/lib/community/community_course.dart index 888d1667..b0d2e410 100644 --- a/lib/community/community_course.dart +++ b/lib/community/community_course.dart @@ -253,7 +253,7 @@ class _CommunityCourse extends State ///课程banner CourseBanner(bannerData,), - SizedBox(height: 28), + SizedBox(height: 28.h), ///合集列表 HomeClass(collectMap,collectList,), diff --git a/lib/community/community_page.dart b/lib/community/community_page.dart index f9d5ccde..c9b76326 100644 --- a/lib/community/community_page.dart +++ b/lib/community/community_page.dart @@ -80,7 +80,7 @@ class _CommunityPage extends State leading: false, titleChild: PreferredSize( preferredSize: Size( - MediaQuery.of(context).size.width - 60, + MediaQuery.of(context).size.width - 60.w, 38.h, ), child: TabBar( @@ -92,12 +92,12 @@ class _CommunityPage extends State labelPadding: EdgeInsets.only(left: 8.w, right: 8.w), indicatorSize: TabBarIndicatorSize.label, unselectedLabelStyle: TextStyle( - fontSize: 15.sp, + fontSize: MediaQuery.of(context).size.width >= 650 ? 10.sp : 15.sp, fontWeight: FontWeight.w400, ), labelStyle: TextStyle( color: Colors.black, - fontSize: 18.sp, + fontSize: MediaQuery.of(context).size.width >= 650 ? 12.sp : 18.sp, fontWeight: FontWeight.bold, ), labelColor: Colors.black, diff --git a/lib/community/community_view/community_dynamic.dart b/lib/community/community_view/community_dynamic.dart index fe7c2a9a..ac2b0921 100644 --- a/lib/community/community_view/community_dynamic.dart +++ b/lib/community/community_view/community_dynamic.dart @@ -159,10 +159,10 @@ class _CommunityDynamic extends State { return Column( children: [ Container( - margin: EdgeInsets.only(top: 2), + margin: EdgeInsets.only(top: 2.h), key: globalKey, alignment: Alignment.topCenter, - padding: EdgeInsets.only(left: 16,top: 16,right: 16), + padding: EdgeInsets.only(left: 16.w,top: 16.h,right: 16.w), decoration: BoxDecoration( color: Colors.white, boxShadow: [ @@ -184,7 +184,7 @@ class _CommunityDynamic extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( - height: 44, + // height: 44.h, child: Row( children: [ GestureDetector( @@ -213,7 +213,7 @@ class _CommunityDynamic extends State { ), ), SizedBox( - width: 8, + width: 8.w, ), Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, @@ -222,7 +222,7 @@ class _CommunityDynamic extends State { Text( widget?.article?.authorName ?? "", style: TextStyle( - fontSize: 15.sp, + fontSize: MediaQuery.of(context).size.width >= 650 ? 12.sp :15.sp, fontWeight: MyFontWeight.semi_bold, color: Color(0xFF1A1A1A), ), @@ -230,7 +230,7 @@ class _CommunityDynamic extends State { Text( widget?.article?.createTime ?? "", style: TextStyle( - fontSize: 13.sp, + fontSize: MediaQuery.of(context).size.width >= 650 ? 10.sp :13.sp, fontWeight: MyFontWeight.regular, color: Color(0xFF808080), ), @@ -317,29 +317,30 @@ class _CommunityDynamic extends State { height:8.h, ), if (widget.article.location != "") - Row( - children: [ - Icon( - Icons.place, - size: 16, - color: Color(0xFFB3B2B2), - ), - SizedBox( - width: 2, - ), - Expanded( - child: Text( - widget?.article?.location ?? "", - overflow: TextOverflow.ellipsis, - maxLines: 1, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFFB3B2B2), - ), - )), - ], - ), + Padding(padding:EdgeInsets.only(bottom:7), + child: Row( + children: [ + Icon( + Icons.place, + size: 16, + color: Color(0xFFB3B2B2), + ), + SizedBox( + width: 2, + ), + Expanded( + child: Text( + widget?.article?.location ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFFB3B2B2), + ), + )), + ], + ),), if (!widget.isDetails) SizedBox( height: 5.h, @@ -353,7 +354,7 @@ class _CommunityDynamic extends State { children: [ Expanded( child: Container( - padding: EdgeInsets.only(bottom: 16), + padding: EdgeInsets.only(bottom: 16.h), child:Row( // mainAxisAlignment: MainAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center, @@ -364,7 +365,7 @@ class _CommunityDynamic extends State { height: 16, ), SizedBox( - width: 5, + width: 5.w, ), Text( (widget.article != null) @@ -381,7 +382,7 @@ class _CommunityDynamic extends State { ), Expanded( child:Container( - padding: EdgeInsets.only(bottom: 16), + padding: EdgeInsets.only(bottom: 16.h), child:Row( // mainAxisAlignment: MainAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center, @@ -392,7 +393,7 @@ class _CommunityDynamic extends State { height: 16, ), SizedBox( - width: 5, + width: 5.w, ), Text( "${widget.article.comments ?? 0}", @@ -406,7 +407,7 @@ class _CommunityDynamic extends State { ))), Expanded( child:Container( - padding: EdgeInsets.only(bottom: 16), + padding: EdgeInsets.only(bottom: 16.h), child:Row( // mainAxisAlignment: MainAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center, @@ -417,7 +418,7 @@ class _CommunityDynamic extends State { height: 16, ), SizedBox( - width: 5, + width: 5.w, ), Text( "${widget.article.likes ?? 0}", @@ -440,7 +441,7 @@ class _CommunityDynamic extends State { }); }, child: Container( - padding: EdgeInsets.only(top:3,bottom: 16), + padding: EdgeInsets.only(top:3.h,bottom: 16.h), alignment: Alignment.center, // color: Colors.red, child: Icon( @@ -454,7 +455,7 @@ class _CommunityDynamic extends State { ), ), Container( - height: 16, + height: 16.h, color: Color(0xFFF7F7F7), ), ], @@ -789,7 +790,7 @@ class _CommunityDynamic extends State { child: Column( children: [ SizedBox( - height: 10, + height: 10.h, ), GestureDetector( onTap: () { @@ -802,7 +803,7 @@ class _CommunityDynamic extends State { child: Row( children: [ SizedBox( - width: 4, + width: 4.w, ), Image.asset( "assets/image/icon_share.webp", @@ -812,7 +813,7 @@ class _CommunityDynamic extends State { color: Color(0xff515151), ), SizedBox( - width: 12, + width: 12.w, ), Text( S.of(context).fenxiang, @@ -843,7 +844,7 @@ class _CommunityDynamic extends State { child: Row( children: [ SizedBox( - width: 4, + width: 4.w, ), SvgPicture.asset( "assets/svg/ju_b.svg", @@ -851,7 +852,7 @@ class _CommunityDynamic extends State { height: 20, ), SizedBox( - width: 15, + width: 15.w, ), Text( S.of(context).jubaogaineirong, diff --git a/lib/community/community_view/home_class.dart b/lib/community/community_view/home_class.dart index 0c395342..add55a71 100644 --- a/lib/community/community_view/home_class.dart +++ b/lib/community/community_view/home_class.dart @@ -48,7 +48,7 @@ class _HomeClass extends State { Widget collectItem(CollectClassList collectList) { return Container( - width: 168, + width: 168.w, // height: 250, margin: EdgeInsets.symmetric( horizontal: 6.w, @@ -58,7 +58,7 @@ class _HomeClass extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.only(left: 16, top: 5), + padding: EdgeInsets.only(left: 16.w, top: 5.h), child: Text( collectList.name, style: TextStyle( @@ -70,11 +70,11 @@ class _HomeClass extends State { ), Container( height: 195, - margin: EdgeInsets.only(top: 10), + margin: EdgeInsets.only(top: 10.h), child: ListView.builder( scrollDirection: Axis.horizontal, physics: BouncingScrollPhysics(), - padding: EdgeInsets.symmetric(horizontal: 10), + padding: EdgeInsets.symmetric(horizontal: 10.w), itemCount: widget.collectMap[collectList.id] == null ? 0 : widget.collectMap[collectList.id].length, @@ -105,8 +105,8 @@ class _HomeClass extends State { Widget classItem(CourseList collect) { return Container( - width: 168, - height: 195, + width: 168.w, + height: 195.h, decoration: BoxDecoration( borderRadius: BorderRadius.vertical( bottom: Radius.circular(4), @@ -122,7 +122,7 @@ class _HomeClass extends State { color: Colors.white, ), margin: EdgeInsets.symmetric( - horizontal: 6, + horizontal: 6.w, ), child: Column( children: [ @@ -154,7 +154,7 @@ class _HomeClass extends State { child: MImage( collect.coverImg, width: double.infinity, - height: 120, + height: 120.h, fit: BoxFit.cover, errorSrc: "assets/image/default_1.webp", fadeSrc: "assets/image/default_1.webp", @@ -179,7 +179,7 @@ class _HomeClass extends State { height: 16.h, color: Colors.white, ), - SizedBox(width: 5), + SizedBox(width: 5.w), Text( collect.viewers.toString(), style: TextStyle( @@ -190,7 +190,7 @@ class _HomeClass extends State { ), ], ), - SizedBox(width: 8), + SizedBox(width: 8.w), // Row( // children: [ // Image.asset( @@ -219,8 +219,8 @@ class _HomeClass extends State { children: [ Spacer(), Container( - margin: EdgeInsets.only(top: 8, right: 8), - padding: EdgeInsets.only(left: 2, right: 2), + margin: EdgeInsets.only(top: 8.h, right: 8.w), + padding: EdgeInsets.only(left: 2.w, right: 2.w), height: 20.h, alignment: Alignment.center, decoration: BoxDecoration( @@ -245,7 +245,7 @@ class _HomeClass extends State { ), Expanded( child: Container( - padding: EdgeInsets.all(8), + padding: EdgeInsets.all(8.w), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, @@ -268,7 +268,7 @@ class _HomeClass extends State { ), ], ), - SizedBox(height: 2), + SizedBox(height: 2.h), Text( "${S.of(context).jiangshi}:${collect.author.name}", overflow: TextOverflow.ellipsis, diff --git a/lib/community/headlines/article_list.dart b/lib/community/headlines/article_list.dart index ff315e7e..4dca7c8b 100644 --- a/lib/community/headlines/article_list.dart +++ b/lib/community/headlines/article_list.dart @@ -38,13 +38,13 @@ class _ArticleList extends State { @override Widget build(BuildContext context) { return Container( - margin: EdgeInsets.only(top: 20, left: 16, right: 16), + margin: EdgeInsets.only(top: 20.h, left: 16.w, right: 16.w), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Padding( - padding: EdgeInsets.only(bottom: 12), + padding: EdgeInsets.only(bottom: 12.h), child: Text( S.of(context).zuixinwenzhang, overflow: TextOverflow.ellipsis, @@ -82,7 +82,7 @@ class _ArticleList extends State { return Container( width: double.infinity, padding: EdgeInsets.all(16), - margin: EdgeInsets.only(bottom: 12), + margin: EdgeInsets.only(bottom: 12.h), color: Colors.white, child: Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -90,7 +90,7 @@ class _ArticleList extends State { children: [ Expanded( child: Container( - height: 105, + height: MediaQuery.of(context).size.width >= 650 ? 133.h :105, child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceAround, @@ -105,11 +105,11 @@ class _ArticleList extends State { color: Colors.black, ), ), - SizedBox(height:5), + SizedBox(height:5.h), Text( widget?.articles[position]?.viceTitle ?? "", overflow: TextOverflow.ellipsis, - maxLines: 3, + maxLines: 2, style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.regular, @@ -132,7 +132,7 @@ class _ArticleList extends State { ), ), ), - SizedBox(width: 8), + SizedBox(width: 8.w), Image.asset( "assets/image/browse.webp", width: 14, diff --git a/lib/community/release_dynamic.dart b/lib/community/release_dynamic.dart index d3aef942..540f5d4d 100644 --- a/lib/community/release_dynamic.dart +++ b/lib/community/release_dynamic.dart @@ -103,7 +103,7 @@ class _ReleaseDynamic extends State { overflow: TextOverflow.ellipsis, style: TextStyle( fontWeight: MyFontWeight.semi_bold, - fontSize: 18.sp, + fontSize: 14.sp, color: Colors.red, ), ), @@ -117,8 +117,8 @@ class _ReleaseDynamic extends State { overflow: TextOverflow.ellipsis, style: TextStyle( fontWeight: MyFontWeight.medium, - fontSize: 14.sp, - color: Colors.black, + fontSize: 12.sp, + color: Color(0xFFB3B2B2), ), ), ) @@ -164,7 +164,7 @@ class _ReleaseDynamic extends State { SmartDialog.showToast("请输入您此刻的想法!"); return; } - EasyLoading.show(status: S.of(context).zhengzaijiazai); + EasyLoading.show(status: "上传中"); fileUpload().then((value) async { String subjectType = "text"; diff --git a/lib/home/guide_page.dart b/lib/home/guide_page.dart index 8afcbc28..fdb3b8b6 100644 --- a/lib/home/guide_page.dart +++ b/lib/home/guide_page.dart @@ -309,7 +309,7 @@ class _GuidePage extends State { fit: BoxFit.fill, ), SizedBox( - height: 66.h, + height: MediaQuery.of(context).size.width >= 650 ? 20.h :66.h, ), Container( alignment: Alignment.center, @@ -323,7 +323,7 @@ class _GuidePage extends State { ), ), SizedBox( - height: 23.h, + height: MediaQuery.of(context).size.width >= 650 ? 15.h :23.h, ), Padding( padding: EdgeInsets.only(left: 52.w, right: 52.w), diff --git a/lib/home/huixiang_view/huixiang_banner.dart b/lib/home/huixiang_view/huixiang_banner.dart index e4361723..a57b800c 100644 --- a/lib/home/huixiang_view/huixiang_banner.dart +++ b/lib/home/huixiang_view/huixiang_banner.dart @@ -83,11 +83,11 @@ class _HuiXiangBanner extends State { break; case 4: String router = bannerData.content; + // String router = "/router/store_order?{\"id\":\"1512378184161558528\",\"tenant\":\"1188\",\"storeName\":\"农场煮意\"}"; if (router.contains("?")) { - String params = router.substring(router.indexOf("?")); - params = params.replaceAll("?", ""); + String params = router.substring(router.indexOf("?")+1); Map map = jsonDecode(params); - Navigator.of(context).pushNamed(router, arguments: map); + Navigator.of(context).pushNamed(router.substring(0,router.indexOf("?")), arguments: map); } else { Navigator.of(context).pushNamed(router); } diff --git a/lib/login/login_page.dart b/lib/login/login_page.dart index 23671846..490debd7 100644 --- a/lib/login/login_page.dart +++ b/lib/login/login_page.dart @@ -1066,7 +1066,7 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { context: context, builder: (BuildContext context) { return SimpleDialog( - titlePadding: EdgeInsets.all(10), + titlePadding: EdgeInsets.all(10.h), backgroundColor: Colors.transparent, elevation: 0, shape: RoundedRectangleBorder( @@ -1079,7 +1079,7 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { Container( alignment: Alignment.center, width: double.infinity, - height: 305.h, + height: MediaQuery.of(context).size.width >= 650 ? 410.h :305.h, padding: EdgeInsets.only(left: 16.w, right: 16.w), decoration: new BoxDecoration( color: Colors.white, @@ -1105,7 +1105,7 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { style: TextStyle( fontWeight: MyFontWeight.medium, fontSize: 14.sp, - height: 1.3.h, + height: 1.2.h, color: Color(0xff727272), ), ), @@ -1124,14 +1124,14 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { ]), ), SizedBox( - height: 10.h, + height: 5.h, ), Text( S.of(context).yinsizhengce2, style: TextStyle( color: Color(0xff727272), fontSize: 14.sp, - height: 1.3.h, + height: 1.2.h, fontWeight: MyFontWeight.medium, ), ), @@ -1155,8 +1155,8 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { margin: EdgeInsets.only(bottom: 20.h), child: BorderText( padding: EdgeInsets.only( - top: 10.h, - bottom: 10.h, + top: 5.h, + bottom: 5.h, left: 36.w, right: 36.w, ), @@ -1192,8 +1192,8 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { ); }, padding: EdgeInsets.only( - top: 10.h, - bottom: 10.h, + top: 5.h, + bottom: 5.h, left: 21.5.w, right: 21.5.w, ), diff --git a/lib/main_page.dart b/lib/main_page.dart index 102e6dce..439adf98 100644 --- a/lib/main_page.dart +++ b/lib/main_page.dart @@ -5,12 +5,14 @@ import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'package:flutter_bmflocation/bdmap_location_flutter_plugin.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:huixiang/community/community_page.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/home/home_page.dart'; import 'package:huixiang/main.dart'; import 'package:huixiang/mine/mine_page.dart'; +import 'package:huixiang/retrofit/data/app_update.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; @@ -18,8 +20,11 @@ import 'package:huixiang/union/union_page.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/utils/bridge.dart'; import 'package:huixiang/utils/event_type.dart'; +import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/native_event_handler.dart'; +import 'package:huixiang/view_widget/update_dialog.dart'; +import 'package:package_info/package_info.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:sharesdk_plugin/sharesdk_interface.dart'; @@ -47,6 +52,8 @@ class _MainPage extends State with WidgetsBindingObserver { final GlobalKey homePageKey = GlobalKey(); final GlobalKey minePageKey = GlobalKey(); // List iconn; + ApiService apiService; + @override void dispose() { @@ -74,7 +81,6 @@ class _MainPage extends State with WidgetsBindingObserver { void initState() { super.initState(); WidgetsBinding.instance.addObserver(this); - EasyLoading.instance ..indicatorType = EasyLoadingIndicatorType.circle // ..indicatorType = EasyLoadingIndicatorType.wave @@ -139,6 +145,8 @@ class _MainPage extends State with WidgetsBindingObserver { }); queryUserInfo(); + + appAutoUpdate(); } final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin(); initSdk() async { @@ -320,6 +328,44 @@ class _MainPage extends State with WidgetsBindingObserver { } } + ///app自动更新 + appAutoUpdate() async { + SharedPreferences value = await SharedPreferences.getInstance(); + if (apiService == null) { + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + PackageInfo packageInfo = await PackageInfo.fromPlatform(); + BaseData baseData = await apiService.appVersion().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + baseData.data.appLastVersion = "1.0.4"; + baseData.data.appLastVersionUp = "1.0.1"; + if(AppUtils.versionCompare(packageInfo.version,baseData.data?.appLastVersion) + && AppUtils.versionCompare(value.getString("appLastVersion")??"1.0.0",baseData.data?.appLastVersion)){ + showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return WillPopScope( + child:UpdateDialog(packageInfo.version,baseData.data), + onWillPop: () async { + return Future.value(false); + }); + }, + ); + }else{ + return; + } + }else{ + SmartDialog.showToast(baseData.msg, + alignment: Alignment.center); + Navigator.of(context).pop(); + } + } + final PageController pageController = PageController(initialPage: 0); @override diff --git a/lib/mine/personal_page.dart b/lib/mine/personal_page.dart index 574daf5c..95fa8e8f 100644 --- a/lib/mine/personal_page.dart +++ b/lib/mine/personal_page.dart @@ -30,6 +30,7 @@ class PersonalPage extends StatefulWidget { final Map arguments; PersonalPage({this.arguments}); + @override State createState() { return _PersonalPage(); @@ -47,10 +48,10 @@ class _PersonalPage extends State with WidgetsBindingObserver { MemberInfor memberInfor; String filePath; bool isLoadMore = false; + bool isRefresh = true; + bool isLoadingData = false; String memberId; - Map modifyInfo = { - "background": "" - }; + Map modifyInfo = {"background": ""}; @override void initState() { @@ -58,15 +59,17 @@ class _PersonalPage extends State with WidgetsBindingObserver { memberId = widget.arguments["memberId"]; WidgetsBinding.instance.addObserver(this); SharedPreferences.getInstance().then((value) => { - apiService = ApiService(Dio(), - context: context, token: value.getString('token')), - _onRefresh(), - }); + apiService = ApiService(Dio(), + context: context, + token: value.getString('token'), + showLoading: true), + _onRefresh(), + }); } _onRefresh() async { - queryCommunity(); - queryMember(memberId); + queryCommunity(null); + queryMember(memberId); } ///查询会员信息 @@ -80,7 +83,7 @@ class _PersonalPage extends State with WidgetsBindingObserver { ); } BaseData baseData = - await apiService.memberDetail(id).catchError((error) { + await apiService.memberDetail(id).catchError((error) { refreshController.refreshFailed(); }); if (baseData != null && baseData.isSuccess) { @@ -88,65 +91,106 @@ class _PersonalPage extends State with WidgetsBindingObserver { memberInfor = baseData.data; }); refreshController.refreshCompleted(); - }else { + } else { refreshController.refreshFailed(); } } ///动态列表 - queryCommunity() async { + queryCommunity(String searchKey) async { + if(!isRefresh){ + isRefresh = true; + return; + } + if(isLoadingData){ + return; + } + isLoadingData = true; if (apiService == null) { SharedPreferences value = await SharedPreferences.getInstance(); userId = value.getString('userId'); apiService = ApiService( - Dio(), - context: context, - token: value.getString("token"), + Dio(), + context: context, + token: value.getString("token"), + showLoading: false ); } if(isLoadMore){ pageNum += 1; isLoadMore = false; } - else pageNum = 1; + else if(searchKey == null)pageNum = 1; BaseData> baseData = await apiService.trendList({ - "mid":memberId == "0" ? userId : memberId, + "mid": memberId == "0" ? userId : memberId, "onlyFollow": false, "onlyMe": true, - "pageNum": pageNum, + "pageNum": searchKey == null?pageNum:1, "pageSize": 10, - "searchKey": "" + "searchKey": searchKey??"" }).catchError((error) { - refreshController.refreshFailed(); - refreshController.loadFailed(); + if(searchKey == null) { + refreshController.refreshFailed(); + refreshController.loadFailed(); + } }); + if(searchKey == null){ + refreshController.refreshCompleted(); + refreshController.loadComplete(); + } if (baseData.isSuccess) { - refreshController.refreshCompleted(); - refreshController.loadComplete(); - if (pageNum == 1) { - articles.clear(); + if(searchKey != null){ + if(baseData?.data?.list != null && baseData.data.list.isNotEmpty) + articles.forEach((element) { + if(element.id == searchKey){ + element.content = jsonEncode(baseData.data.list[0].subjectInfo); + element.mainTitle =baseData.data.list[0].subject; + element.followed = baseData.data.list[0].selfFollow; + element.authorHeadImg = baseData.data.list[0].memberInfo?.avatar; + element.authorName = baseData.data.list[0].memberInfo?.nickname; + element.location = baseData.data.list[0].location; + element.createTime = baseData.data.list[0].createTime; + element.author = baseData.data.list[0].memberInfo?.mid; + element.viewers = baseData.data.list[0]?.viewers; + element.likes = baseData.data.list[0]?.likes; + element.comments = baseData.data.list[0]?.comments; + this.isRefresh = false; + setState(() { + }); + } + }); } - baseData.data.list.forEach((element) { - var article = Article(); - article.id = element.id; - article.content = jsonEncode(element.subjectInfo); - article.mainTitle = element.subject; - article.followed = element.selfFollow; - article.authorHeadImg = element.memberInfo?.avatar; - article.authorName = element.memberInfo?.nickname; - article.location = element.location; - article.createTime = element.createTime; - article.author = 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(); + else{ + if (pageNum == 1) { + articles.clear(); + } + baseData.data.list.forEach((element) { + var article = Article(); + article.id = element.id; + article.content = jsonEncode(element.subjectInfo); + article.mainTitle =element.subject; + article.followed = element.selfFollow; + article.authorHeadImg = element.memberInfo?.avatar; + article.authorName = element.memberInfo?.nickname; + article.location = element.location; + article.createTime = element.createTime; + article.author = element.memberInfo?.mid; + article.viewers = element?.viewers; + article.likes = element?.likes; + article.comments = element?.comments; + articles.add(article); + }); + setState(() { + }); + // comments.sort((a,b)=>b.createTime.compareTo(a.createTime)); + // print("comments: ${comments.length}"); + if (int.tryParse(baseData.data.total) < (pageNum * 10)) { + refreshController.loadNoData(); + } } } + + isLoadingData = false; } ///去编辑个人资料 @@ -157,7 +201,9 @@ class _PersonalPage extends State with WidgetsBindingObserver { .pushNamed('/router/new_login_page', arguments: {"login": "login"}); return; } - await Navigator.of(context).pushNamed('/router/user_info_page').then((value) { + await Navigator.of(context) + .pushNamed('/router/user_info_page') + .then((value) { _onRefresh(); setState(() {}); }); @@ -265,7 +311,9 @@ class _PersonalPage extends State with WidgetsBindingObserver { ///文件上传 fileUpload() async { if (filePath != null && filePath != "" && await File(filePath).exists()) { - BaseData baseData = await apiService.upload(File(filePath), 123123123,false).catchError((onError) {}); + BaseData baseData = await apiService + .upload(File(filePath), 123123123, false) + .catchError((onError) {}); if (baseData != null && baseData.isSuccess) { UploadResult uploadResult = baseData.data; modifyInfo["background"] = uploadResult.url; @@ -297,450 +345,446 @@ class _PersonalPage extends State with WidgetsBindingObserver { scrollController: scrollController, child: SingleChildScrollView( physics: BouncingScrollPhysics(), - child:Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - height: 248, - color: Color(0xFFFFFFFF), - // color: Colors.red, - child: - Stack( - // alignment: Alignment.bottomLeft, - children: [ - Positioned( - top:0, - left: 0, - bottom: 36, - right: 0, - child:Stack( - alignment: Alignment.bottomRight, - children: [ - Container( - color: Colors.black, - child: Opacity( - opacity: 0.9, - child: MImage( - memberInfor?.background ?? "", - width: double.infinity, - height: 260.h, - fit: BoxFit.cover, - errorSrc: - "assets/image/default_1.webp", - fadeSrc: - "assets/image/default_1.webp", - ))), - Container( - margin: EdgeInsets.only( - top: 50.h, left: 16.w, right: 16.w), - alignment: Alignment.topLeft, - decoration: BoxDecoration( - color: Colors.transparent, - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - GestureDetector( - child: Image.asset( - "assets/image/integral_return.webp", - width: 24, - height: 24, - ), - onTap: () { - Navigator.of(context).pop(); - }, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: 248, + color: Color(0xFFFFFFFF), + // color: Colors.red, + child: Stack( + // alignment: Alignment.bottomLeft, + children: [ + Positioned( + top: 0, + left: 0, + bottom: 36, + right: 0, + child: Stack( + alignment: Alignment.bottomRight, + children: [ + Container( + color: Colors.black, + child: Opacity( + opacity: 0.9, + child: MImage( + memberInfor?.background ?? "", + width: double.infinity, + height: 260.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ))), + Container( + margin: EdgeInsets.only( + top: 50.h, left: 16.w, right: 16.w), + alignment: Alignment.topLeft, + decoration: BoxDecoration( + color: Colors.transparent, ), - ], - ), - ), - if(memberId == "0") - Positioned( - bottom: 9, - right: 16.w, - child:GestureDetector( - onTap: (){ - showImagePicker(); - }, - child:Container( - padding: EdgeInsets.only(left: 2, right: 2), - width: 59.w, - height: 23.h, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2), - color: Color(0x80000000), - ), - child: Text( - S.of(context).genghuanbeijing, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFFFFFFF), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + child: Image.asset( + "assets/image/integral_return.webp", + width: 24, + height: 24, + ), + onTap: () { + Navigator.of(context).pop(); + }, ), - ), + ], ), ), - ), - ], - ), - ), - homeInfo(), - ], - ), - ), - Container( - color: Color(0xFFFFFFFF), - child: - Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only( - left: 86, top: 12, right: 16), - child: GestureDetector( - onTap: () { - setState(() { - isShrink = !isShrink; - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Expanded( - flex: 1, - child: Text( - memberId == "0" ? ((memberInfor?.signature == "") ? "还未编辑个性签名~" : memberInfor?.signature ?? "") - :"个性签名: ${(memberInfor?.signature == "") ? "还未编辑个性签名~" :memberInfor?.signature ?? ""}", - overflow: isShrink - ? TextOverflow.visible - : TextOverflow.ellipsis, - maxLines: isShrink ? 10 : 2, - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF868686), - fontWeight: - MyFontWeight.regular, - height: 1.5), - )), - Icon( - (isShrink != null && !isShrink) - ? Icons.chevron_right - : Icons.keyboard_arrow_up, - color: Colors.black, - size: 18, - ), - ], - ), - )), - Container( - margin: EdgeInsets.only(left: 16, right: 16), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () {}, - child: Container( - color: Colors.transparent, - padding: EdgeInsets.all(16), - child: Column( - children: [ - Text( - memberInfor != null ? memberInfor.follow.toString() : "0", - style: TextStyle( - color: Color(0xFF353535), - fontSize: 16.sp, - fontWeight: - MyFontWeight.semi_bold, - ), - ), - SizedBox( - height: 4, - ), - Text( - S.of(context).guanzhu, - style: TextStyle( - color: Color(0xFF353535), - fontSize: 12.sp, - fontWeight: - MyFontWeight.regular, - ), - ), - ], - )), - ), - ), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () {}, - child: Container( - color: Colors.transparent, - padding: EdgeInsets.all(16), - child: Column( - children: [ - Text( - memberInfor != null ? memberInfor.fans.toString() : "0", - style: TextStyle( - color: Color(0xFF353535), - fontSize: 16.sp, - fontWeight: - MyFontWeight.semi_bold, - ), + if (memberId == "0") + Positioned( + bottom: 9, + right: 16.w, + child: GestureDetector( + onTap: () { + showImagePicker(); + }, + child: Container( + padding: EdgeInsets.only(left: 2, right: 2), + width: 59.w, + height: 23.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + color: Color(0x80000000), ), - SizedBox( - height: 4, - ), - Text( - S.of(context).fensi, + child: Text( + S.of(context).genghuanbeijing, + overflow: TextOverflow.ellipsis, style: TextStyle( - color: Color(0xFF353535), fontSize: 12.sp, - fontWeight: - MyFontWeight.regular, - ), - ), - ], - )), - ), - ), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () {}, - child: Container( - color: Colors.transparent, - padding: EdgeInsets.all(16), - child: Column( - children: [ - Text( - (memberInfor?.trendTotal??0).toString(), - style: TextStyle( - color: Color(0xFF353535), - fontSize: 16.sp, - fontWeight: - MyFontWeight.semi_bold, + fontWeight: MyFontWeight.regular, + color: Color(0xFFFFFFFF), ), ), - SizedBox( - height: 4, - ), - Text( - S.of(context).dongtai, - style: TextStyle( - color: Color(0xFF353535), - fontSize: 12.sp, - fontWeight: - MyFontWeight.regular, - ), - ), - ], - )), - ), + ), + ), + ), + ], ), - Expanded( + ), + homeInfo(), + ], + ), + ), + Container( + color: Color(0xFFFFFFFF), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 86, top: 12, right: 16), child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () {}, - child: Container( - color: Colors.transparent, - padding: EdgeInsets.all(16), - child: Column( - children: [ - Text( - (memberInfor?.gainLikeTotal ?? 0).toString(), - style: TextStyle( - color: Color(0xFF353535), - fontSize: 16.sp, - fontWeight: - MyFontWeight.semi_bold, - ), - ), - SizedBox( - height: 4, - ), - Text( - "获赞", + onTap: () { + setState(() { + isShrink = !isShrink; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + flex: 1, + child: Text( + memberId == "0" + ? ((memberInfor?.signature == "") + ? "还未编辑个性签名~" + : memberInfor?.signature ?? "") + : "个性签名: ${(memberInfor?.signature == "") ? "还未编辑个性签名~" : memberInfor?.signature ?? ""}", + overflow: isShrink + ? TextOverflow.visible + : TextOverflow.ellipsis, + maxLines: isShrink ? 10 : 2, style: TextStyle( - color: Color(0xFF353535), - fontSize: 12.sp, - fontWeight: - MyFontWeight.regular, - ), - ), - ], - )), - ), + fontSize: 12.sp, + color: Color(0xFF868686), + fontWeight: MyFontWeight.regular, + height: 1.5), + )), + Icon( + (isShrink != null && !isShrink) + ? Icons.chevron_right + : Icons.keyboard_arrow_up, + color: Colors.black, + size: 18, + ), + ], + ), + )), + Container( + margin: EdgeInsets.only(left: 16, right: 16), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + memberInfor != null + ? memberInfor.follow.toString() + : "0", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + SizedBox( + height: 4, + ), + Text( + S.of(context).guanzhu, + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + )), + ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + memberInfor != null + ? memberInfor.fans.toString() + : "0", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + SizedBox( + height: 4, + ), + Text( + S.of(context).fensi, + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + )), + ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + (memberInfor?.trendTotal ?? 0) + .toString(), + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + SizedBox( + height: 4, + ), + Text( + S.of(context).dongtai, + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + )), + ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + (memberInfor?.gainLikeTotal ?? 0) + .toString(), + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + SizedBox( + height: 4, + ), + Text( + "获赞", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + )), + ), + ), + ], ), - ], - ), - ), - Container( - margin: EdgeInsets.all(16), - height: 1.h, - color: Color(0xFFF7F7F7), + ), + Container( + margin: EdgeInsets.all(16), + height: 1.h, + color: Color(0xFFF7F7F7), + ), + Padding( + padding: EdgeInsets.only(left: 16), + child: Text( + memberId != "0" ? "TA的动态" : "我的动态", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + ), + )), + dynamicList() + ], ), - Padding( - padding: EdgeInsets.only(left: 16), - child: Text( - memberId != "0" ? - "TA的动态": - "我的动态", - style: TextStyle( - color: Color(0xFF353535), - fontSize: 15.sp, - fontWeight: MyFontWeight.semi_bold, - ), - )), - dynamicList() - ], - ), - ), - ], - )), + ), + ], + )), ); } Widget homeInfo() { return Positioned( - top: 0, + top: 0, bottom: 0, left: 0, right: 0, child: Container( - padding: EdgeInsets.only( - left: 16, - right: 16, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - GestureDetector( - onTap: (){ - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PhotoViewGalleryScreen( - images: [(memberInfor?.headimg ?? "").isEmpty? - "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg":memberInfor?.headimg - ], //传入图片list - index: 0, //传入当前点击的图片的index - ), - )); - }, - child: MImage( - memberInfor?.headimg ?? "", - isCircle: true, - width: 66, - height: 66, - fit: BoxFit.cover, - errorSrc: "assets/image/default_user.webp", - fadeSrc: "assets/image/default_user.webp", - ), + padding: EdgeInsets.only( + left: 16, + right: 16, ), - SizedBox(width: 10.w), - Text( - memberInfor?.nickname ?? "", - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 16.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF353535), - ), - ), - SizedBox(width: 4.w), - Image.asset( - "assets/image/vip_yk.webp", - width: 20, - height: 20, - ), - Spacer(), - if(memberId == "0") - GestureDetector( - onTap: () { - setState(() { - _toUserInfo(); - }); - }, - child: Container( - height: 23, - padding: EdgeInsets.only(left: 6, right: 6, bottom: 2, top: 2), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - border: Border.all( - width: 1, - color: Color(0xFF353535), - style: BorderStyle.solid, - ), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhotoViewGalleryScreen( + images: [ + (memberInfor?.headimg ?? "").isEmpty + ? "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg" + : memberInfor?.headimg + ], //传入图片list + index: 0, //传入当前点击的图片的index + ), + )); + }, + child: MImage( + memberInfor?.headimg ?? "", + isCircle: true, + width: 66, + height: 66, + fit: BoxFit.cover, + errorSrc: "assets/image/default_user.webp", + fadeSrc: "assets/image/default_user.webp", ), - child: Text( - S.of(context).bianjigerenziliao, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF353535), - ), + ), + SizedBox(width: 10.w), + Text( + memberInfor?.nickname ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF353535), ), ), - ) - ], - ),)); + SizedBox(width: 4.w), + Image.asset( + "assets/image/vip_yk.webp", + width: 20, + height: 20, + ), + Spacer(), + if (memberId == "0") + GestureDetector( + onTap: () { + setState(() { + _toUserInfo(); + }); + }, + child: Container( + height: 23, + padding: + EdgeInsets.only(left: 6, right: 6, bottom: 2, top: 2), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all( + width: 1, + color: Color(0xFF353535), + style: BorderStyle.solid, + ), + ), + child: Text( + S.of(context).bianjigerenziliao, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + ), + ) + ], + ), + )); } Widget dynamicList() { return Container( - child: (articles == null || articles.length == 0)? NoDataView( - src: "assets/image/dong_tai.webp", - isShowBtn: false, - text: "目前暂无发布动态,要把开心的事讲出来哦~", - fontSize: 16.sp, - margin: EdgeInsets.only(left: 60.w,right: 60.w), - ):ListView.builder( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, position) { - return InkWell( - child: CommunityDynamic( - articles[position], - memberId == "0" ? 1 : 0, - exitFull: () { - setState(() { - _onRefresh(); - }); - }, - removalDynamic: () { - setState(() { - _onRefresh(); - }); + child: (articles == null || articles.length == 0) + ? NoDataView( + src: "assets/image/dong_tai.webp", + isShowBtn: false, + text: "目前暂无发布动态,要把开心的事讲出来哦~", + fontSize: 16.sp, + margin: EdgeInsets.only(left: 60.w, right: 60.w), + ) + : ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return InkWell( + child: CommunityDynamic( + articles[position], + memberId == "0" ? 1 : 0, + exitFull: () { + // setState(() { + // _onRefresh(); + // }); + }, + removalDynamic: () { + setState(() { + _onRefresh(); + }); + }, + ), + onTap: () { + Navigator.of(context).pushNamed( + '/router/community_details', + arguments: { + "businessId": articles[position].id, + "userId": userId, + }, + ).then((value) { + queryCommunity(articles[position].id); + }); + }, + ); }, + itemCount: articles.length, ), - onTap: () { - Navigator.of(context).pushNamed( - '/router/community_details', - arguments: { - "businessId": articles[position].id, - "userId": userId, - }, - ).then((value) { - _onRefresh(); - }); - }, - ); - }, - itemCount: articles.length, - ), ); } } diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart index a2ba048b..bfd050f0 100644 --- a/lib/mine/recharge_page.dart +++ b/lib/mine/recharge_page.dart @@ -41,7 +41,7 @@ class _RechargePage extends State { List rechargeA; int selectIndex = 0; UserInfo userInfo; - dynamic mBalance; + String mBalance = "0"; @override void initState() { @@ -93,7 +93,7 @@ class _RechargePage extends State { await apiService.queryInfo().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { userInfo = baseData.data; - mBalance = double.tryParse(userInfo?.money ?? "0"); + mBalance = userInfo?.money ?? "0"; if (mounted) setState(() {}); } } diff --git a/lib/order/order_detail_page.dart b/lib/order/order_detail_page.dart index 23dcbdb1..6f9e2f46 100644 --- a/lib/order/order_detail_page.dart +++ b/lib/order/order_detail_page.dart @@ -11,7 +11,6 @@ import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/order_info.dart'; import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; -import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/icon_text.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -41,7 +40,6 @@ class _OrderDetailPage extends State { SharedPreferences.getInstance().then((value) { apiService = ApiService( Dio(), - showLoading: true, context: context, token: value.getString("token"), ); @@ -68,7 +66,7 @@ class _OrderDetailPage extends State { ); minService = MinApiService( Dio(), - showLoading: true, + // showLoading:true, context: context, token: minToken, tenant: tenant, @@ -86,6 +84,15 @@ class _OrderDetailPage extends State { int refundStatus = 0; queryDetails() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + showLoading: true + ); + } BaseData baseData = await apiService .orderDetail(widget.arguments["id"]) .catchError((error) {}); @@ -209,7 +216,7 @@ class _OrderDetailPage extends State { payResult(BaseData baseData) { queryDetails(); - SmartDialog.showToast("订单支付成功"); + SmartDialog.showToast(baseData?.msg == "ok" ?"订单支付成功" :baseData?.msg,alignment: Alignment.center); } statusTitle() { diff --git a/lib/order/order_view/order_info.dart b/lib/order/order_view/order_info.dart index 080d3f1e..eb729efb 100644 --- a/lib/order/order_view/order_info.dart +++ b/lib/order/order_view/order_info.dart @@ -102,6 +102,7 @@ class _OrderInfoView extends State { color: Color(0xFF353535), ), ), + SizedBox(width:10.w), Expanded( child: Text( rightText, diff --git a/lib/retrofit/data/app_update.dart b/lib/retrofit/data/app_update.dart new file mode 100644 index 00000000..2185a187 --- /dev/null +++ b/lib/retrofit/data/app_update.dart @@ -0,0 +1,58 @@ +/// appLastVersion : "1.0.0" +/// appLastVersionUrl : "" +/// appLastVersionUp : "1.0.0" +/// appLastVersionExplain : "优化更新" + +class AppUpdate { + AppUpdate({ + String appLastVersion, + String appLastVersionUrl, + String appLastVersionUp, + String appLastVersionExplain,}){ + _appLastVersion = appLastVersion; + _appLastVersionUrl = appLastVersionUrl; + _appLastVersionUp = appLastVersionUp; + _appLastVersionExplain = appLastVersionExplain; +} + + AppUpdate.fromJson(dynamic json) { + _appLastVersion = json['appLastVersion']; + _appLastVersionUrl = json['appLastVersionUrl']; + _appLastVersionUp = json['appLastVersionUp']; + _appLastVersionExplain = json['appLastVersionExplain']; + } + String _appLastVersion; + String _appLastVersionUrl; + String _appLastVersionUp; + String _appLastVersionExplain; + + String get appLastVersion => _appLastVersion; + String get appLastVersionUrl => _appLastVersionUrl; + String get appLastVersionUp => _appLastVersionUp; + String get appLastVersionExplain => _appLastVersionExplain; + + set appLastVersion(String value) { + _appLastVersion = value; + } + + Map toJson() { + final map = {}; + map['appLastVersion'] = _appLastVersion; + map['appLastVersionUrl'] = _appLastVersionUrl; + map['appLastVersionUp'] = _appLastVersionUp; + map['appLastVersionExplain'] = _appLastVersionExplain; + return map; + } + + set appLastVersionUrl(String value) { + _appLastVersionUrl = value; + } + + set appLastVersionUp(String value) { + _appLastVersionUp = value; + } + + set appLastVersionExplain(String value) { + _appLastVersionExplain = value; + } +} \ No newline at end of file diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 7ab0a849..9ebeb49b 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -21,6 +21,7 @@ import 'package:retrofit/retrofit.dart'; import 'data/achievement_detail_list.dart'; import 'data/activity_pos.dart'; import 'data/address.dart'; +import 'data/app_update.dart'; import 'data/banner.dart'; import 'data/brand_data.dart'; import 'data/category_select_list.dart'; @@ -88,8 +89,8 @@ abstract class ApiService { headers["Environment"] = "app"; } dio.options = BaseOptions( - connectTimeout: 20000, - receiveTimeout: 20000, + connectTimeout: 60000, + receiveTimeout: 60000, headers: headers, responseType: ResponseType.json, ); @@ -177,7 +178,7 @@ abstract class ApiService { /// 用户登录 @POST("/auth/platform/memberLogin") - Future memberLogin(@Body() Map param); + Future> memberLogin(@Body() Map param); ///发送验证码 @GET("/auth/sendVerify/{mobile}") @@ -519,4 +520,8 @@ abstract class ApiService { @POST("/information/complaint") Future complaint(@Body() Map param); + ///app自动更新 + @GET("/home/version") + Future> appVersion(); + } diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 6822b12c..2f3149dd 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -888,7 +888,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => OrderInfo.fromJson(json), + (json) => json==null?null:OrderInfo.fromJson(json), ); return value; } @@ -1959,4 +1959,25 @@ class _ApiService implements ApiService { return value; } + @override + Future> appVersion() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/home/version', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => AppUpdate.fromJson(json), + ); + return value; + } + } diff --git a/lib/setting/about_page.dart b/lib/setting/about_page.dart index ac8b9989..20514dcc 100644 --- a/lib/setting/about_page.dart +++ b/lib/setting/about_page.dart @@ -19,7 +19,7 @@ class AboutPage extends StatefulWidget { } class _AboutPage extends State { - String version = "1.0.0"; + String version = ""; @override void initState() { @@ -89,7 +89,6 @@ class _AboutPage extends State { onTap: () { Navigator.of(context) .pushNamed('/router/help_feedback_page'); - // showAlertDialog(version); }, child: textItem(S.of(context).shiyongbangzhu), ), @@ -103,7 +102,6 @@ class _AboutPage extends State { alignment: Alignment.center); } }); - // showAlertDialog(version); }, ), GestureDetector( @@ -279,15 +277,4 @@ class _AboutPage extends State { ), ); } - - ///app更新弹窗 - showAlertDialog(version) { - //显示对话框 - showDialog( - context: context, - builder: (BuildContext context) { - return UpdateDialog(version); - }, - ); - } } diff --git a/lib/settlement/settlement_view/activity_coupon_remarks.dart b/lib/settlement/settlement_view/activity_coupon_remarks.dart index 1d112d39..345b7649 100644 --- a/lib/settlement/settlement_view/activity_coupon_remarks.dart +++ b/lib/settlement/settlement_view/activity_coupon_remarks.dart @@ -46,8 +46,8 @@ class _ActivityCouponRemarks extends State { boxShadow: [ BoxShadow( color: Color(0x0D000000), - offset: Offset(0, 3), - blurRadius: 14, + offset: Offset(0, 1), + blurRadius: 8, spreadRadius: 0, ), ], @@ -58,6 +58,7 @@ class _ActivityCouponRemarks extends State { left: 16, right: 16, top: 15, + bottom: 14 ), padding: EdgeInsets.only( left: 16, diff --git a/lib/settlement/settlement_view/pay_method.dart b/lib/settlement/settlement_view/pay_method.dart index 13b874f7..4770543d 100644 --- a/lib/settlement/settlement_view/pay_method.dart +++ b/lib/settlement/settlement_view/pay_method.dart @@ -41,7 +41,7 @@ class _PayMethod extends State { left: 16.w, right: 16.w, top: 12.h, - bottom: 4.h, + bottom: 16.h, ), padding: EdgeInsets.only( left: 16.w, @@ -53,8 +53,8 @@ class _PayMethod extends State { boxShadow: [ BoxShadow( color: Color(0x000000).withAlpha(25), - offset: Offset(0, 1), - blurRadius: 12.0, + offset: Offset(0, 2), + blurRadius: 3, ), ], color: Colors.white, diff --git a/lib/settlement/settlement_view/settlement_order_commodity.dart b/lib/settlement/settlement_view/settlement_order_commodity.dart index 1dbe2c6d..a7bc89e2 100644 --- a/lib/settlement/settlement_view/settlement_order_commodity.dart +++ b/lib/settlement/settlement_view/settlement_order_commodity.dart @@ -127,6 +127,7 @@ class _SettlementOrderCommodity extends State { width: 44, height: 44, fit: BoxFit.cover, + radius: BorderRadius.circular(4), errorSrc: "assets/image/default_1.webp", fadeSrc: "assets/image/default_1.webp", ), @@ -261,8 +262,8 @@ class _SettlementOrderCommodity extends State { boxShadow: [ BoxShadow( color: Colors.black.withAlpha(25), - offset: Offset(0, 1), - blurRadius: 12, + offset: Offset(0, 2), + blurRadius: 3, spreadRadius: 0, ) ], diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index eff6be6a..6c61d7ee 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -251,8 +251,8 @@ class _StoreOrderPage extends State height: double.infinity, color: Colors.transparent, alignment: Alignment.centerRight, - margin: EdgeInsets.only(left: 10), - padding: EdgeInsets.all(10), + margin: EdgeInsets.only(left: 10.w), + padding: EdgeInsets.all(10.h), child: Icon( Icons.arrow_back_ios, color: Colors.black, @@ -354,7 +354,7 @@ class _StoreOrderPage extends State bottom: PreferredSize( preferredSize: Size( MediaQuery.of(context).size.width, - 38, + 38.h, ), child: Container( padding: EdgeInsets.symmetric(horizontal: 10.w), @@ -508,8 +508,8 @@ class _StoreOrderPage extends State right: 5, // top: 14, child: RoundButton( - width: 17, - height: 17, + width: 17.w, + height: 17.h, text: "${count()}", textColor: Colors.white, fontWeight: MyFontWeight.regular, @@ -618,7 +618,7 @@ class _StoreOrderPage extends State Widget buildSwiper() { return Container( width: double.infinity, - height: 235.h, + height: 180.h, child: Swiper( pagination: SwiperPagination( alignment: Alignment.bottomCenter, @@ -785,6 +785,9 @@ class _StoreOrderPage extends State setState(() {}); }); } + else { + SmartDialog.showToast(baseDate?.msg, alignment: Alignment.center); + } } } @@ -998,7 +1001,7 @@ class _Title extends State { @override Widget build(BuildContext context) { return Container( - margin: EdgeInsets.only(bottom: 38), + margin: EdgeInsets.only(bottom: 38.h), child: Text( widget.title ?? "", style: TextStyle( diff --git a/lib/store/store_view/shop_goods.dart b/lib/store/store_view/shop_goods.dart index ac8694b9..d94b9652 100644 --- a/lib/store/store_view/shop_goods.dart +++ b/lib/store/store_view/shop_goods.dart @@ -57,6 +57,7 @@ class _ShopGoods extends State<ShopGoods> { : ""), width: 70, height: 70, + radius: BorderRadius.circular(4), fit: BoxFit.cover, radius: BorderRadius.circular(4), errorSrc: "assets/image/default_1.webp", diff --git a/lib/store/store_view/store_info.dart b/lib/store/store_view/store_info.dart index a3b7b183..4eb351c6 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<StoreInfoView> { top: 5.h, bottom: 6.h, ), - height: 154.h, + height: MediaQuery.of(context).size.width >= 650 ? 180.h :154.h, padding: EdgeInsets.all(12.w), decoration: BoxDecoration( color: Colors.white, @@ -125,7 +125,7 @@ class _StoreInfoView extends State<StoreInfoView> { ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child:Text( diff --git a/lib/union/union_view/union_coupon.dart b/lib/union/union_view/union_coupon.dart index ea545bfa..b9c2ef64 100644 --- a/lib/union/union_view/union_coupon.dart +++ b/lib/union/union_view/union_coupon.dart @@ -62,7 +62,7 @@ class _UnionCoupon extends State<UnionCoupon> { Widget buildCoupon() { return Container( - height: 109.h, + height: 116.h, child: ListView.builder( itemCount: (widget.storeInfo != null && widget.storeInfo.couponVOList != null) ? widget.storeInfo.couponVOList.length @@ -126,7 +126,7 @@ class _UnionCoupon extends State<UnionCoupon> { .bizType == 5) ? S.of(context).duihuanquan - : "${widget.storeInfo.couponVOList[position].discountPercent ~/ 10}折", + : "${widget.storeInfo.couponVOList[position].discountPercent / 10.0}折", style: TextStyle( fontSize: 36.sp, color: Color(0xFFFF7A1A), @@ -193,7 +193,7 @@ class _UnionCoupon extends State<UnionCoupon> { : S.of(context).quanchangzhe(widget .storeInfo .couponVOList[position] - .discountPercent)) + .discountPercent /10.0)) : "", overflow: TextOverflow.ellipsis, style: TextStyle( @@ -258,7 +258,7 @@ class _UnionCoupon extends State<UnionCoupon> { ? Colors.grey : Color(0xFF32A060), padding: EdgeInsets.symmetric( - horizontal: 8.w, vertical: 4.h), + horizontal: 8.w, vertical:2.h), fontSize: 12.sp, ), ), diff --git a/lib/utils/flutter_utils.dart b/lib/utils/flutter_utils.dart index 047587c1..8363dd19 100644 --- a/lib/utils/flutter_utils.dart +++ b/lib/utils/flutter_utils.dart @@ -16,6 +16,19 @@ class AppUtils { return "${numberFormat.format(mi / 1000)}"; } + ///版本号 + static bool versionCompare(String localVersion,String serverVersion){ + try{ + var localVersionArr = localVersion.split("."); + var serverVersionArr = serverVersion.split("."); + if((int.tryParse(localVersionArr[0]) < int.tryParse(serverVersionArr[0])) + || (int.tryParse(localVersionArr[1]) < int.tryParse(serverVersionArr[1])) + || (int.tryParse(localVersionArr[2]) < int.tryParse(serverVersionArr[2]))) + return true; + }catch(ex){ } + return false; + } + static String trimEnd(String resString,String char){ while(resString.endsWith(char)){ resString = resString.substring(0,resString.length - 1); diff --git a/lib/view_widget/tips_dialog.dart b/lib/view_widget/tips_dialog.dart index 069a4003..35bda7fd 100644 --- a/lib/view_widget/tips_dialog.dart +++ b/lib/view_widget/tips_dialog.dart @@ -23,7 +23,7 @@ class _Tips extends State<Tips> { child: Center( child: Container( width: MediaQuery.of(context).size.width - 80.w, - height: 146.h, + height: 165.h, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8), @@ -32,13 +32,13 @@ class _Tips extends State<Tips> { children: [ Container( width: double.infinity, - height: 90.h, + height:109.h, alignment: Alignment.center, padding: EdgeInsets.all(10), child: Text( widget.text ?? S.of(context).querenyaoshanchudangqianpinglunma, style: TextStyle( - fontSize: 17.sp, + fontSize: 15.sp, fontWeight: MyFontWeight.medium, color: Color(0xFF353535), ), @@ -57,6 +57,7 @@ class _Tips extends State<Tips> { child: InkWell( onTap: () { SmartDialog.dismiss(); + widget.tips(); }, child: Container( width: double.infinity, @@ -65,7 +66,7 @@ class _Tips extends State<Tips> { child: Text( S.of(context).quxiao, style: TextStyle( - fontSize: 17.sp, + fontSize: 16.sp, fontWeight: MyFontWeight.medium, color: Color(0xFF353535), ), @@ -91,7 +92,7 @@ class _Tips extends State<Tips> { child: Text( S.of(context).queren, style: TextStyle( - fontSize: 17.sp, + fontSize: 16.sp, fontWeight: MyFontWeight.medium, color: Color(0xFF32A060), ), diff --git a/lib/view_widget/update_dialog.dart b/lib/view_widget/update_dialog.dart index 95f58d36..fa42f586 100644 --- a/lib/view_widget/update_dialog.dart +++ b/lib/view_widget/update_dialog.dart @@ -2,14 +2,19 @@ import 'dart:io'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter/material.dart'; +import 'package:huixiang/retrofit/data/app_update.dart'; import 'package:huixiang/utils/bridge.dart'; +import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:path_provider/path_provider.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:url_launcher/url_launcher.dart'; class UpdateDialog extends StatefulWidget { final String version; + final AppUpdate appUpdate; - UpdateDialog(this.version); + UpdateDialog(this.version,this.appUpdate); @override State<StatefulWidget> createState() { @@ -40,19 +45,20 @@ class _UpdateDialog extends State<UpdateDialog> { child: Column( children: [ Text( - "检测到新版本 v${widget.version}", + "检测到新版本 v${widget.appUpdate.appLastVersion}", style: TextStyle( - fontSize: 18.sp, + fontSize: 17.sp, fontWeight: MyFontWeight.semi_bold, - color: Color(0xFF353535), + color: Color(0xFF000000), ), ), + SizedBox(height: 12,), Text( "是否需要更新到最新版本?", style: TextStyle( - fontSize: 14.sp, + fontSize: 17.sp, fontWeight: MyFontWeight.regular, - color: Color(0xFF353535), + color: Color(0xFF333333), ), ), ], @@ -67,10 +73,11 @@ class _UpdateDialog extends State<UpdateDialog> { child: Row( mainAxisSize: MainAxisSize.max, children: [ + if(!AppUtils.versionCompare(widget.version,widget.appUpdate.appLastVersionUp)) Expanded( child: InkWell( - onTap: () { - Navigator.of(context).pop(); + onTap:() { + doNotUpdate(); }, child: Container( width: double.infinity, @@ -80,8 +87,8 @@ class _UpdateDialog extends State<UpdateDialog> { "下次再说", style: TextStyle( fontSize: 17.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF353535), + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF8C8C8C), ), ), ), @@ -95,9 +102,10 @@ class _UpdateDialog extends State<UpdateDialog> { Expanded( child: InkWell( onTap: () { - Bridge.toAppStore().then((value) { + (Theme.of(context).platform == TargetPlatform.android) ? + androidUpdate():Bridge.toAppStore().then((value) { }); - Navigator.of(context).pop(); + // Navigator.of(context).pop(); }, child: Container( width: double.infinity, @@ -107,7 +115,7 @@ class _UpdateDialog extends State<UpdateDialog> { "立即更新", style: TextStyle( fontSize: 17.sp, - fontWeight: MyFontWeight.medium, + fontWeight: MyFontWeight.semi_bold, color: Color(0xFF32A060), ), ), @@ -125,13 +133,19 @@ class _UpdateDialog extends State<UpdateDialog> { ); } - - Future<String> _findLocalPath(BuildContext context) async { - final directory = Theme.of(context).platform == TargetPlatform.android - ? await getExternalStorageDirectory() - : await getApplicationDocumentsDirectory(); - return directory.path; + doNotUpdate() async { + SharedPreferences value = await SharedPreferences.getInstance(); + value.setString("appLastVersion", widget.appUpdate.appLastVersion); + Navigator.of(context).pop(); } + androidUpdate() async { + String url = "http://application.lotus-wallet.com/huixaing?release_id=627cadff23389f2fe6d57cb1"; + if (await canLaunch(url)) { + await launch(url); + } else { + throw 'Could not launch $url'; + } + } } diff --git a/lib/web/web_view/comment_list.dart b/lib/web/web_view/comment_list.dart index df78bc0c..f77fd774 100644 --- a/lib/web/web_view/comment_list.dart +++ b/lib/web/web_view/comment_list.dart @@ -16,7 +16,6 @@ import 'package:like_button/like_button.dart'; import 'package:shared_preferences/shared_preferences.dart'; class CommentList extends StatefulWidget { - final bool isKeyBoardShow; final Function reply; final Function delCommentTips; @@ -26,8 +25,9 @@ class CommentList extends StatefulWidget { final int like; final Function requestApiFinish; - CommentList(Key key, this.like, this.relationalId,this.relationalType, - this.isKeyBoardShow, this.reply, this.delCommentTips, this.fontSize,{this.requestApiFinish}) + CommentList(Key key, this.like, this.relationalId, this.relationalType, + this.isKeyBoardShow, this.reply, this.delCommentTips, this.fontSize, + {this.requestApiFinish}) : super(key: key); @override @@ -59,7 +59,6 @@ class CommentListState extends State<CommentList> { } else { element.likes += 1; element.liked = true; - } } }); @@ -121,8 +120,8 @@ class CommentListState extends State<CommentList> { color: Colors.white, child: InkWell( onTap: () { - showPressMenu(memberList[position].createUser, - memberList[position]); + // showPressMenu(memberList[position].createUser, + // memberList[position]); }, child: commentItem(memberList[position]), ), @@ -190,8 +189,7 @@ class CommentListState extends State<CommentList> { //评论列表 queryMemberCommentList() async { - if(widget?.relationalId == null || widget.relationalId.isEmpty) - return; + if (widget?.relationalId == null || widget.relationalId.isEmpty) return; SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); if (apiService == null) apiService = ApiService( @@ -255,14 +253,26 @@ class CommentListState extends State<CommentList> { mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ - MImage( - memberList.userAvatarUrl ?? "", - fit: BoxFit.cover, - isCircle: true, - width: 40, - height: 40, - fadeSrc: "assets/image/default_user.webp", - errorSrc: "assets/image/default_user.webp", + GestureDetector( + onTap: () { + setState(() { + Navigator.of(context) + .pushNamed('/router/personal_page', arguments: { + "memberId": memberList.createUser, + }); + }); + }, + behavior: HitTestBehavior.opaque, + child: MImage( + memberList.userAvatarUrl ?? "", + fit: BoxFit.cover, + isCircle: true, + width: 40, + height: 40, + radius: BorderRadius.circular(4), + fadeSrc: "assets/image/default_user.webp", + errorSrc: "assets/image/default_user.webp", + ), ), SizedBox( width: 12.w, @@ -358,24 +368,33 @@ class CommentListState extends State<CommentList> { ], ), ), - Container( - padding: EdgeInsets.only( - left: 68.w, - right: 16.w, - top: 16.h, - bottom: 16.h, - ), - child: Align( - alignment: Alignment.centerLeft, - child: Text( - memberList.content, - style: TextStyle( - fontSize: widget.fontSize + 2, - color: Color(0xff1A1A1A), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + showPressMenu(memberList.createUser, + memberList); + }); + }, + child: + Container( + padding: EdgeInsets.only( + left: 68.w, + right: 16.w, + top: 16.h, + bottom: 16.h, ), - ), - ), - ), + child: Align( + alignment: Alignment.centerLeft, + child: Text( + memberList.content, + style: TextStyle( + fontSize: widget.fontSize + 2, + color: Color(0xff1A1A1A), + ), + ), + ), + )), SizedBox( height: 12.h, ), diff --git a/pubspec.yaml b/pubspec.yaml index 60f2903d..523b3a8e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: 一心回乡. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 1.0.0+1 +version: 1.0.1+2 environment: sdk: ">=2.7.0 <3.0.0"