From 95c4785b8f04a38769aa2fc8911a2ed2cdc1197e Mon Sep 17 00:00:00 2001 From: fmk Date: Mon, 7 Aug 2023 11:16:08 +0800 Subject: [PATCH 01/35] ios --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 36c5d98e..a4e2985e 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -617,7 +617,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -819,7 +819,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -912,7 +912,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( From c2710fba949a2776c4ee7c16b56f108340eb34a9 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Tue, 8 Aug 2023 16:54:41 +0800 Subject: [PATCH 02/35] =?UTF-8?q?=E7=82=B9=E5=8D=95=E9=A1=B5=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E4=B8=AD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/store/store_order.dart | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index b7b60ce2..feb7a4fd 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -102,7 +102,6 @@ class _StoreOrderPage extends State Dio(), context: context, token: shared.getString('token'), - showLoading: true, ); apiService.minLogin(storeId).catchError((onError) { SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type), @@ -128,7 +127,6 @@ class _StoreOrderPage extends State storeId: storeId, ); - EasyLoading.dismiss(); queryMemberInfo(); @@ -207,7 +205,6 @@ class _StoreOrderPage extends State setState(() {}); } } - EasyLoading.dismiss(); } RefreshController refreshController; From 3d31eefb2e694d6dfce4794acec60a4087a96eb7 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Wed, 9 Aug 2023 15:23:32 +0800 Subject: [PATCH 03/35] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=9B=B4=E6=94=B9=EF=BC=9B=20=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E5=9C=B0=E5=9D=80=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=88=A4?= =?UTF-8?q?=E6=96=AD=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E7=BB=8F=E7=BA=AC=E5=BA=A6=E5=88=99=E4=B8=8D=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/settlement/settlement.dart | 6 +++--- lib/store/store_view/store_info.dart | 20 ++++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index b722a1bf..4d28b511 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -140,7 +140,7 @@ class _Settlement extends State { storeId: storeId, showLoading: false); queryMemberInfo(); - if (promotions != null && promotions != "" && tableId <= 0) { + if (widget.arguments["pid"] != null && widget.arguments["pid"] != "" && tableId <= 0) { queryOrderInfo( address != null ? address.id : null, ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && @@ -155,7 +155,7 @@ class _Settlement extends State { productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - "ACTIVITY", + "AUTO", // useVipPriceSelect, // useBenefitSelect, count1, @@ -1383,7 +1383,7 @@ class _Settlement extends State { 0, (settleOrderInfo.isRaise || payChannel == 5) ? "" - : promotion?.id ?? productId, + : widget.arguments["pid"] ?? (promotion?.id ?? productId), productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", diff --git a/lib/store/store_view/store_info.dart b/lib/store/store_view/store_info.dart index aaa02685..2f274a37 100644 --- a/lib/store/store_view/store_info.dart +++ b/lib/store/store_view/store_info.dart @@ -190,14 +190,18 @@ class _StoreInfoView extends State { child: GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - Navigator.of(context).pushNamed( - '/router/location_map', - arguments: { - "lat": widget.storeInfo.latitude, - "lng": widget.storeInfo.longitude, - "storeName": widget.storeInfo.storeName, - }, - ); + if(widget.storeInfo.longitude != null && widget.storeInfo.latitude != null){ + Navigator.of(context).pushNamed( + '/router/location_map', + arguments: { + "lat": widget.storeInfo.latitude, + "lng": widget.storeInfo.longitude, + "storeName": widget.storeInfo.storeName, + }, + ); + }else{ + return; + } }, child: Text( "${S.of(context).dizhi}:${widget.storeInfo != null ? widget.storeInfo.address : ""}", From e49ed47173a0eaf3593b4eadb301af16e5ac45cb Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Thu, 10 Aug 2023 14:15:06 +0800 Subject: [PATCH 04/35] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=90=8E=E7=AB=AF=E5=A4=84=E7=90=86=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=9C=89=E9=97=AE=E9=A2=98=EF=BC=8C=20=E6=88=91?= =?UTF-8?q?=E8=BF=99=E8=BE=B9=E6=9A=82=E6=97=B6=E5=B0=86=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E4=B9=9F=E8=87=AA=E5=8A=A8=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E4=BB=A5=E6=AD=A4=E6=9D=A5=E8=A7=A3=E5=86=B3=E5=A5=B9?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E6=9E=9C=E8=B7=9F=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=E7=9A=84=E4=BC=98=E6=83=A0=E6=AF=94=E6=B4=BB=E5=8A=A8=E5=B0=8F?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8BselectDiscount=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=B0=B1=E6=98=AF=E4=BC=98=E6=83=A0=E5=88=B8=EF=BC=8C?= =?UTF-8?q?=E8=BF=99=E4=B8=AA=E6=97=B6=E5=80=99=E5=B0=B1=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E6=B4=BB=E5=8A=A8id=EF=BC=8C=E4=B8=8B?= =?UTF-8?q?=E4=B8=80=E6=AD=A5getOrderInfo=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E4=B9=9F=E5=B0=86=E6=97=A0=E6=B3=95=E4=BC=A0=E9=80=92=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8id=E5=AE=9E=E7=8E=B0=E8=87=AA=E5=8A=A8=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E6=B4=BB=E5=8A=A8=E4=BC=98=E6=83=A0=E7=9A=84=E6=83=85?= =?UTF-8?q?=E5=86=B5=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/settlement/settlement.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index 4d28b511..b68d529a 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -161,7 +161,7 @@ class _Settlement extends State { count1, payChannel, tableId); - } else if (coupons != null && coupons != "" && tableId <= 0) { + } else if ( widget.arguments["cid"] != null && widget.arguments["cid"] != "" && tableId <= 0) { queryOrderInfo( address != null ? address.id : null, ((storeInfo?.pickupType?.dineInTakeStatus ?? false) == true && @@ -170,13 +170,13 @@ class _Settlement extends State { selectedBtn != 2) ? diningStatus : selectedBtn, - widget.arguments["cid"], + widget.arguments["cid"]??0, 0, productId ?? 0, productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - "COUPON", + "AUTO", // useVipPriceSelect, // useBenefitSelect, count1, From 52533217fdc754338c6703de695ad302cdeb8cd5 Mon Sep 17 00:00:00 2001 From: fmk Date: Thu, 10 Aug 2023 15:13:08 +0800 Subject: [PATCH 05/35] ios --- ios/Podfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 35e781b3..251568b2 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -46,7 +46,7 @@ PODS: - Flutter - fluwx (0.0.1): - Flutter - - "OpenWeChatSDK (~> 1.9.2+1)" + - WechatOpenSDK-XCFramework (~> 2.0.2) - image_pickers (0.0.1): - AFNetworking - Flutter @@ -166,7 +166,6 @@ PODS: - mob_sharesdk_spec2/ShareSDK - number_precision (0.0.1): - Flutter - - "OpenWeChatSDK (1.9.9+1)" - package_info (0.0.1): - Flutter - path_provider (0.0.1): @@ -244,6 +243,7 @@ PODS: - Flutter - webview_flutter (0.0.1): - Flutter + - WechatOpenSDK-XCFramework (2.0.2) - ZLPhotoBrowser-objc (1.0.4): - SDWebImage @@ -281,12 +281,12 @@ SPEC REPOS: - BaiduMapKit - BMKLocationKit - mob_sharesdk_spec2 - - OpenWeChatSDK - SDWebImage - SSZipArchive - TPNS-iOS - UMCommon - UMDevice + - WechatOpenSDK-XCFramework - ZLPhotoBrowser-objc EXTERNAL SOURCES: @@ -351,11 +351,10 @@ SPEC CHECKSUMS: flutter_baidu_mapapi_search: 13a360334e91abea0bcf820546b2ef4548e42e08 flutter_baidu_mapapi_utils: f6a5d23da26b0e58f1ae9908da7ba87fd48384b1 flutter_bmflocation: 1bd73181196567fe1529f765aa4f8e2615a8a3cf - fluwx: 79c66b6d795ab8208262ada215d9e60388cfe492 + fluwx: e9e728cfdb80e82dac5f4ff974b1901a7939dcd0 image_pickers: 25c8916d358bc9d2707cb470ba3d57497f105773 mob_sharesdk_spec2: efa0cb438a29b37ab99d015a272dff69177e30a2 number_precision: 26fa2be2212f9d1429f92d667d6b0aa4df0058d8 - OpenWeChatSDK: ea48e9db20645f78128db9091893910280b8e4b1 package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 path_provider: f96fff6166a8867510d2c25fdcc346327cc4b259 permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 @@ -375,6 +374,7 @@ SPEC CHECKSUMS: video_player_avfoundation: 6d971a232d72e6ee25368378d48a079dea01f1cf wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f webview_flutter: 5fb4def2bbd4339889ee14d045b605cefc5bc232 + WechatOpenSDK-XCFramework: acdeeda129efbef9532bca8a10c24e1b4b8c7d69 ZLPhotoBrowser-objc: c7657d3bc85ae231884e058d0e3638f619164736 PODFILE CHECKSUM: f4ea28c741a7c9a1c417c066f9cfd7b29654dd12 From 3b355b542546d5c832eacc1e366fc035d7c763b9 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Fri, 11 Aug 2023 10:16:27 +0800 Subject: [PATCH 06/35] =?UTF-8?q?=E5=BA=97=E9=93=BA=E5=85=85=E5=80=BCui?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=8F=8A=E6=96=B0=E5=A2=9E=EF=BC=9B=EF=BC=88?= =?UTF-8?q?ui=E5=B7=B2=E7=94=BB=E5=AE=8C=EF=BC=8C=E7=BC=BA=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=95=B0=E6=8D=AE=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/image/2x/icon_search.webp | Bin 0 -> 1008 bytes assets/image/3x/icon_search.webp | Bin 0 -> 1640 bytes assets/image/icon_search.webp | Bin 0 -> 760 bytes lib/main.dart | 3 + lib/mine/mine_shop_page.dart | 194 +++++--- lib/mine/mine_shop_recharge.dart | 664 +++++++++++++++++++++++++++ lib/mine/mine_view/mine_item.dart | 2 +- lib/mine/recharge_page.dart | 720 +++++++++++++++--------------- 8 files changed, 1166 insertions(+), 417 deletions(-) create mode 100644 assets/image/2x/icon_search.webp create mode 100644 assets/image/3x/icon_search.webp create mode 100644 assets/image/icon_search.webp create mode 100644 lib/mine/mine_shop_recharge.dart diff --git a/assets/image/2x/icon_search.webp b/assets/image/2x/icon_search.webp new file mode 100644 index 0000000000000000000000000000000000000000..83fe5c548ba3883caf5f1deaf674eb40d9e1af1f GIT binary patch literal 1008 zcmWIYbaQ*b%)k)t>J$(bU=hK^z`$St#PVR|>FgYEf)U7NU_1dLS%6Zxc_l?b?oJ93 zkx>fl4;UDM5DXHNiwhtutRzs?w`&l!mvynKz%R&|l3JV$RPq6cRf>R?1KlJ7WQ(Lj z*cu>q5`=97VwaZ`lmOKPfY?PLLC!#S3XrXlj>JwvVkZ|AfzZ zZ((5Ab{-*y2$O=uqC~K9EI^VeEscTU({cs|-be-p;R_55T+v`TAc4be3P33tpu6&c zFr6WXA(cUa!IL46A(=rB$T9*(sv(0JFou18F)}dd%O7AD$UkH?DMi)T;>mn|#*gnm znQ*vGRMA`&W%23#bC$dF7fQNLTCyVR;fek8g-hz&%I<9IRZw5tvb%b}cfz$&)*IV= z@9$n`>Z^J0``vxt_rBjlg5QeMY zYp=}b+VTH?Fe8Ij!!LeL2alk7h6fCap0*4E8x&V+raCckSUgzH#aZga#J~`wuCh{k z60c`ggOot_ZL_y?@^5de&#~@b{l98b`Ttt;l?sdgbKTyS+w<<>4$ogL9UUDWTQ=|A zUi18E$uwa>5ICEW#mI0VS9gz@-GQ6Dua0J=7xMqJk_u|KyB4Cnw1lnPGgtOts?Yk( zuRqCLe*0^UQsR4^=$Pyqb{5?&){9;mT20t+q-(ZCQQKNQSDCi7zHKvB*&X;7X{=TJ zPLw&iEU8UKLrm^vcVgv2VFSx6K80sh5bjT5E+*ReS(>gg%~-*ub;0!J{^xH34zrz4cqyU2{9;A-Wgcny z!x8GrKU?;P6up12l>b0_oVrRG+qFGwvR=$-vaWf)dBJ~6vk$f9MPFYq9=ANH<+|Hq v*Z1al$v^f-y>D*6FZ8I_CEH}~7m-;Pl4eQFtk+my^LOu^6ZgG-DX{_o+%`d~ literal 0 HcmV?d00001 diff --git a/assets/image/3x/icon_search.webp b/assets/image/3x/icon_search.webp new file mode 100644 index 0000000000000000000000000000000000000000..979a0908aeb173735656890668e1bd7046106e09 GIT binary patch literal 1640 zcmaJSXP^ob!9md*1haHn6Fwhd2NZCPvow z)_RUo000d{)z>$S$6G%~Aud2Y7g{kSMWzJNYzRhJM<-{j1P`E)wJx6Cfz%E3MT@W& zIyboOs$XRMe^Ang6zGjmW)X#G$l*v&yAZs~Zv!6^Vy_L16XK8{Y7oM)7Gj#64IaTh z2tMTZ8TR@NdsAsbeiFjLkpnIX&k~C8b}}Ri(H8k`MN|m{0vkX8M#B3eJ|Y+M0MO$D zAbM>x=9LZrCk6n8p3NAP3xI4i0PL2{*yfv1J!zin<-`yx;_C~*`+ERva{>VU3IHjW z^&DdUqc<#)QbPK=h%7%407w7}U_b%hKn+2f$WV_19c025G^D<|dad-1RB>H8*`YP_ z7yE;!mebIuVpx}F`a~zi2Tkb^pQ$)P zRVR~k$-S}TlY*21}-MZrLTQ+X%DBCS6xCIxy)pd;i5&#ObBlC zVb~L)>-kJOVw4(8G?9auM_{3!olh_3GWWxDNZ(Knrf6E8k;A?y<1*>Py>4>s1K0C~ z6|wR8bYNyf3{a1U03AqNgWy`&nMevF@*$KNT@3jV%<32DW=3sL0W(d@kPfLz!dFB^ z%tf$=c}QuPuC#*+cmNp6(ZvCTD&|6T=t7i)a7F+`C`WZekGlp&2F}R=sE19Sd>K#f z{eJv)0lAkg-185IhM$Gzr&uk1%EsmiwkyH@cjmT~Dk{7&_;p>DOnf?yaer!gx4Ja` zwr6d*By#`1GBR+#B+MNJ0LH3Cm2*={DV!r;tJV53^3o035$r^+Y3GNv5ylw)yKPw| zlPfOCJz-_uxn5&C$eAPU?M?V(-m*749JtQ!zo|7PL9NK>XcTwY+sWe`E|+3#U&%)2 z)f@2AWp&~l7Zm2udo3l2F3o$pu57V4JCMpdD-o5(=M)>Y5$|W6KVE-&=|ro0L{yXe z(xWs_Db0QjTmCoGGgp82RVt7j^nau;N{)#QKqnPgu1tEh=fqbOYuAFEf5;B>n^ncS zZGBiKBa?1*A@f);ap`)jqW{Q&x3jgH zmf^4>8Jy(o%#Oc)(+Qp#{lwr{HuKNCA=|P_W*b~R46kIJ?TPp^q&b`s!ZW$3cwBiZ zA$4^32-G2%?K8LU+9PXOCaS8IonA4Ui!&_Laj2?%NO1b-p*-tvd@Z5U?LGLav@paU zFTH}Z@l5`9kwr)}%^sS&WxP*1Qlvs!dPp>R$e5H8DpsDUKNNeXGv}2jr_cF8b#?gP zwc~9IT+?QQ4+^vTIhdP20=;Z9*LW;ZF(|M|u>5Y-ugjgIMw@1C-4)-*V%eRT%Glc# z%0Fw5!CNWHYX;XSraWa$I(OdQO_+K7i9azKS2e0*v4+80j#Ojx((lNNdD)aoOG%a5 zzLlx+H=9Paz-9S`8MWo_qm?mD=7hAW+Q7!{#t6!reMc~gD*hO&j|qAV*KS?#50i_5 Ah5!Hn literal 0 HcmV?d00001 diff --git a/assets/image/icon_search.webp b/assets/image/icon_search.webp new file mode 100644 index 0000000000000000000000000000000000000000..6b5802a4def3dae68fe98e7469f9434091d92224 GIT binary patch literal 760 zcmWIYbaVT_#J~{l>J$(bU=hK^z`$St#Qb37>FgYEf)U7NU_1dLS%6Zxc_l?b?oJ93 zkx>fl4;UDM5DXHNiwhtutRzs?w`&l!mvynKz%R&|l3JV$RPq6cRf>R?1KlJ7WQ(Lj z*cu>q5`=97VwaZ`lmOKPfY?PLLC!#S3XrXlj>JwvVkZ|Afz- z3j@Qp^9V6Sm=q)yC4!A(0g_Bm$qafxmJu*g4H?XUG3>+0$iSe_e}Gvae&K>#Y0cYz|1iofaQ^Vt z%Q^A(w%$qa{`0?b+?%j8?8dg-#Y=wwZ>|c^k60@x3>G~qx3@f#y#N08vuE-Tti``Ncf8ntXj`td`pYjrm=n}J zxf#l5y`1CpJLH+~@+t-Isf4^fTI#LC8b0*4<+D=F-k)owe?_H6xx vM=~<`GUwhtESYIlzi!puhA+#n78G4s9P;?}>dVh}`Yrrml{NMM#c~D!-+{ routers = { MineGreenery(), '/router/mine_shop_page': (context, {arguments}) => MineShopPage(), + '/router/mine_shop_recharge': (context, {arguments}) => + MineShopRecharge(arguments: arguments,), '/router/mine_shop_details': (context, {arguments}) => MineShopDetails(arguments:arguments,), '/router/coupon_page': (context, {arguments}) => diff --git a/lib/mine/mine_shop_page.dart b/lib/mine/mine_shop_page.dart index 2c0e5953..8b1ae39b 100644 --- a/lib/mine/mine_shop_page.dart +++ b/lib/mine/mine_shop_page.dart @@ -27,28 +27,62 @@ class MineShopPage extends StatefulWidget { } } -class _MineShopPage extends State { +class _MineShopPage extends State with WidgetsBindingObserver{ List coupons = []; ApiService apiService; int current = 1; RefreshController refreshController ; + final TextEditingController editingController = TextEditingController(); + int optionIndex = 0; + bool isKeyBoardShow = false; + List hotSearch = []; + List historySearch = []; + FocusNode _focusNode = FocusNode(); + bool hasFocus = true; + int priceOrder = 0; @override void initState() { super.initState(); refreshController = RefreshController(); - SharedPreferences.getInstance().then((value) { apiService = ApiService(Dio(), context: context, token: value.getString("token")); queryVipCard(); }); + _focusNode.addListener(() { + setState(() { + hasFocus = _focusNode.hasFocus; + }); + }); } - _onRefresh() { - current = 1; - queryVipCard(); + @override + void didChangeMetrics() { + super.didChangeMetrics(); + WidgetsBinding.instance.addPostFrameCallback((_) { + setState(() { + print("object: ${MediaQuery.of(context).viewInsets.bottom}"); + if (MediaQuery.of(context).viewInsets.bottom == 0) { + if (isKeyBoardShow) { + isKeyBoardShow = false; + //关闭键盘 软键盘关闭了, 清除输入控件的焦点, 否则重新进入页面会导致软键盘再弹出问题 + FocusScope.of(context).requestFocus(FocusNode()); + } + } else { + isKeyBoardShow = true; + } + }); + }); + } + + ///离开页面记着销毁和清除 + @override + void dispose() { + _focusNode.unfocus(); + refreshController.dispose(); + super.dispose(); } queryVipCard() async { @@ -69,46 +103,105 @@ class _MineShopPage extends State { @override Widget build(BuildContext context) { - return Scaffold( - appBar: MyAppBar( - title: S.of(context).dianpuyue, - titleColor: Colors.black, - background: Colors.white, - leadingColor: Colors.black, + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: Scaffold( + appBar: MyAppBar( + title: "店铺充值", + titleColor: Colors.black, + background: Colors.white, + leadingColor: Colors.black, + ), + body:Column( + children: [ + Container( + color: Colors.white, + padding: EdgeInsets.only(top:10.h,bottom:18.h,), + child: searchShopItem(), + ), + Expanded(child: SmartRefresher( + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + controller: refreshController, + onRefresh: queryVipCard, + physics: BouncingScrollPhysics(), + child: (coupons != null && coupons.length > 0) + ? ListView.builder( + padding: EdgeInsets.symmetric(vertical: 8.h), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/mine_shop_recharge', + arguments: {"id": coupons[position].id}); + }, + child: shopItem(coupons[position]), + ); + }, + itemCount: coupons != null ? coupons.length : 0, + ) + : NoDataView( + src: "assets/image/icon_empty.webp", + isShowBtn: false, + text: "还没有会员卡~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ), + ),) + ], + ), + ), + ); + } + + Widget searchShopItem() { + return Container( + height: 36.h, + margin: EdgeInsets.fromLTRB(14.w, 0, 14.w, 0), + padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), + decoration: BoxDecoration( + color: Color(0xFFF5FAF7), + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], ), - body: SmartRefresher( - enablePullDown: true, - enablePullUp: false, - header: MyHeader(), - footer: CustomFooter( - builder: (context, mode) { - return MyFooter(mode); - }, + child: TextField( + textInputAction: TextInputAction.search, + onEditingComplete: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + controller: editingController, + cursorHeight: 25.h, + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric( + vertical: 12.h, + ), + hintText: "搜索联盟会员店", + hintStyle: TextStyle( + fontSize: 12.sp, + color: Color(0xFFB3B3B3), + ), + prefixIcon:Image.asset( + "assets/image/icon_search.webp", + width: 16, + height: 16, ), - controller: refreshController, - onRefresh: queryVipCard, - physics: BouncingScrollPhysics(), - child: (coupons != null && coupons.length > 0) - ? ListView.builder( - padding: EdgeInsets.symmetric(vertical: 8.h), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - Navigator.of(context).pushNamed( - '/router/mine_shop_details', - arguments: {"id": coupons[position].id}); - }, - child: shopItem(coupons[position]), - ); - }, - itemCount: coupons != null ? coupons.length : 0, - ) - : NoDataView( - src: "assets/image/icon_empty.webp", - isShowBtn: false, - text: "还没有会员卡~", - fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h), + border: InputBorder.none, ), ), ); @@ -218,19 +311,20 @@ class _MineShopPage extends State { ), )), Text( - S.of(context).chakanxiangqing, + "去充值", style: TextStyle( - color: Color(0xFF353535), + color: Color(0xFF262626), fontSize: 12.sp, fontWeight: MyFontWeight.regular, ), ), SizedBox(width: 2,), - Icon( - Icons.chevron_right, - size: 24, - color: Colors.black, - ), + Image.asset( + "assets/image/icon_right_z.webp", + width: 16, + height: 16, + color: Color(0xFF262626), + ) ], ), ], diff --git a/lib/mine/mine_shop_recharge.dart b/lib/mine/mine_shop_recharge.dart new file mode 100644 index 00000000..f2d93a53 --- /dev/null +++ b/lib/mine/mine_shop_recharge.dart @@ -0,0 +1,664 @@ +import 'package:barcode_widget/barcode_widget.dart'; +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bmflocation/flutter_bmflocation.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/page.dart'; +import 'package:huixiang/retrofit/data/product.dart'; +import 'package:huixiang/retrofit/data/user_bill.dart'; +import 'package:huixiang/retrofit/data/vip_card.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/store/scan.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/utils/location.dart'; +import 'package:huixiang/utils/painter_bg.dart'; +import 'package:huixiang/view_widget/classic_header.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:flutter_screenutil/flutter_screenutil.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../retrofit/data/rechargeActLists.dart'; +import '../utils/flutter_utils.dart'; +import '../view_widget/no_data_view.dart'; +import '../view_widget/recharge_details_dialog.dart'; + +class MineShopRecharge extends StatefulWidget { + final Map arguments; + + MineShopRecharge({this.arguments}); + + @override + State createState() { + return _MineShopRecharge(); + } +} + +class _MineShopRecharge extends State { + ApiService apiService; + VipCard vipCard; + RechargeActLists rechargeActLists; + int selectIndex = 0; + double discount = 100; + var checkIndex = 2; + final RefreshController refreshController = RefreshController(); + + @override + void dispose() { + super.dispose(); + refreshController.dispose(); + } + + @override + void initState() { + super.initState(); + vipDetail("", ""); + } + + ///会员卡详情 + vipDetail(latitude, longitude) async { + SharedPreferences value = await SharedPreferences.getInstance(); + if (apiService == null) + apiService = + ApiService(Dio(), context: context, token: value.getString("token")); + BaseData baseData = await apiService.vipDetail({ + "id": widget.arguments["id"], + "latitude": "$latitude", + "longitude": "$longitude", + }).catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + vipCard = baseData.data; + refreshController.loadComplete(); + } else { + refreshController.loadFailed(); + } + print("object:object"); + setState(() {}); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppBar( + title: "店铺充值", + titleColor: Colors.black, + background: Colors.white, + brightness: Brightness.dark, + leadingColor: Colors.black, + ), + body: + Column( + children: [ + shopRechargeCard(), + // NoDataView( + // src: "assets/image/xiao_fei.webp", + // isShowBtn: false, + // text: "当前店铺暂无充值套餐~", + // fontSize: 16.sp, + // margin: EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w), + // ), + Expanded(child:ListView.builder( + padding: EdgeInsets.zero, + itemCount: 6, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + setState(() { + selectIndex = position; + }); + }, + child: rechargeItem(position)); + }, + )), + Container( + width: double.infinity, + margin: EdgeInsets.only(left: 16, right: 16), + padding: EdgeInsets.only( + top: 20.h, + bottom: 24.h, + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 16.h), + child: Text( + S.of(context).zhifufangshi, + style: TextStyle( + fontSize: 16.sp, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + checkIndex = 2; + }); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Image.asset( + "assets/image/icon_we_chat.webp"), + Expanded( + flex: 1, + child: Padding( + padding: EdgeInsets.only(left: 8.w), + child: Text( + S.of(context).weixinzhifu, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + ), + ), + ), + ), + checkView(2), + ], + ), + ), + SizedBox(height: 10.h), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + checkIndex = 3; + }); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Image.asset( + "assets/image/icon_alipay.webp"), + Expanded( + flex: 1, + child: Padding( + padding: EdgeInsets.only(left: 8.w), + child: Text( + S.of(context).zhifubao, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + ), + ), + ), + ), + checkView(3), + ], + ), + ), + ], + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: GestureDetector( + onTap: () { + }, + child: Container( + height: 56.h, + width: double.infinity, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(27), + ), + margin: EdgeInsets.only( + top: 12.h, left: 16.w, right: 16.w, bottom: 21.h), + child: Text( + S.of(context).querenchongzhi, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + ), + ) + ], + ), + ); + } + + ///卡片背景底色 + int colorByName(String storeName) { + if (storeName == null) return 0xFF32A060; + if (storeName.contains("百年川椒") || storeName.contains("百年川椒")) { + return 0xFFC30D23; + } else if (storeName.contains("海峡姐妹") || storeName.contains("海峽姐妹")) { + return 0xFFE4C796; + } else if (storeName.contains("前进麦味") || storeName.contains("前進麥味")) { + return 0xFF265782; + } + return 0xFF32A060; + } + + ///卡片详情 + Widget shopRechargeCard() { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pushNamed( + '/router/mine_shop_details', + arguments: {"id": widget.arguments["id"]}); + }, + child: Container( + width: double.infinity, + // height:140.h, + margin: EdgeInsets.only(bottom: 24.h, top: 14.h, left: 14.w, right: 14.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: new BorderRadius.only( + topLeft: Radius.circular(6), + topRight: Radius.circular(6), + ), + color: Color(colorByName(vipCard?.tenantName ?? "")), + ), + padding: EdgeInsets.only(left: 12.w), + height: 62.h, + child: Row( + children: [ + MImage( + (vipCard?.storeList?.length ?? 0) > 0 + ? vipCard.storeList[0].logo + : "", + width: 38, + height: 38, + radius: BorderRadius.circular(100), + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + SizedBox( + width: 6, + ), + Text( + vipCard != null ? vipCard.tenantName : "", + style: TextStyle( + color: Color(0xFFFFFFFF), + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ], + ), + ), + Container( + decoration: BoxDecoration( + borderRadius: new BorderRadius.only( + bottomRight: Radius.circular(6), + topRight: Radius.circular(6), + ), + color: Colors.white, + ), + padding: EdgeInsets.all(12.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "店铺余额(元)", + style: TextStyle( + color: Color(0xFF262626), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + Text( + "No.${vipCard?.id ?? ""}", + style: TextStyle( + color: Color(0xFF262626), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + ), + SizedBox( + height: 4.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Text( + "¥ ${vipCard != null ? vipCard.balance : ""}", + style: TextStyle( + color: Color(0xFF262626), + fontSize: 24.sp, + fontFamily: 'JDZhengHT', + fontWeight: MyFontWeight.medium, + ), + ),), + Text( + "适用门店", + style: TextStyle( + color: Color(0xFF262626), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + SizedBox(width: 2,), + Image.asset( + "assets/image/icon_right_z.webp", + width: 16, + height: 16, + color: Color(0xFF262626), + ) + ], + ), + ], + ), + ), + ], + ), + ), + ); + } + + ///充值item + Widget rechargeItem(index) { + return Container( + width: double.infinity, + height: 69.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + border: Border.all( + color: + selectIndex == index ? Color(0xFF32A060) : Color(0xFFFAFAFA), + width: selectIndex == index ? 1 : 0, + ), + color: + selectIndex == index ? Color(0XFFF0FAF4) : Colors.white), + margin: EdgeInsets.only(bottom: 14.h,left: 14.w,right: 14.w), + padding: EdgeInsets.only(left: 16), + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + flex: 1, + child: Container( + child: Text.rich( + TextSpan(children: [ + TextSpan( + text: "储值 ", + style: TextStyle( + fontSize: 12.sp, + color: selectIndex == index + ? Color(0xFF4D4D4D) + : Color(0xFF868686), + fontWeight: MyFontWeight.regular), + ), + TextSpan( + text: + "555元", + style: TextStyle( + fontSize: 18.sp, + fontFamily: 'JDZhengHT', + color: selectIndex == index + ? Color(0xFF353535) + : Color(0xFF868686), + fontWeight: MyFontWeight.semi_bold), + ), + ]), + ), + )), + Container( + width: 1.w, + height: 37.h, + color: + selectIndex == index ? Color(0xFF32A060) : Color(0xFF979797), + margin: EdgeInsets.only(right: 16.w, left: 12), + ), + Expanded( + flex: 2, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text.rich( + TextSpan(children: [ + TextSpan( + text: "实际到账 ", + style: TextStyle( + fontSize: 12.sp, + color: selectIndex == index + ? Color(0xFF353535) + : Color(0xFF868686), + fontWeight: MyFontWeight.regular), + ), + TextSpan( + text: + "526元", + style: TextStyle( + fontSize: 18.sp, + fontFamily: 'JDZhengHT', + color: selectIndex == index + ? Color(0xFF353535) + : Color(0xFF868686), + fontWeight: MyFontWeight.semi_bold), + ), + ]), + ), + SizedBox( + height: 4.h, + ), + GestureDetector( + onTap: () { + setState(() { + if (selectIndex == index) showRecharge(index); + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "充值说明", + style: TextStyle( + color: selectIndex == index + ? Color(0xFF4D4D4D) + : Color(0xFF868686), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + Icon( + Icons.chevron_right, + size: 20, + color: selectIndex == index + ? Color(0xFF353535) + : Color(0xFF868686), + ), + ], + )), + ], + )) + ], + )); + } + + Widget checkView(var index) { + return Container( + padding: EdgeInsets.only(right: 16.w, left: 46.w), + alignment: Alignment.center, + child: Image.asset( + checkIndex != index + ? "assets/image/icon_radio_unselected.webp" + : "assets/image/icon_radio_selected.webp", + width: 15.w, + height: 15.h, + ), + ); + } + + ///充值说明底部弹窗 + showRecharge(index) { + showModalBottomSheet( + context: context, + backgroundColor: Colors.transparent, + builder: (context) { + return RechargeWidget(rechargeActLists.preferentialList[index]); + }); + } + + Widget shopItem(StoreListBean store) { + return Container( + decoration: BoxDecoration( + borderRadius: new BorderRadius.circular(6), + color: Colors.white, + ), + padding: EdgeInsets.all(12), + margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: Text( + (store != null) ? store.storeName : "", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + ), + GestureDetector( + onTap: () { + // Navigator.of(context).pushNamed('/router/union_detail_page', + // arguments: {"id": store.id}); + if (store.posType.code == "NORMALSTORE") { + Scan.toScan( + context, + store.id, + store.tenantCode, + store.storeName, + ); + } else { + Navigator.of(context).pushNamed( + '/router/store_order', + arguments: { + "id": store.id, + "tenant": store.tenantCode, + "storeName": store.storeName + }, + ); + } + }, + child: Text( + S.of(context).chakan, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xff32A060), + ), + ), + ), + Icon( + Icons.chevron_right, + color: Color(0xff32A060), + size: 16, + ), + ], + ), + SizedBox( + height: 8.h, + ), + Row( + children: [ + Text( + "${S.of(context).dizhi}: ", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xff353535), + ), + ), + Expanded( + child: Text( + store.address, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xff353535), + ), + ), + flex: 1, + ) + ], + ), + SizedBox( + height: 4.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Text( + S.of(context).yingyeshijian((store.openStartTime == null && + store.openEndTime == null) + ? S.of(context).quantian + : "${store.openStartTime.substring(0, store.openStartTime.lastIndexOf(":"))} - ${store.openEndTime.substring(0, store.openEndTime.lastIndexOf(":"))}"), + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xff353535), + ), + ), + ), + Text( + (store.distance ?? 0) > 1000 + ? S.of(context).gongli( + ((store.distance ?? 0) / 1000 * 100).toInt() / 100.0) + : S + .of(context) + .mi(((store.distance ?? 0) * 100).toInt() / 100.0), + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xff868686), + ), + ), + ], + ), + ], + ), + ); + } +} diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index c53bcb3b..cd64533f 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -182,7 +182,7 @@ class _MineItem extends State { }); }, child: mineItem( - S.of(context).dianpuyue, + "店铺充值", "assets/image/shop_yue.webp", ), ),), diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart index 31b82e0e..abd7ef2f 100644 --- a/lib/mine/recharge_page.dart +++ b/lib/mine/recharge_page.dart @@ -150,386 +150,374 @@ class _RechargePage extends State { body: Container( color: Color(0xFFFFFFFF), child: SingleChildScrollView( + physics: BouncingScrollPhysics(), child: Container( - child: Stack( + child: Column( children: [ - Column( - children: [ - SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - child: Column( + Container( + margin: EdgeInsets.only(left: 16, right: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + // ItemInputWidget( + // S.of(context).qingshuruchongzhijine, + // hintText: "", + // controller: controller, + // padding: EdgeInsets.all(20), + // errorText: S.of(context).chongzhizuixiaojine(100), + // titleColor: Color(0xFF727272), + // errorTextColor: Color(0xFF32A060), + // radius: 8, + // discount: discount / 10, + // style: TextStyle( + // fontWeight: FontWeight.bold, + // fontSize: 27.sp, + // color: color, + // ), + // inputLimit: 6, + // textInputType: TextInputType.number, + // textInputFormatter: + // FilteringTextInputFormatter.digitsOnly, + // onChanged: (value) { + // if (value != null && + // value != "" && + // double.tryParse(value) < 100) { + // color = Colors.red; + // } else { + // color = Colors.black; + // } + // setState(() {}); + // }, + // ), + SizedBox( + height: 20, + ), + Row( children: [ - Container( - margin: EdgeInsets.only(left: 16, right: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - // ItemInputWidget( - // S.of(context).qingshuruchongzhijine, - // hintText: "", - // controller: controller, - // padding: EdgeInsets.all(20), - // errorText: S.of(context).chongzhizuixiaojine(100), - // titleColor: Color(0xFF727272), - // errorTextColor: Color(0xFF32A060), - // radius: 8, - // discount: discount / 10, - // style: TextStyle( - // fontWeight: FontWeight.bold, - // fontSize: 27.sp, - // color: color, - // ), - // inputLimit: 6, - // textInputType: TextInputType.number, - // textInputFormatter: - // FilteringTextInputFormatter.digitsOnly, - // onChanged: (value) { - // if (value != null && - // value != "" && - // double.tryParse(value) < 100) { - // color = Colors.red; - // } else { - // color = Colors.black; - // } - // setState(() {}); - // }, - // ), - SizedBox( - height: 20, - ), - Row( - children: [ - Expanded( - child: Text( - S.of(context).zhanghuyue, - style: TextStyle( - fontSize: 15.sp, - color: Color(0xFF181818), - fontFamily: 'JDZhengHT', - fontWeight: - MyFontWeight.semi_bold), - )), - Text.rich( - TextSpan(children: [ - TextSpan( - text: "$mBalance", - style: TextStyle( - fontSize: 26.sp, - fontFamily: 'JDZhengHT', - color: Color(0xFF181818), - fontWeight: - MyFontWeight.semi_bold), - ), - TextSpan( - text: "元", - style: TextStyle( - fontSize: 15.sp, - color: Color(0xFF181818), - fontWeight: - MyFontWeight.semi_bold), - ), - ]), - ), - ], - ), - SizedBox(height: 28), - rechargeList(), - // Row( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.spaceAround, - // children: [ - // if (vipRuleDetails?.recharge != null && - // vipRuleDetails.recharge != "") - // Expanded( - // child: Container( - // color: Colors.white, - // child: Html( - // data: "注意:${vipRuleDetails?.recharge ?? ""}", - // customImageRenders: { - // networkSourceMatcher(): networkImageRender( - // loadingWidget: () { - // return Container(); - // }, - // ), - // }, - // ), - // ), - // ) - // ], - // ), - ], + Expanded( + child: Text( + S.of(context).zhanghuyue, + style: TextStyle( + fontSize: 15.sp, + color: Color(0xFF181818), + fontFamily: 'JDZhengHT', + fontWeight: + MyFontWeight.semi_bold), )), - Container( - width: double.infinity, - margin: EdgeInsets.only(left: 16, right: 16), - padding: EdgeInsets.only( - top: 20.h, - bottom: 24.h, - ), - // decoration: BoxDecoration( - // color: Colors.white, - // borderRadius: BorderRadius.circular(4), - // ), - child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(bottom: 16.h), - child: Text( - S.of(context).zhifufangshi, - style: TextStyle( - fontSize: 16.sp, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - checkIndex = 2; - }); - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Image.asset( - "assets/image/icon_we_chat.webp"), - Expanded( - flex: 1, - child: Padding( - padding: EdgeInsets.only(left: 8.w), - child: Text( - S.of(context).weixinzhifu, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - ), - ), - ), - ), - checkView(2), - ], - ), - ), - SizedBox(height: 10.h), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - checkIndex = 3; - }); - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Image.asset( - "assets/image/icon_alipay.webp"), - Expanded( - flex: 1, - child: Padding( - padding: EdgeInsets.only(left: 8.w), - child: Text( - S.of(context).zhifubao, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - ), - ), - ), - ), - checkView(3), - ], - ), - ), - ], - ), + Text.rich( + TextSpan(children: [ + TextSpan( + text: "$mBalance", + style: TextStyle( + fontSize: 26.sp, + fontFamily: 'JDZhengHT', + color: Color(0xFF181818), + fontWeight: + MyFontWeight.semi_bold), + ), + TextSpan( + text: "元", + style: TextStyle( + fontSize: 15.sp, + color: Color(0xFF181818), + fontWeight: + MyFontWeight.semi_bold), + ), + ]), ), - if((rechargeActLists?.isOpen ?? false) == true) - GestureDetector( - onTap: () { - showRecommendStore(); - }, - child: Container( - padding: EdgeInsets.only( - left: 14.w, - right: 16.w, - top: 14.h, - bottom: 14.h), - margin: EdgeInsets.only( - bottom: 22.h, left: 14.w, right: 14.w), - decoration: BoxDecoration( - color: Color(0xFFFAFAFA), - borderRadius: BorderRadius.circular(4), + ], + ), + SizedBox(height: 28), + rechargeList(), + // Row( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisAlignment: MainAxisAlignment.spaceAround, + // children: [ + // if (vipRuleDetails?.recharge != null && + // vipRuleDetails.recharge != "") + // Expanded( + // child: Container( + // color: Colors.white, + // child: Html( + // data: "注意:${vipRuleDetails?.recharge ?? ""}", + // customImageRenders: { + // networkSourceMatcher(): networkImageRender( + // loadingWidget: () { + // return Container(); + // }, + // ), + // }, + // ), + // ), + // ) + // ], + // ), + ], + )), + Container( + width: double.infinity, + margin: EdgeInsets.only(left: 16, right: 16), + padding: EdgeInsets.only( + top: 20.h, + bottom: 24.h, + ), + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.circular(4), + // ), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 16.h), + child: Text( + S.of(context).zhifufangshi, + style: TextStyle( + fontSize: 16.sp, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + checkIndex = 2; + }); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Image.asset( + "assets/image/icon_we_chat.webp"), + Expanded( + flex: 1, + child: Padding( + padding: EdgeInsets.only(left: 8.w), + child: Text( + S.of(context).weixinzhifu, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), ), - child: Row( - children: [ - Image.asset( - "assets/image/recharge_z.webp", - width: 16.w, - height: 17.h, - fit: BoxFit.fill, - ), - SizedBox(width: 8.w), - Expanded( - child: Text( - recommendName ??"为喜爱门店打call!(可选)", - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - color: (recommendName != null) ?Color(0xFF32A060):Color(0xFF868686), - ), - )), - Icon( - Icons.arrow_forward_ios, - size: 16, - ), - ], - )), + ), + ), ), - Align( - alignment: Alignment.bottomCenter, - child: GestureDetector( - onTap: () { - recharge(); - }, - child: Container( - height: 56.h, - width: double.infinity, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(27), - ), - margin: EdgeInsets.only( - left: 16, right: 16, bottom: 21), - child: Text( - S.of(context).querenchongzhi, - style: TextStyle( - fontSize: 16.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, - ), + checkView(2), + ], + ), + ), + SizedBox(height: 10.h), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + checkIndex = 3; + }); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Image.asset( + "assets/image/icon_alipay.webp"), + Expanded( + flex: 1, + child: Padding( + padding: EdgeInsets.only(left: 8.w), + child: Text( + S.of(context).zhifubao, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), ), ), ), - - // Container( - // height: 56.h, - // color: Colors.white, - // child: Row( - // children: [ - // Expanded(child:Container( - // padding:EdgeInsets.only(top: 7.h,left:16), - // child:Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Row( - // children: [ - // Text( - // S.of(context).heji, - // style: TextStyle( - // fontSize: 14.sp, - // fontWeight: MyFontWeight.regular, - // color: Colors.black, - // ), - // ), - // Text( - // controller.text, - // style: TextStyle( - // fontSize: 16.sp, - // fontWeight: MyFontWeight.medium, - // color: Color(0xFF32A060), - // ), - // ), - // ], - // ), - // if(controller.text != "") - // Text.rich( - // TextSpan( - // children: [ - // TextSpan( - // text: "充值", - // style: TextStyle( - // fontSize:12.sp, - // fontWeight: MyFontWeight.regular, - // color: Color(0xFFADADAD), - // ), - // ), - // TextSpan( - // text:"¥${controller.text}", - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.regular, - // color:Color(0xff3541C9), - // ), - // ), - // TextSpan( - // text: "赠送", - // style: TextStyle( - // fontSize:12.sp, - // fontWeight: MyFontWeight.regular, - // color: Color(0xFFADADAD), - // ), - // ), - // TextSpan( - // text:"¥${((double.tryParse(controller.text)??0) - ((double.tryParse(controller.text)??0) * (discount/100))).toStringAsFixed(2)}", - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.regular, - // color: Color(0xff3541C9), - // ), - // ),TextSpan( - // text: "元", - // style: TextStyle( - // fontSize:12.sp, - // fontWeight: MyFontWeight.regular, - // color: Color(0xFFADADAD), - // ), - // ), - // ], - // ), - // ), - // ], - // )) - // ), - // GestureDetector( - // onTap: () { - // recharge(); - // }, - // child: RoundButton( - // width: 103.w, - // height: 54.h, - // text: S.of(context).chongzhi, - // textColor: Colors.white, - // fontWeight: MyFontWeight.regular, - // backgroup: Color(0xFF32A060), - // radius: 0, - // fontSize: 16.sp, - // padding: EdgeInsets.symmetric(vertical: 5.h), - // ), - // ), - // ], - // ), - // ) - ) + ), + checkView(3), ], ), ), - ) - ], + ], + ), ), + if((rechargeActLists?.isOpen ?? false) == true) + GestureDetector( + onTap: () { + showRecommendStore(); + }, + child: Container( + padding: EdgeInsets.only( + left: 14.w, + right: 16.w, + top: 14.h, + bottom: 14.h), + margin: EdgeInsets.only( + bottom: 22.h, left: 14.w, right: 14.w), + decoration: BoxDecoration( + color: Color(0xFFFAFAFA), + borderRadius: BorderRadius.circular(4), + ), + child: Row( + children: [ + Image.asset( + "assets/image/recharge_z.webp", + width: 16.w, + height: 17.h, + fit: BoxFit.fill, + ), + SizedBox(width: 8.w), + Expanded( + child: Text( + recommendName ??"为喜爱门店打call!(可选)", + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + color: (recommendName != null) ?Color(0xFF32A060):Color(0xFF868686), + ), + )), + Icon( + Icons.arrow_forward_ios, + size: 16, + ), + ], + )), + ), + Align( + alignment: Alignment.bottomCenter, + child: GestureDetector( + onTap: () { + recharge(); + }, + child: Container( + height: 56.h, + width: double.infinity, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(27), + ), + margin: EdgeInsets.only( + left: 16, right: 16, bottom: 21), + child: Text( + S.of(context).querenchongzhi, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + ), + + // Container( + // height: 56.h, + // color: Colors.white, + // child: Row( + // children: [ + // Expanded(child:Container( + // padding:EdgeInsets.only(top: 7.h,left:16), + // child:Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // children: [ + // Text( + // S.of(context).heji, + // style: TextStyle( + // fontSize: 14.sp, + // fontWeight: MyFontWeight.regular, + // color: Colors.black, + // ), + // ), + // Text( + // controller.text, + // style: TextStyle( + // fontSize: 16.sp, + // fontWeight: MyFontWeight.medium, + // color: Color(0xFF32A060), + // ), + // ), + // ], + // ), + // if(controller.text != "") + // Text.rich( + // TextSpan( + // children: [ + // TextSpan( + // text: "充值", + // style: TextStyle( + // fontSize:12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFFADADAD), + // ), + // ), + // TextSpan( + // text:"¥${controller.text}", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color:Color(0xff3541C9), + // ), + // ), + // TextSpan( + // text: "赠送", + // style: TextStyle( + // fontSize:12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFFADADAD), + // ), + // ), + // TextSpan( + // text:"¥${((double.tryParse(controller.text)??0) - ((double.tryParse(controller.text)??0) * (discount/100))).toStringAsFixed(2)}", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xff3541C9), + // ), + // ),TextSpan( + // text: "元", + // style: TextStyle( + // fontSize:12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFFADADAD), + // ), + // ), + // ], + // ), + // ), + // ], + // )) + // ), + // GestureDetector( + // onTap: () { + // recharge(); + // }, + // child: RoundButton( + // width: 103.w, + // height: 54.h, + // text: S.of(context).chongzhi, + // textColor: Colors.white, + // fontWeight: MyFontWeight.regular, + // backgroup: Color(0xFF32A060), + // radius: 0, + // fontSize: 16.sp, + // padding: EdgeInsets.symmetric(vertical: 5.h), + // ), + // ), + // ], + // ), + // ) + ) ], ), ), From 8a96220ccf9af38b902f629ad1605502e0a6a225 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Sat, 12 Aug 2023 13:30:39 +0800 Subject: [PATCH 07/35] =?UTF-8?q?=E8=81=94=E7=9B=9F=E6=9D=BF=E5=9D=97ui?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=8C=E6=9A=82=E6=9C=AA=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E5=AE=8C=EF=BC=88=E5=BE=85=E6=9B=B4=E6=94=B9=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 + assets/image/2x/icon_search.webp | Bin 0 -> 1058 bytes assets/image/3x/icon_search.webp | Bin 0 -> 1564 bytes assets/image/icon_search.webp | Bin 0 -> 724 bytes assets/map_style/chinese_cities.json | 476 +++++++++++++++++++++++++++ lib/main.dart | 3 + lib/union/union_list.dart | 2 +- lib/union/union_page.dart | 427 ++++++++++++++---------- lib/union/union_select_city.dart | 415 +++++++++++++++++++++++ 9 files changed, 1142 insertions(+), 184 deletions(-) create mode 100644 assets/image/2x/icon_search.webp create mode 100644 assets/image/3x/icon_search.webp create mode 100644 assets/image/icon_search.webp create mode 100644 assets/map_style/chinese_cities.json create mode 100644 lib/union/union_select_city.dart diff --git a/README.md b/README.md index cbc20081..aa4f7f4f 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,9 @@ samples, guidance on mobile development, and a full API reference. 小米开放平台 83364300@qq.com 具体问 :(汪姐) 推送:使用腾讯云推送 tpns 需扫码登录 (有问题同华为➕微信||或重新注册账号替换相关appKey) + + 友盟: wu_rong 密码:Zxc09876 + https://pos.platform.lotus-wallet.com/app/ 生产环境 http://192.168.10.236:8765/app/ 测试环境 diff --git a/assets/image/2x/icon_search.webp b/assets/image/2x/icon_search.webp new file mode 100644 index 0000000000000000000000000000000000000000..7aa75c66f155e78ada5c738ae333babc755a58b9 GIT binary patch literal 1058 zcmWIYbaRtpVPFV%bqWXzu!!JdU|=u+Vrek)baoCn!3g9sFrEOBEI_H;ypp0IcPE92 z$S4K&2Mmlr2nLDC#RU)+RuZV{+ck*V%eq)q;1}dfNi9wWD)|7!Dn&rcfo>83vPIG% zYz+`Q3BtAkvCB&eN`PttK=2?(*InG6iuTNxN6ZXv`}7BDdI zw=ghlJC6`Ugh@eSQ6ktlU~DijrKK@2d|J-Hz#GZHAbf#=fh!s;2PAN~O#vt+19VqD z5T-NaFr+dlFnBWLF(fnS0a-@CNHt_I1IDnAHWLGbzVrb$f%wM?lTQ;`?spg&~4Z3RZ5%; zuB*L7d_RR>RoQ9iHksi=fDDVk(S+5fR8)4ZVmhQ^eau5>mDb(dP*zvPBMc0aBSITJ z*Jw=&2yJ9wVh9Kb^<+}Gv8^m;=gn;&pV!?!v+b?bXL*Oe@7vP^F4nW=-PQ=L=2;x> zF=-uN<@5@}UmOevemc$F`^$gT`@1r^b8SL-Z@k!W`Gj?ih#Rl; zv+MgGEg|#$3Mt z=8DIx<~dJJ)Jja5(wr#Xajn<^fZc%GLRwZJ(_OJt4)WbEtH2vz1-qi46<#c>SVtua>e4 zuCBaZV4c1FH(SfvurINPug_b*_gD6#Gi$=;Pt|2T+&6u9_+#dLjt~DY?lIVx9en>O l<4Jaw6yq21=kjIOEw!E7CRr!F%PWO}<6n2-&U6Dk1^`yuVs-!k literal 0 HcmV?d00001 diff --git a/assets/image/3x/icon_search.webp b/assets/image/3x/icon_search.webp new file mode 100644 index 0000000000000000000000000000000000000000..d3f8316ef801c9033d2d313ce1bcd431fe3038e4 GIT binary patch literal 1564 zcmaJb5M;3t*#u+>3aKn%i>NN~~CJJZ+boX<*PnQ&lOTkg;sx3=Vq* zeKaDf+1?dxkIhFF|4*tNWpWsZM20va9@!k}Ne96?kt-N!7<7)TU{@tR$z^j94ONNb z18D9DK8j$g$Pe(54={rruhd^dG_I_e1m#{zQ=U$P8B6y^<~4{L0S9QX3*40FM{>mC z3IVpw0H~y|az}0fR9^tl?_cEz`2gCf0K%?SZuOtA!{fu3m%|_t9T5RAT@0WZ1hBpv zKs|W5hJ^p<%@ipaA$`RmBNAeO38vr!vA_UZ1UVp=N&*+;hJ7uO_3f-cecdixm5|lf z7BaL*Nj&A0sears3Fq>tJ~HD7S-E_EhFL2yWSm->BR#Pnim7~F zLS$%gIvW<3jE%Gw-Y@(!votAX2h#b((4{4poUb^3$UM8C0FEF1o}jc!K$J)lYjcyL zZBizZtHtAQZwuNEuBEW9ort!fV=H=TbUsQTn8?KB*P`~G+{h@c_S01eb95z(2WMvr9yZul5iB$A60%a~(YzZT zcmV+@J|$TmJk|W&=B@k`K16{ufD%QN((en9)G{Mg9enShi_n=Kc%OOI5&>Uf5YWVf zqIu2t)I|)@`yop#%2_W?q>-H&VxhlSxKS(|e@~J}SILu;&ZjLpvc)cb>0$N7M&lM~ zN^6k?yvya4JsN-7Z)d%Q<+Mzuc|T<4yh{qxL*9ZTb58F~|C{*@kmAj_V@E&W_j}#3 z+~$LMhGQE;MQ_cLYxsMzC6_dDcZrR9n?_D_>?o5iKyk+>*|hx)UF;EbJJxk%^L4vE z{WeO<#lRHNA8~$k?My$_FWOh@Qb-7rFnL!lFx0?_`1&a5Wl0ECMu$O8w^H30Y;SrOI zGyCBJZ$ZjU46Z^`aOg$~HTW)qSa>mJ+lBCo>V*@oJiAo?2nA z^)0+nvS)$kbX1N>@!xo1eYdxge=r33XPD7Ojh#ZiXP3(Tp*dpP3+Sz5_B|p)9Clrq z1c+Oi$#FkRcDh}=Z4i!Og*+-U4X z$TS$Bl5T5f7q*xw1~@l{%zL}9&Yv}uM==f3_z@I4xsgkw7HMcSza}dC3?Yc@KJaS~ zQ;g1Q74#>fehZm&jCBYK4#!@K(eApi0oKoIxIojznL< koxQckf+mudwV78;xizFUlh4GyDp0fD_tUiZnQ%Aw7k3p*Pyhe` literal 0 HcmV?d00001 diff --git a/assets/image/icon_search.webp b/assets/image/icon_search.webp new file mode 100644 index 0000000000000000000000000000000000000000..d785e21d2acf82bdd4dacc860e50660509b2daa1 GIT binary patch literal 724 zcmWIYbaOky#J~{l>J$(bU=hK^z`$St#JphS>FgYEf)U7NU_1dLS%6Zxc_l?b?oJ93 zkx>fl4;UDM5DXHNiwhtutRzs?w`&l!mvynKz%R&|l3JV$RPq6cRf>R?1KlJ7WQ(Lj z*cu>q5`=97VwaZ`lmOKPfY?PLLC!#S3XrXlj>JwvVkZ|AfzZ zZ((5Ab{-*y2$O=uqC~K9EI^VeEscTU({f-WL^3c4UtnP1iU!L82^?-y07}UK-IWi7 z=?pmxsSFAXo(y>m$qafxmJu*g4H?XUG3;{>s8FBRfmuL*;euY3)Omlcs{(ztn~7|h zxa7>{dUySPCx^!a_ASMJUQ9C@ zSVR~eJTTalyVP>W@rE7h%l}JVlv4V&ep{~eu~e;-@(zE)&odl2{(axh47+j*>+c3_ zMIRoW4gYYIX(FRs#3`oj*(*NmYHOM7eShwv=XX|GD|{AbG|zorA98m~+2^Q0Rflx` IH9WtS0RkSh0ssI2 literal 0 HcmV?d00001 diff --git a/assets/map_style/chinese_cities.json b/assets/map_style/chinese_cities.json new file mode 100644 index 00000000..0b6d32b6 --- /dev/null +++ b/assets/map_style/chinese_cities.json @@ -0,0 +1,476 @@ +{ + "热门城市": [ + {"area": "上海"}, + {"area": "深圳"}, + {"area": "北京"}, + {"area": "广州"}, + {"area": "成都"}, + {"area": "杭州"}, + {"area": "南京"}, + {"area": "重庆"} + ], + "A": [ + { "area": "阿坝" }, + { "area": "阿克苏" }, + { "area": "阿拉善" }, + { "area": "阿勒泰" }, + { "area": "阿里" }, + { "area": "安庆" }, + { "area": "鞍山" }, + { "area": "安顺" }, + { "area": "安阳" }, + { "area": "澳门" } + ], + "B": [ + { "area": "北京" }, + { "area": "白银" }, + { "area": "保定" }, + { "area": "宝鸡" }, + { "area": "保山" }, + { "area": "包头" }, + { "area": "巴彦淖尔" }, + { "area": "巴音郭楞" }, + { "area": "巴中" }, + { "area": "北海" }, + { "area": "蚌埠" }, + { "area": "本溪" }, + { "area": "毕节" }, + { "area": "滨州" }, + { "area": "百色" } + ], + "C": [ + { "area": "重庆" }, + { "area": "成都" }, + { "area": "长春" }, + { "area": "常德" }, + { "area": "昌都" }, + { "area": "长沙" }, + { "area": "长治" }, + { "area": "常州" }, + { "area": "巢湖" }, + { "area": "朝阳" }, + { "area": "潮州" }, + { "area": "承德" }, + { "area": "郴州" }, + { "area": "赤峰" }, + { "area": "池州" }, + { "area": "崇左" }, + { "area": "楚雄" }, + { "area": "滁州" } + ], + "D": [ + { "area": "大理" }, + { "area": "大连" }, + { "area": "丹东" }, + { "area": "大庆" }, + { "area": "大同" }, + { "area": "大兴安岭" }, + { "area": "达州" }, + { "area": "德宏" }, + { "area": "德阳" }, + { "area": "德州" }, + { "area": "迪庆" }, + { "area": "定西" }, + { "area": "东莞" }, + { "area": "东营" } + ], + "E": [ + { "area": "鄂尔多斯" }, + { "area": "恩施" }, + { "area": "鄂州" } + ], + "F": [ + { "area": "防城港" }, + { "area": "佛山" }, + { "area": "抚顺" }, + { "area": "阜新" }, + { "area": "阜阳" }, + { "area": "福州" }, + { "area": "抚州" } + ], + "G": [ + { "area": "广元" }, + { "area": "广安" }, + { "area": "广州" }, + { "area": "贵港" }, + { "area": "桂林" }, + { "area": "贵阳" }, + { "area": "甘南" }, + { "area": "甘孜" }, + { "area": "赣州" }, + { "area": "固原" }, + { "area": "果洛" } + ], + "H": [ + { "area": "哈尔滨" }, + { "area": "海口" }, + { "area": "海北" }, + { "area": "海东" }, + { "area": "海南" }, + { "area": "海西" }, + { "area": "邯郸" }, + { "area": "杭州" }, + { "area": "汉中" }, + { "area": "鹤壁" }, + { "area": "河池" }, + { "area": "合肥" }, + { "area": "鹤岗" }, + { "area": "黑河" }, + { "area": "衡水" }, + { "area": "衡阳" }, + { "area": "河源" }, + { "area": "菏泽" }, + { "area": "贺州" }, + { "area": "红河" }, + { "area": "淮安" }, + { "area": "淮北" }, + { "area": "怀化" }, + { "area": "淮南" }, + { "area": "黄冈" }, + { "area": "黄南" }, + { "area": "黄山" }, + { "area": "黄石" }, + { "area": "呼和浩特" }, + { "area": "葫芦岛" }, + { "area": "呼伦贝尔" }, + { "area": "湖州" }, + { "area": "惠州" }, + { "area": "蚌埠" } + ], + "J": [ + { "area": "佳木斯" }, + { "area": "吉安" }, + { "area": "江门" }, + { "area": "焦作" }, + { "area": "嘉兴" }, + { "area": "嘉峪关" }, + { "area": "揭阳" }, + { "area": "吉林" }, + { "area": "济南" }, + { "area": "金昌" }, + { "area": "晋城" }, + { "area": "景德镇" }, + { "area": "荆门" }, + { "area": "荆州" }, + { "area": "金华" }, + { "area": "济宁" }, + { "area": "晋中" }, + { "area": "锦州" }, + { "area": "九江" }, + { "area": "酒泉" } + ], + "K": [ + { "area": "昆明" }, + { "area": "开封" }, + { "area": "喀什" }, + { "area": "克拉玛依" }, + { "area": "克孜勒苏" }, + { "area": "来宾" }, + { "area": "莱芜" }, + { "area": "廊坊" }, + { "area": "拉萨" }, + { "area": "乐山" }, + { "area": "凉山" }, + { "area": "连云港" }, + { "area": "聊城" }, + { "area": "辽阳" }, + { "area": "辽源" }, + { "area": "丽江" }, + { "area": "临沧" }, + { "area": "临汾" }, + { "area": "临夏" }, + { "area": "临沂" }, + { "area": "林芝" }, + { "area": "丽水" }, + { "area": "六安" }, + { "area": "六盘水" }, + { "area": "陇南" }, + { "area": "龙岩" }, + { "area": "娄底" }, + { "area": "漯河" }, + { "area": "洛阳" }, + { "area": "泸州" } + ], + "L": [ + { "area": "吕梁" }, + { "area": "来宾" }, + { "area": "莱芜" }, + { "area": "廊坊" }, + { "area": "拉萨" }, + { "area": "乐山" }, + { "area": "凉山" }, + { "area": "连云港" }, + { "area": "聊城" }, + { "area": "辽阳" }, + { "area": "辽源" }, + { "area": "丽江" }, + { "area": "临沧" }, + { "area": "临汾" }, + { "area": "临夏" }, + { "area": "临沂" }, + { "area": "林芝" }, + { "area": "丽水" }, + { "area": "六安" }, + { "area": "六盘水" }, + { "area": "陇南" }, + { "area": "龙岩" }, + { "area": "娄底" }, + { "area": "漯河" }, + { "area": "洛阳" }, + { "area": "泸州" } + ], + "M": [ + { "area": "马鞍山" }, + { "area": "茂名" }, + { "area": "眉山" }, + { "area": "梅州" }, + { "area": "绵阳" }, + { "area": "牡丹江" } + ], + "N": [ + { "area": "南京" }, + { "area": "南昌" }, + { "area": "南宁" }, + { "area": "南充" }, + { "area": "南平" }, + { "area": "南通" }, + { "area": "南阳" }, + { "area": "那曲" }, + { "area": "内江" }, + { "area": "宁德" }, + { "area": "怒江" } + ], + "P": [ + { "area": "攀枝花" }, + { "area": "盘锦" }, + { "area": "平顶山" }, + { "area": "平凉" }, + { "area": "萍乡" }, + { "area": "普洱" }, + { "area": "莆田" }, + { "area": "濮阳" } + ], + "Q": [ + { "area": "黔东南" }, + { "area": "黔南" }, + { "area": "黔西南" }, + { "area": "青岛" }, + { "area": "庆阳" }, + { "area": "清远" }, + { "area": "秦皇岛" }, + { "area": "钦州" }, + { "area": "齐齐哈尔" }, + { "area": "七台河" }, + { "area": "泉州" }, + { "area": "曲靖" }, + { "area": "衢州" } + ], + "R": [ + { "area": "日喀则" }, + { "area": "日照" } + ], + "S": [ + { "area": "上海" }, + { "area": "深圳" }, + { "area": "苏州" }, + { "area": "三门峡" }, + { "area": "三明" }, + { "area": "三亚" }, + { "area": "商洛" }, + { "area": "商丘" }, + { "area": "上饶" }, + { "area": "山南" }, + { "area": "汕头" }, + { "area": "汕尾" }, + { "area": "韶关" }, + { "area": "绍兴" }, + { "area": "邵阳" }, + { "area": "十堰" }, + { "area": "朔州" }, + { "area": "四平" }, + { "area": "松原" }, + { "area": "绥化" }, + { "area": "遂宁" }, + { "area": "随州" }, + { "area": "宿迁" }, + { "area": "宿州" } + ], + "T": [ + { "area": "天津" }, + { "area": "塔城" }, + { "area": "泰安" }, + { "area": "太原" }, + { "area": "台州" }, + { "area": "泰州" }, + { "area": "唐山" }, + { "area": "天水" }, + { "area": "铁岭" }, + { "area": "铜川" }, + { "area": "通化" }, + { "area": "通辽" }, + { "area": "铜陵" }, + { "area": "铜仁" }, + { "area": "台湾" }, + { "area": "吐鲁番" } + ], + "W": [ + { "area": "武汉" }, + { "area": "乌鲁木齐" }, + { "area": "无锡" }, + { "area": "威海" }, + { "area": "潍坊" }, + { "area": "文山" }, + { "area": "温州" }, + { "area": "乌海" }, + { "area": "芜湖" }, + { "area": "乌兰察布" }, + { "area": "武威" }, + { "area": "梧州" } + ], + "X": [ + { "area": "厦门" }, + { "area": "西安" }, + { "area": "湘潭" }, + { "area": "湘西" }, + { "area": "襄阳" }, + { "area": "咸宁" }, + { "area": "咸阳" }, + { "area": "孝感" }, + { "area": "邢台" }, + { "area": "西宁" }, + { "area": "新乡" }, + { "area": "信阳" }, + { "area": "新余" }, + { "area": "忻州" }, + { "area": "西双版纳" }, + { "area": "宣城" }, + { "area": "许昌" }, + { "area": "徐州" } + ], + "Y": [ + { "area": "雅安" }, + { "area": "延安" }, + { "area": "延边" }, + { "area": "盐城" }, + { "area": "阳江" }, + { "area": "阳泉" }, + { "area": "扬州" }, + { "area": "烟台" }, + { "area": "宜宾" }, + { "area": "宜昌" }, + { "area": "伊春" }, + { "area": "宜春" }, + { "area": "伊犁" }, + { "area": "银川" }, + { "area": "营口" }, + { "area": "鹰潭" }, + { "area": "益阳" }, + { "area": "永州" }, + { "area": "岳阳" }, + { "area": "玉林" }, + { "area": "榆林" }, + { "area": "运城" }, + { "area": "云浮" }, + { "area": "玉树" }, + { "area": "玉溪" } + ], + "Z": [ + { "area": "杂多县" }, + { "area": "赞皇县" }, + { "area": "枣强县" }, + { "area": "枣阳市" }, + { "area": "枣庄" }, + { "area": "泽库县" }, + { "area": "增城市" }, + { "area": "曾都区" }, + { "area": "泽普县" }, + { "area": "泽州县" }, + { "area": "札达县" }, + { "area": "扎赉特旗" }, + { "area": "扎兰屯市" }, + { "area": "扎鲁特旗" }, + { "area": "扎囊县" }, + { "area": "张北县" }, + { "area": "张家港市" }, + { "area": "张家界" }, + { "area": "张家口" }, + { "area": "漳平市" }, + { "area": "漳州" }, + { "area": "章丘市" }, + { "area": "彰化县" }, + { "area": "张掖" }, + { "area": "漳浦县" }, + { "area": "章贡区" }, + { "area": "樟树市" }, + { "area": "长子县" }, + { "area": "湛江" }, + { "area": "诏安县" }, + { "area": "召陵区" }, + { "area": "昭平县" }, + { "area": "肇庆" }, + { "area": "昭通" }, + { "area": "赵县" }, + { "area": "昭阳区" }, + { "area": "招远市" }, + { "area": "正安县" }, + { "area": "正定县" }, + { "area": "正蓝旗" }, + { "area": "正宁县" }, + { "area": "蒸湘区" }, + { "area": "政和县" }, + { "area": "柘城县" }, + { "area": "正镶白旗" }, + { "area": "正阳县" }, + { "area": "郑州" }, + { "area": "镇安县" }, + { "area": "镇巴县" }, + { "area": "镇海区" }, + { "area": "镇江" }, + { "area": "镇康县" }, + { "area": "镇宁布依族苗族自治县" }, + { "area": "镇平县" }, + { "area": "镇坪县" }, + { "area": "镇雄县" }, + { "area": "镇原县" }, + { "area": "浈江区" }, + { "area": "志丹县" }, + { "area": "治多县" }, + { "area": "芷江侗族自治县" }, + { "area": "织金县" }, + { "area": "中江县" }, + { "area": "中牟县" }, + { "area": "中宁县" }, + { "area": "中山" }, + { "area": "中卫" }, + { "area": "钟祥市" }, + { "area": "中阳县" }, + { "area": "周宁县" }, + { "area": "周至县" }, + { "area": "庄河市" }, + { "area": "诸城市" }, + { "area": "驻马店" }, + { "area": "准格尔旗" }, + { "area": "涿鹿县" }, + { "area": "卓尼" }, + { "area": "涿州市" }, + { "area": "卓资县" }, + { "area": "珠海" }, + { "area": "珠晖区" }, + { "area": "株洲" }, + { "area": "株洲县" }, + { "area": "诸暨市" }, + { "area": "驻马店" }, + { "area": "庄河市" }, + { "area": "诸城市" }, + { "area": "准格尔旗" }, + { "area": "涿鹿县" }, + { "area": "卓尼" }, + { "area": "涿州市" }, + { "area": "卓资县" }, + { "area": "珠海" }, + { "area": "珠晖区" }, + { "area": "株洲" }, + { "area": "株洲县" }, + { "area": "诸暨市" } + ] +} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 98ec30b6..bbacd5b8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -73,6 +73,7 @@ import 'package:huixiang/settlement/settlement.dart'; import 'package:huixiang/store/store_view/product_meals_sku.dart'; import 'package:huixiang/test_page.dart'; import 'package:huixiang/union/location_map_page.dart'; +import 'package:huixiang/union/union_select_city.dart'; import 'package:huixiang/utils/ImgCachePath.dart'; import 'package:huixiang/vip/user_vip_service_page.dart'; @@ -440,4 +441,6 @@ Map routers = { BindingPhonePage(arguments:arguments), '/router/trading_card_page': (context, {arguments}) => TradingCardPage(), + '/router/union_select_city': (context, {arguments}) => + UnionSelectCity(), }; diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index c381f3f0..1137804f 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -37,7 +37,7 @@ class _UnionList extends State { Widget build(BuildContext context) { return Column( children: [ - buildSearchItem(), + // buildSearchItem(), Container( height: MediaQuery.of(context).size.height - 103.h - diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 19e69013..96214aac 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -33,6 +33,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import '../utils/flutter_utils.dart'; +import '../view_widget/item_title.dart'; class UnionPage extends StatefulWidget { final int initialIndex; @@ -61,6 +62,8 @@ class UnionPageState extends State ApiService apiService; bool isKeyBoardShow = false; BMFCoordinate latLng; + final TextEditingController editingController = TextEditingController(); + String areaName = ""; jumpIndex(jpIndex) { tabController.index = jpIndex; @@ -242,7 +245,7 @@ class UnionPageState extends State ); } BaseData> baseData = await apiService.queryStore({ - // "city": city, + "city": city, // "district": district, // "province": province, "latitude": latitude, @@ -303,71 +306,128 @@ class UnionPageState extends State onTap: () { FocusScope.of(context).requestFocus(FocusNode()); }, - child: Scaffold( - resizeToAvoidBottomInset: false, - appBar: MyAppBar( - title: "", - leading: false, - brightness: Brightness.light, - titleChild: PreferredSize( - preferredSize: Size(double.infinity, 38.h), - child: Theme( - data: ThemeData( - splashColor: Colors.transparent, // 点击时的水波纹颜色设置为透明 - highlightColor: Colors.transparent, // 点击时的背景高亮颜色设置为透明 - ), - child: TabBar( - controller: tabController, - isScrollable: true, - //可滚动 - indicatorColor: Color(0xff39B54A), - labelColor: Colors.black, - labelStyle: TextStyle( - fontSize: 18.sp, - fontWeight: FontWeight.bold, + child:Stack( + children: [ + Container( + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage("assets/image/settlement_bg.webp"), + ), + ), + width: double.infinity, + height: 306.h, + ), + Scaffold( + backgroundColor: Colors.transparent, + resizeToAvoidBottomInset: false, + appBar: PreferredSize( + preferredSize: Size(double.infinity, 100.h), + child: MyAppBar( + background: Color(0xFF32A060), + title: "", + leading: false, + brightness: Brightness.light, + bottom: PreferredSize( + preferredSize: Size(double.infinity, 38.h), + child:Align( + alignment: Alignment.centerLeft, + child: Theme( + data: ThemeData( + splashColor: Colors.transparent, // 点击时的水波纹颜色设置为透明 + highlightColor: Colors.transparent, // 点击时的背景高亮颜色设置为透明 + ), + child: TabBar( + controller: tabController, + isScrollable: true, + //可滚动 + indicatorColor: Colors.white, + labelColor: Colors.white, + labelStyle: TextStyle( + fontSize: 18.sp, + fontWeight: FontWeight.bold, + ), + unselectedLabelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.normal, + ), + // controller: tabController, + //未选中文字颜色 + unselectedLabelColor: Colors.white, + indicatorSize: TabBarIndicatorSize.label, + //指示器与文字等宽 + tabs: [ + MyTab(text: S.of(context).quanbu), + MyTab(text: S.of(context).chi), + MyTab(text: S.of(context).he), + MyTab(text: S.of(context).wan), + ], + )), ), - unselectedLabelStyle: TextStyle( - fontSize: 15.sp, - fontWeight: FontWeight.normal, + ), + titleChild:Row(children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context) + .pushNamed('/router/union_select_city') + .then((value) { + if (value != null) + setState(() { + areaName = value; + }); + }); + }, + child: Row( + children: [ + Text( + areaName ?? "武汉", + overflow: TextOverflow.ellipsis, + maxLines:1, + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.bold, + color: Colors.white), + ), + Icon( + Icons.keyboard_arrow_down, + color: Colors.white, + size: 24, + ) + ], + ), ), - // controller: tabController, - //未选中文字颜色 - unselectedLabelColor: Color(0xffA29E9E), - indicatorSize: TabBarIndicatorSize.label, - //指示器与文字等宽 - tabs: [ - MyTab(text: S.of(context).quanbu), - MyTab(text: S.of(context).chi), - MyTab(text: S.of(context).he), - MyTab(text: S.of(context).wan), - ], - )), - )), - body: TabBarView( - controller: tabController, - children: [ - UnionList(refreshController, storeList, () { - startLocation(true); - },(txt){ - queryStore("","","","","",txt,0); - }), - UnionList(refreshController1, storeList1, () { - startLocation(true); - },(txt){ - queryStore("","","","","",txt,0); - }), - UnionList(refreshController2, storeList2, () { - startLocation(true); - },(txt){ - queryStore("","","","","",txt,0); - }), - UnionList(refreshController3, storeList3, () { - startLocation(true); - },(txt){ - queryStore("","","","","",txt,0); - }), - ], - ), + SizedBox(width:10.w,), + Expanded(child:buildSearchItem()) + ],)), + ), + body: TabBarView( + controller: tabController, + children: [ + UnionList(refreshController, storeList, () { + startLocation(true); + },(txt){ + queryStore("","","","","",txt,0); + }), + UnionList(refreshController1, storeList1, () { + startLocation(true); + },(txt){ + queryStore("","","","","",txt,0); + }), + UnionList(refreshController2, storeList2, () { + startLocation(true); + },(txt){ + queryStore("","","","","",txt,0); + }), + UnionList(refreshController3, storeList3, () { + startLocation(true); + },(txt){ + queryStore("","","","","",txt,0); + }), + ], + ), + ), + ], )); // GestureDetector( // onTap: () { @@ -519,126 +579,127 @@ class UnionPageState extends State _mapController = controller; } - // Widget buildSearchItem() { - // return Container( - // height: 36.h, - // margin: EdgeInsets.fromLTRB(6.w, 0, 14.w, 0), - // padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), - // decoration: BoxDecoration( - // color: Color(0xFFF5FAF7), - // borderRadius: BorderRadius.circular(4), - // boxShadow: [ - // BoxShadow( - // color: Colors.black.withAlpha(12), - // offset: Offset(0, 3), - // blurRadius: 14, - // spreadRadius: 0, - // ), - // ], - // ), - // child: TextField( - // textInputAction: TextInputAction.search, - // onEditingComplete: () { - // startLocation(false); - // }, - // controller: editingController, - // cursorHeight: 30.h, - // decoration: InputDecoration( - // contentPadding: EdgeInsets.symmetric( - // vertical: 12.h, - // ), - // prefixIcon: Icon( - // Icons.search, - // size: 24, - // color: Colors.black, - // ), - // suffixIcon: InkWell( - // onTap: () { - // editingController.clear(); - // }, - // child: Icon( - // Icons.close, - // size: 19, - // color: Colors.grey, - // ), - // ), - // border: InputBorder.none, - // ), - // ), - // ); - // } + Widget buildSearchItem() { + return Container( + height: 36.h, + margin: EdgeInsets.fromLTRB(6.w, 0, 14.w, 0), + padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), + decoration: BoxDecoration( + color: Color(0xFFF5FAF7), + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: TextField( + textInputAction: TextInputAction.search, + onEditingComplete: () { + FocusScope.of(context).requestFocus(FocusNode()); + queryStore("","","","","",editingController.text,0); + }, + controller: editingController, + cursorHeight: 25.h, + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric( + vertical: 12.h, + ), + hintText: "搜索联盟会员店", + hintStyle: TextStyle( + fontSize: 12.sp, + color: Color(0xFFB3B3B3), + ), + prefixIcon:InkWell( + onTap: () { + queryStore("","","","","",editingController.text,0); + }, + child: Image.asset( + "assets/image/icon_search.webp", + width: 16, + height: 16, + ), + ), + border: InputBorder.none, + ), + ), + ); + } - // Widget buildSliverAppBar(BMFMapWidget map) { - // return SliverAppBar( - // // 滑上去时搜索隐藏 - // // floating: true, - // // snap: true, - // pinned: true, - // backgroundColor: Color(0xFFFAFAFA), - // elevation: 0, - // automaticallyImplyLeading: false, - // title: Container( - // height: 36.h, - // margin: EdgeInsets.fromLTRB(16.w, 0, 16.w, 0), - // padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), - // decoration: BoxDecoration( - // color: Colors.white, - // borderRadius: BorderRadius.all(Radius.circular(4)), - // boxShadow: [ - // BoxShadow( - // color: Colors.black.withAlpha(12), - // offset: Offset(0, 3), - // blurRadius: 14, - // spreadRadius: 0, - // ) - // ]), - // child: TextField( - // textInputAction: TextInputAction.search, - // onEditingComplete: () { - // startLocation(); - // }, - // controller: editingController, - // cursorHeight: 30.h, - // decoration: InputDecoration( - // contentPadding: EdgeInsets.symmetric(vertical: 12.h), - // prefixIcon: Icon( - // Icons.search, - // size: 24, - // color: Colors.black, - // ), - // suffixIcon: InkWell( - // onTap: () { - // editingController.clear(); - // }, - // child: Icon( - // Icons.close, - // size: 19, - // color: Colors.grey, - // ), - // ), - // border: InputBorder.none, - // ), - // ), - // ), - // flexibleSpace: FlexibleSpaceBar( - // background: Container( - // child: map, - // ), - // ), - // expandedHeight: 375.h, - // bottom: PreferredSize( - // preferredSize: Size(double.infinity, 52.h), - // child: Container( - // padding: EdgeInsets.only(top: 6.h), - // color: Color(0xFFFAFAFA), - // child: ItemTitle( - // text: S.of(context).jingbilianmenghuiyuandian, - // imgPath: "assets/image/icon_union_store.webp", - // ), - // ), - // ), - // ); - // } + Widget buildSliverAppBar(BMFMapWidget map) { + return SliverAppBar( + // 滑上去时搜索隐藏 + // floating: true, + // snap: true, + pinned: true, + backgroundColor: Color(0xFFFAFAFA), + elevation: 0, + automaticallyImplyLeading: false, + title: Container( + height: 36.h, + margin: EdgeInsets.fromLTRB(16.w, 0, 16.w, 0), + padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(4)), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ]), + child: TextField( + textInputAction: TextInputAction.search, + onEditingComplete: () { + startLocation(false); + }, + controller: editingController, + cursorHeight: 30.h, + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric(vertical: 12.h), + prefixIcon: Icon( + Icons.search, + size: 24, + color: Colors.black, + ), + suffixIcon: InkWell( + onTap: () { + editingController.clear(); + }, + child: Icon( + Icons.close, + size: 19, + color: Colors.grey, + ), + ), + border: InputBorder.none, + ), + ), + ), + flexibleSpace: FlexibleSpaceBar( + background: Container( + child: map, + ), + ), + expandedHeight: 375.h, + bottom: PreferredSize( + preferredSize: Size(double.infinity, 52.h), + child: Container( + padding: EdgeInsets.only(top: 6.h), + color: Color(0xFFFAFAFA), + child: ItemTitle( + text: S.of(context).jingbilianmenghuiyuandian, + imgPath: "assets/image/icon_union_store.webp", + ), + ), + ), + ); + } Widget buildStoreItem(Store store, position) { return Container( diff --git a/lib/union/union_select_city.dart b/lib/union/union_select_city.dart new file mode 100644 index 00000000..ad582e09 --- /dev/null +++ b/lib/union/union_select_city.dart @@ -0,0 +1,415 @@ +import 'dart:convert'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; + +class UnionSelectCity extends StatefulWidget { + @override + State createState() { + return _UnionSelectCity(); + } +} + +class _UnionSelectCity extends State { + RefreshController refreshController = RefreshController(); + Map areaMap; + List areaList = []; + final TextEditingController editingController = TextEditingController(); + + @override + void initState() { + super.initState(); + areaCode(); + } + + void areaCode() async { + var value = + await rootBundle.loadString('assets/map_style/chinese_cities.json'); + areaMap = jsonDecode(value); + areaMap.forEach((key, value) { + areaList.add(key); + }); + setState(() {}); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: Color(0xFFF0F0F0), + body: Container( + color: Color(0xFFF0F0F0), + child: Column( + children: [ + Container( + color: Colors.white, + padding: EdgeInsets.only(left: 14.w, top: 44.h, bottom: 24.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context).pop(); + }, + child:Container( + padding: EdgeInsets.only(right:21.w), + child: Icon( + Icons.arrow_back_ios, + color: Colors.black, + ), + )), + Expanded(child: searchCityItem()) + ], + ), + Padding(padding:EdgeInsets.only(top: 16.h,bottom: 24.h), + child:Row( + children: [ + Padding(padding:EdgeInsets.only(right: 10.w), + child: Text( + "当前位置", + style: TextStyle( + color: Color(0xFFA29E9E), + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + ), + ),), + Image.asset( + "assets/image/icon_union_location.webp", + width:20, + height:20, + ), + Padding(padding:EdgeInsets.only(left:8.w,), + child: Text( + "当前位置", + style: TextStyle( + color: Color(0xFF4D4D4D), + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + ), + ),), + ], + )), + Padding(padding:EdgeInsets.only(bottom: 16.h), + child: Text( + "热门城市", + style: TextStyle( + color: Color(0xFFA29E9E), + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + ), + ),), + Padding(padding:EdgeInsets.only(right: 14.h,bottom: 14.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pop("上海");}, + child: Container( + decoration: BoxDecoration( + color: Color(0xFFF7F7F7), + borderRadius: BorderRadius.circular(4), + ), + padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), + child: Text( + "上海", + style: TextStyle( + color: Color(0xFF4D4D4D), + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + ), + ) + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pop("深圳");}, + child: Container( + decoration: BoxDecoration( + color: Color(0xFFF7F7F7), + borderRadius: BorderRadius.circular(4), + ), + padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), + child: Text( + "深圳", + style: TextStyle( + color: Color(0xFF4D4D4D), + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + ), + ) + )), GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pop("北京");}, + child: Container( + decoration: BoxDecoration( + color: Color(0xFFF7F7F7), + borderRadius: BorderRadius.circular(4), + ), + padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), + child: Text( + "北京", + style: TextStyle( + color: Color(0xFF4D4D4D), + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + ), + ) + )), GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pop("广州");}, + child: Container( + decoration: BoxDecoration( + color: Color(0xFFF7F7F7), + borderRadius: BorderRadius.circular(4), + ), + padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), + child: Text( + "广州", + style: TextStyle( + color: Color(0xFF4D4D4D), + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + ), + ) + )), + ], + ),), + Padding(padding:EdgeInsets.only(right: 14.h,), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pop("成都");}, + child: Container( + decoration: BoxDecoration( + color: Color(0xFFF7F7F7), + borderRadius: BorderRadius.circular(4), + ), + padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), + child: Text( + "成都", + style: TextStyle( + color: Color(0xFF4D4D4D), + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + ), + ) + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pop("杭州");}, + child: Container( + decoration: BoxDecoration( + color: Color(0xFFF7F7F7), + borderRadius: BorderRadius.circular(4), + ), + padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), + child: Text( + "杭州", + style: TextStyle( + color: Color(0xFF4D4D4D), + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + ), + ) + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pop("南京");}, + child: Container( + decoration: BoxDecoration( + color: Color(0xFFF7F7F7), + borderRadius: BorderRadius.circular(4), + ), + padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), + child: Text( + "南京", + style: TextStyle( + color: Color(0xFF4D4D4D), + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + ), + ) + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pop("重庆");}, + child: Container( + decoration: BoxDecoration( + color: Color(0xFFF7F7F7), + borderRadius: BorderRadius.circular(4), + ), + padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), + child: Text( + "重庆", + style: TextStyle( + color: Color(0xFF4D4D4D), + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + ), + ) + ), + ), + ], + ),) + ], + ), + ), + Expanded(child: sortList()) + ], + ), + ), + ); + } + + Widget searchCityItem() { + return Container( + height: 36.h, + margin: EdgeInsets.fromLTRB(6.w, 0, 14.w, 0), + padding: EdgeInsets.fromLTRB(0, 6.h, 0, 0), + decoration: BoxDecoration( + color: Color(0xFFF1F1F1), + borderRadius: BorderRadius.circular(6), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: TextField( + textInputAction: TextInputAction.search, + onEditingComplete: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + controller: editingController, + cursorHeight: 25.h, + decoration: InputDecoration( + // contentPadding: EdgeInsets.symmetric( + // vertical: 12.h, + // ), + hintText: "输入城市名进行搜索", + hintStyle: TextStyle( + fontSize: 12.sp, + color: Color(0xFFB3B3B3), + ), + prefixIcon: InkWell( + onTap: () {}, + child:Image.asset( + "assets/image/icon_search.webp", + width: 16, + height: 16, + ), + ), + border: InputBorder.none, + ), + ), + ); + } + + Widget sortList() { + return ListView.builder( + padding: EdgeInsets.zero, + itemCount: areaList.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () {}, + child: sortItem(position), + ); + }, + ); + } + + Widget sortItem(int position) { + return Column( + children: [ + Container( + width: double.infinity, + // color: Colors.white, + padding: EdgeInsets.only(top: 14.h, bottom: 4.h, left: 16.w), + margin: EdgeInsets.only(bottom: 12.h), + child: Text( + areaList[position], + style: TextStyle( + color: Color(0xFF4D4D4D), + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + ), + ), + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.w), + color: Colors.white, + ), + margin: EdgeInsets.symmetric(horizontal: 14.w), + padding: EdgeInsets.only( + top: 8.h, + ), + child: Column( + children: (areaMap[areaList[position]] as List).map((e) { + return globalRoamingItem(e); + }).toList(), + ), + ) + ], + ); + } + + Widget globalRoamingItem(data) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context).pop(data["area"]); + }, + child: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(left: 12.w), + child: Text( + data["area"], + style: TextStyle( + color: Color(0xFF000000), + fontWeight: MyFontWeight.regular, + fontSize: 14.sp, + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(vertical: 16.h), + width: double.infinity, + height: 1.h, + color: Color(0xFFDCDCDC), + ) + ], + ), + ), + ); + } +} From b63d5b53a0e8b45cf85161ea5a784891e42382e4 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Wed, 16 Aug 2023 16:04:06 +0800 Subject: [PATCH 08/35] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A192.168.10.15?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/retrofit/min_api.dart | 2 +- lib/retrofit/retrofit_api.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 286a292b..ac89ea53 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -26,7 +26,7 @@ import 'data/shopping_home_config.dart'; part 'min_api.g.dart'; -const localBaseUrl = "http://192.168.10.78:8765/app/";///本地 +const localBaseUrl = "http://192.168.10.15:8765/app/";///本地 // const localBaseUrl = "http://pos-test.api.lotus-wallet.com/app/";///测试 const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线上 diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 4beff7f6..ccf4ac1c 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -66,7 +66,7 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -const localBaseUrl = "http://192.168.10.78:8766/app/";///本地 +const localBaseUrl = "http://192.168.10.15:8766/app/";///本地 // const localBaseUrl = "http://platform.test.api.lotus-wallet.com/app/";///测试 const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线上 From 9043354373a2ac6efe9da3cb8c03c5a547a1755c Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Wed, 16 Aug 2023 17:58:16 +0800 Subject: [PATCH 09/35] =?UTF-8?q?=E7=BB=93=E7=AE=97=E9=A1=B5=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=94=AF=E4=BB=98=E6=96=B9=E5=BC=8F=E9=97=B4=E9=9A=94?= =?UTF-8?q?=E8=BF=87=E5=A4=A7=EF=BC=8C=E6=9B=B4=E6=94=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/settlement/settlement_view/pay_method.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/settlement/settlement_view/pay_method.dart b/lib/settlement/settlement_view/pay_method.dart index a97f1bb5..dac2da36 100644 --- a/lib/settlement/settlement_view/pay_method.dart +++ b/lib/settlement/settlement_view/pay_method.dart @@ -287,9 +287,7 @@ class _PayMethod extends State { ), ), if(mRaiseMoney !="0" && (widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false))) - SizedBox( - height: 10, - ), + if(widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false)) GestureDetector( behavior: HitTestBehavior.opaque, From b82d328bb294b0de589402d950f1eca19d9da3c4 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Sat, 19 Aug 2023 17:14:53 +0800 Subject: [PATCH 10/35] =?UTF-8?q?=E8=81=94=E7=9B=9F=E6=9D=BF=E5=9D=97?= =?UTF-8?q?=E6=96=B0ui=E6=9B=B4=E6=94=B9=E5=AE=8C=E6=88=90=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/map_style/chinese_cities.json | 2 +- lib/main.dart | 2 +- lib/retrofit/data/ip_data.dart | 78 +++ lib/retrofit/retrofit_api.dart | 85 ++- lib/retrofit/retrofit_api.g.dart | 20 + lib/union/union_list.dart | 497 +++++--------- lib/union/union_page.dart | 942 +++++---------------------- lib/union/union_select_city.dart | 382 +++++------ 8 files changed, 657 insertions(+), 1351 deletions(-) create mode 100644 lib/retrofit/data/ip_data.dart diff --git a/assets/map_style/chinese_cities.json b/assets/map_style/chinese_cities.json index 0b6d32b6..e9742bde 100644 --- a/assets/map_style/chinese_cities.json +++ b/assets/map_style/chinese_cities.json @@ -6,7 +6,7 @@ {"area": "广州"}, {"area": "成都"}, {"area": "杭州"}, - {"area": "南京"}, + {"area": "武汉"}, {"area": "重庆"} ], "A": [ diff --git a/lib/main.dart b/lib/main.dart index bbacd5b8..c28d609f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -442,5 +442,5 @@ Map routers = { '/router/trading_card_page': (context, {arguments}) => TradingCardPage(), '/router/union_select_city': (context, {arguments}) => - UnionSelectCity(), + UnionSelectCity(arguments:arguments), }; diff --git a/lib/retrofit/data/ip_data.dart b/lib/retrofit/data/ip_data.dart new file mode 100644 index 00000000..c0ff1f3c --- /dev/null +++ b/lib/retrofit/data/ip_data.dart @@ -0,0 +1,78 @@ +/// code : 200 +/// msg : "success" +/// ip : "27.17.85.129" +/// country : "中国" +/// province : "湖北" +/// city : "武汉市" +/// isp : "电信" + +class IpData { + IpData({ + num code, + String msg, + String ip, + String country, + String province, + String city, + String isp,}){ + _code = code; + _msg = msg; + _ip = ip; + _country = country; + _province = province; + _city = city; + _isp = isp; +} + + IpData.fromJson(dynamic json) { + _code = json['code']; + _msg = json['msg']; + _ip = json['ip']; + _country = json['country']; + _province = json['province']; + _city = json['city']; + _isp = json['isp']; + } + num _code; + String _msg; + String _ip; + String _country; + String _province; + String _city; + String _isp; +IpData copyWith({ num code, + String msg, + String ip, + String country, + String province, + String city, + String isp, +}) => IpData( code: code ?? _code, + msg: msg ?? _msg, + ip: ip ?? _ip, + country: country ?? _country, + province: province ?? _province, + city: city ?? _city, + isp: isp ?? _isp, +); + num get code => _code; + String get msg => _msg; + String get ip => _ip; + String get country => _country; + String get province => _province; + String get city => _city; + String get isp => _isp; + + Map toJson() { + final map = {}; + map['code'] = _code; + map['msg'] = _msg; + map['ip'] = _ip; + map['country'] = _country; + map['province'] = _province; + map['city'] = _city; + map['isp'] = _isp; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index ccf4ac1c..6fbd44d8 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -41,6 +41,7 @@ import 'data/headlines_list.dart'; import 'data/headlines_list_details.dart'; import 'data/home_rank.dart'; import 'data/invitation_list.dart'; +import 'data/ip_data.dart'; import 'data/logistics.dart'; import 'data/member_Infor.dart'; import 'data/member_comment_list.dart'; @@ -66,9 +67,17 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -const localBaseUrl = "http://192.168.10.15:8766/app/";///本地 +const localBaseUrl = "http://platform-api.test.yixinhuixiang.com/app/"; + +///本地 // const localBaseUrl = "http://platform.test.api.lotus-wallet.com/app/";///测试 -const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线上 +const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/"; + +///线上 + +const ipBaseUrl = "https://api.ooomn.com"; + +///ip @RestApi(baseUrl: localBaseUrl) abstract class ApiService { @@ -78,6 +87,7 @@ abstract class ApiService { BuildContext context, String token, bool showLoading = false, + bool isIp = false, bool pay = true, }) { Map headers = @@ -85,6 +95,7 @@ abstract class ApiService { if (pay) { headers["Environment"] = "app"; } + if (isIp) baseUrl = ipBaseUrl; dio.options = BaseOptions( connectTimeout: 60000, receiveTimeout: 60000, @@ -113,14 +124,16 @@ abstract class ApiService { EasyLoading.dismiss(); } debugPrint("code = ${response.statusCode}"); - p(jsonEncode(response.data)); + + if (response.request.path != "/creditGoods/list") + p(jsonEncode(response.data)); // debugPrint(jsonEncode(response.data), wrapWidth: response.data.toString().length * 10); Map map = response.data; - if (map["code"] != 0) { - EasyLoading.dismiss(); - } + // if (map["code"] != 0) { + // EasyLoading.dismiss(); + // } if (map["code"] == 40005 || map["code"] == 40001) { if (!LoginTipsDialog().isShow) { print("show: ${LoginTipsDialog().isShow}"); @@ -166,11 +179,12 @@ abstract class ApiService { ///文件上传 @POST("/file/upload") @MultiPart() - Future> upload( - @Part(name: "file") File data, @Part(name: "folderId") int folderId,bool isVideo); + Future> upload(@Part(name: "file") File data, + @Part(name: "folderId") int folderId, bool isVideo); /// 周边搜索 - @GET("https://restapi.amap.com/v3/place/around?key=542b46afa8e4b88fe1eb3c4d0ba0872f&location={lat},{lng}&keywords={keywords}&offset={size}&page={page}&extensions=all") + @GET( + "https://restapi.amap.com/v3/place/around?key=542b46afa8e4b88fe1eb3c4d0ba0872f&location={lat},{lng}&keywords={keywords}&offset={size}&page={page}&extensions=all") Future searchPoi(@Path("lat") String lat, @Path("lng") String lng, @Path("keywords") String keywords, int size, int page); @@ -184,7 +198,8 @@ abstract class ApiService { ///发送验证码 @GET("/auth/sendVerify/{areaCode}/{mobile}") - Future sendVerify(@Path("areaCode") String areaCode, @Path("mobile") String mobile); + Future sendVerify( + @Path("areaCode") String areaCode, @Path("mobile") String mobile); ///积分商城商品列表 @POST("/creditGoods/list") @@ -298,11 +313,13 @@ abstract class ApiService { ///分页查看资讯列表 @POST("/information/list") - Future>> queryArticle(@Body() Map param); + Future>> queryArticle( + @Body() Map param); ///banner查询 @POST("/banner/page") - Future>> queryBanner(@Body() Map param); + Future>> queryBanner( + @Body() Map param); ///品牌信息 @GET("/home/brand") @@ -404,11 +421,13 @@ abstract class ApiService { /// 动态列表 @POST("/information/trend-list") - Future>> trendList(@Body() Map map); + Future>> trendList( + @Body() Map map); /// 我关注/粉丝的会员列表 @POST("/member/follow/list") - Future>> followList(@Body() Map map); + Future>> followList( + @Body() Map map); ///关注/取关会员 @PUT("/member/follow/{followId}") @@ -428,11 +447,13 @@ abstract class ApiService { ///课程章节列表 @GET("/course/catalogList/{courseId}") - Future>> catalogList(@Path("courseId") String courseId); + Future>> catalogList( + @Path("courseId") String courseId); /// 课程列表 @POST("/course/list") - Future>> courseList(@Body() Map map); + Future>> courseList( + @Body() Map map); ///课程的合集列表 @GET("/course/collectList") @@ -440,7 +461,8 @@ abstract class ApiService { ///合集包含的课程列表 @GET("/course/collect/{collectId}") - Future>> collect(@Path("collectId") String collectId); + Future>> collect( + @Path("collectId") String collectId); ///课程详情 @GET("/course/{id}") @@ -452,15 +474,18 @@ abstract class ApiService { /// APP查询所有成就徽章 并显示会员完成的 @POST("/app-memberAchievement/findBadges") - Future>> findBadges(@Body() Map map); + Future>> findBadges( + @Body() Map map); ///查看一个成就大类详情 - @GET("/app-memberAchievement/getAchievementDetail?achievementCategoryId={achievementCategoryId}") - Future>> getAchievementDetail(@Path("achievementCategoryId") String achievementCategoryId); + @GET( + "/app-memberAchievement/getAchievementDetail?achievementCategoryId={achievementCategoryId}") + Future>> getAchievementDetail( + @Path("achievementCategoryId") String achievementCategoryId); ///会员的权益列表 - @GET("/member/benefitList") - Future>> benefitList(); + @GET("/member/benefitList") + Future>> benefitList(); ///会员权益 @GET("/home/vipBenefit") @@ -480,7 +505,8 @@ abstract class ApiService { ///查看积分订单物流 @GET("/creditOrder/getAppShippingTrace?orderId={orderId}") - Future> getAppShippingTrace(@Path("orderId") String orderId); + Future> getAppShippingTrace( + @Path("orderId") String orderId); ///购买会员等级 @POST("/member/rankBuy") @@ -492,11 +518,13 @@ abstract class ApiService { ///文章合集详情 @GET("/information/category/{id}") - Future> headlinesDetails(@Path("id") String id); + Future> headlinesDetails( + @Path("id") String id); /// 我的邀请会员列表 @POST("/member/inviteMemberList") - Future>> inviteMemberList(@Body() Map map); + Future>> inviteMemberList( + @Body() Map map); ///核销优惠券 @GET("/coupon/wiped/{memberCouponId}") @@ -564,5 +592,10 @@ abstract class ApiService { ///兑换积分门店列表 @GET("/store/storeListByCreditId/{creditGoodsId}") - Future>> storeListByCreditId(@Path("creditGoodsId") String creditGoodsId); + Future>> storeListByCreditId( + @Path("creditGoodsId") String creditGoodsId); + + ///获取APP门店推广渠道 + @GET("/api/ip") + Future getIpInfo(); } diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 4f03eb6d..32506277 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -2109,6 +2109,26 @@ class _ApiService implements ApiService { return value; } + @override + Future getIpInfo() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/api/ip', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = IpData.fromJson( + _result.data, + ); + return value; + } + @override Future> orderVip(param) async { ArgumentError.checkNotNull(param, 'param'); diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index 1137804f..b00e8b0b 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -1,28 +1,32 @@ +import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/store.dart'; import 'package:huixiang/utils/font_weight.dart'; -import 'package:huixiang/view_widget/border_text.dart'; -import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:flutter_screenutil/flutter_screenutil.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'; import 'package:shimmer/shimmer.dart'; +import '../retrofit/data/base_data.dart'; +import '../retrofit/retrofit_api.dart'; +import '../utils/flutter_utils.dart'; +import '../view_widget/classic_header.dart'; import '../view_widget/no_data_view.dart'; class UnionList extends StatefulWidget { - final RefreshController refreshController; - final List storeList; - final Function onRefresh; - final Function queryStore; - - UnionList(this.refreshController,this.storeList,this.onRefresh,this.queryStore); + final String serviceType; + final BMFCoordinate latLng; + final String searchKey; + final String city; + UnionList(Key key, this.serviceType, this.latLng, this.searchKey, this.city) + : super(key: key); @override State createState() { @@ -30,89 +34,105 @@ class UnionList extends StatefulWidget { } } -class _UnionList extends State { - final TextEditingController editingController = TextEditingController(); +class _UnionList extends State with AutomaticKeepAliveClientMixin { + ApiService apiService; + List storeList; + final RefreshController _refreshController = RefreshController(); + + @override + bool get wantKeepAlive => true; + + @override + void initState() { + super.initState(); + queryStore(); + } + + queryStore() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = await apiService.queryStore({ + "city": widget.city ?? "", + // "district": district, + // "province": province, + "latitude": (widget.latLng?.latitude ?? "").toString(), + "longitude": (widget.latLng?.longitude ?? "").toString(), + if (widget.searchKey != "") "searchKey": widget.searchKey, + "serviceType": widget.serviceType, + "exchange": false, + }).catchError((error) { + SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), + alignment: Alignment.center); + }); + if (baseData != null && baseData.isSuccess) { + storeList = baseData.data; + } + _refreshController.refreshCompleted(); + EasyLoading.dismiss(); + setState(() {}); + } @override Widget build(BuildContext context) { - return Column( - children: [ - // buildSearchItem(), - Container( - height: MediaQuery.of(context).size.height - - 103.h - - MediaQuery.of(context).padding.top, - child: SmartRefresher( - controller: widget.refreshController, - enablePullUp: false, - enablePullDown: true, - physics: BouncingScrollPhysics(), - header: MyHeader(), - onRefresh: widget.onRefresh, - child: (widget.storeList == null || widget.storeList.length == 0) - ? NoDataView( - src:"assets/image/di_zhi.webp", - isShowBtn: false, - text: "暂无店铺列表~", - fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h), - ):ListView.builder( - itemCount:widget.storeList == null ? 0 : widget.storeList.length, - padding: EdgeInsets.only( - top: 8.h, - bottom: 100.h, /* + (375.h - 88.h) + 4.h*/ - ), - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, position) { - return InkWell( - onTap: () { - // if (widget.storeList[position].posType.code == "NORMALSTORE") { - // showDeleteDialog(); - // } - // else - // if ( widget.storeList[position].storeName == "一心回乡商城") { - // Navigator.of(context).pushNamed( - // '/router/shopping_mall_home', - // arguments: { - // "type": 0, - // "id": widget.storeList[position].id, - // "tenant": widget.storeList[position].tenantCode, - // "storeName": widget.storeList[position].storeName - // }, - // ); - // } - // else - { - Navigator.of(context).pushNamed( - '/router/store_order', - arguments: { - "id": widget.storeList[position].id, - "tenant": widget.storeList[position].tenantCode, - "storeName": widget.storeList[position].storeName, - "distance":widget.storeList[position].distance - }, - ); - } - }, - child: - buildStoreItem(widget.storeList[position], position), - ); - })), - ) - ], + return SmartRefresher( + controller: _refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(color: Colors.white,), + physics: BouncingScrollPhysics(), + onRefresh: queryStore, + child: (storeList == null || storeList.length == 0) + ? NoDataView( + src: "assets/image/di_zhi.webp", + isShowBtn: false, + text: "暂无店铺列表~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ) + : ListView.builder( + itemCount: storeList.length, + padding: EdgeInsets.only( + top: 8.h, + bottom: 100.h, + ), + itemBuilder: (context, position) { + return InkWell( + onTap: () { + { + Navigator.of(context).pushNamed( + '/router/store_order', + arguments: { + "id": storeList[position].id, + "tenant": storeList[position].tenantCode, + "storeName": storeList[position].storeName, + "distance": storeList[position].distance + }, + ); + } + }, + child: buildStoreItem(storeList[position], position), + ); + }, + ), ); } - Widget sm(){ + Widget sm() { return Container( - margin:EdgeInsets.symmetric(horizontal: 14.w,vertical: 8.h), + margin: EdgeInsets.symmetric(horizontal: 14.w, vertical: 8.h), width: double.infinity, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(6), ), height: 223.h, - child:Column( + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Shimmer.fromColors( @@ -124,19 +144,25 @@ class _UnionList extends State { height: 140.h, ), ), - Padding(padding: EdgeInsets.only(left: 6.w,bottom: 5.h,top: 12.h), - child: Shimmer.fromColors( - baseColor: Color(0XFFD8D8D8), - highlightColor: Color(0XFFD8D8D8), - child: Container( - decoration: BoxDecoration( - color: Color(0XFFD8D8D8), - borderRadius: BorderRadius.circular(2), + Padding( + padding: EdgeInsets.only(left: 6.w, bottom: 5.h, top: 12.h), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 108.w, + height: 20.h, ), - width: 108.w, - height: 20.h, ), - ),),Padding(padding: EdgeInsets.only(left: 6.w,), + ), + Padding( + padding: EdgeInsets.only( + left: 6.w, + ), child: Shimmer.fromColors( baseColor: Color(0XFFD8D8D8), highlightColor: Color(0XFFD8D8D8), @@ -148,63 +174,9 @@ class _UnionList extends State { width: 260.w, height: 20.h, ), - ),), - ], - ), - ); - } - - Widget buildSearchItem() { - return Container( - height: 36.h, - margin: EdgeInsets.fromLTRB(6.w, 0, 14.w, 0), - padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), - decoration: BoxDecoration( - color: Color(0xFFF5FAF7), - borderRadius: BorderRadius.circular(4), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ), - ], - ), - child: TextField( - textInputAction: TextInputAction.search, - onEditingComplete: () { - FocusScope.of(context).requestFocus(FocusNode()); - widget.queryStore(editingController.text); - }, - controller: editingController, - cursorHeight: 25.h, - decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric( - vertical: 12.h, - ), - prefixIcon:InkWell( - onTap: () { - widget.queryStore(editingController.text); - }, - child: Icon( - Icons.search, - size: 24, - color: Colors.black, - ), - ), - suffixIcon: InkWell( - onTap: () { - editingController.clear(); - }, - child: Icon( - Icons.close, - size: 19, - color: Colors.grey, ), ), - border: InputBorder.none, - ), + ], ), ); } @@ -275,62 +247,65 @@ class _UnionList extends State { ), Expanded( child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 40.h, - ), - Text( - store?.storeName ?? "", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFF0D0D0D), - fontSize: 14.sp, - fontWeight: MyFontWeight.bold, - ), + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 40.h, + ), + Text( + store?.storeName ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 14.sp, + fontWeight: MyFontWeight.bold, + ), + ), + SizedBox( + height: 5.h, + ), + Expanded( + child: Text( + "${S.of(context).dizhi}:${store.address}", + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF4D4D4D), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, ), - SizedBox( - height: 5.h, + ), + ) + ], + )), + if (store.distance != null) + Container( + width: 59.w, + height: 18.h, + alignment: Alignment.center, + margin: EdgeInsets.only(top: 20.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + color: Color(0xFF32A060), + ), + child: Visibility( + child: Text( + (store.distance ?? 0) > 1000 + ? S.of(context).gongli( + ((store.distance ?? 0) / 1000 * 100).toInt() / + 100.0) + : S.of(context).mi( + ((store.distance ?? 0) * 100).toInt() / + 100.0), + style: TextStyle( + color: Color(0xFFFFFFFF), + fontSize: 10.sp, ), - Expanded(child: Text( - "${S.of(context).dizhi}:${store.address}", - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFF4D4D4D), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), - ),) - ], - )), - if(store.distance != null) - Container( - width: 59.w, - height: 18.h, - alignment: Alignment.center, - margin: EdgeInsets.only(top: 20.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2), - color: Color(0xFF32A060), - ), - child: Visibility( - child: Text( - (store.distance ?? 0) > 1000 - ? S.of(context).gongli( - ((store.distance ?? 0) / 1000 * 100).toInt() / - 100.0) - : S.of(context).mi( - ((store.distance ?? 0) * 100).toInt() / 100.0), - style: TextStyle( - color: Color(0xFFFFFFFF), - fontSize: 10.sp, ), + visible: store.distance != null, ), - visible: store.distance != null, ), - ), ], ), ), @@ -339,130 +314,4 @@ class _UnionList extends State { ), ); } - - ///扫码提示弹窗 - showDeleteDialog() { - showDialog( - context: context, - builder: (context) { - return AlertDialog( - content: Container( - width: MediaQuery.of(context).size.width - 84.w, - 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: () { - toScan(); - Navigator.of(context).pop(); - }, - ), - flex: 1, - ), - ], - ) - ], - ), - ), - ); - }, - ); - } - - ///扫码 - toScan() async { - if (await Permission.camera.isPermanentlyDenied) { - showCupertinoDialog( - context: context, - builder: (context) { - return RequestPermission( - "assets/image/icon_camera_permission_tips.webp", - S.of(context).ninxiangjiquanxianweikaiqi, - S.of(context).weilekaipaizhaoxuanzhetouxiang, - S.of(context).kaiqiquanxian, - (result) async { - if (result) { - await openAppSettings(); - } - }, - heightRatioWithWidth: 0.82, - ); - }); - } else if (await Permission.camera.isGranted) { - // http://pos.app.gznl.top/placeorder/?tableId=1315903669597634560&tenantCode=1166&shopId=1300372027722432512 - // 新版桌子码跳转 - // http://miniscan.lotus-wallet.com/placeorder?tenant_code=1194&table_id=1669609340031467520&store_id=1637659387134738432 - var result = await Navigator.of(context).pushNamed('/router/qr_scan'); - // String result = await scanner.scan(); - Uri uri = Uri.parse(result); - String tableId = uri.queryParameters["tableId"] ?? uri.queryParameters["table_id"]; - String tenantCode = uri.queryParameters["tenantCode"] ?? uri.queryParameters["tenant_code"]; - String shopId = uri.queryParameters["shopId"] ?? uri.queryParameters["store_id"]; - if (tableId != null && - tableId != "" && - tenantCode != null && - tenantCode != "" && - shopId != null && - shopId != "") { - Navigator.of(context).pushNamed( - '/router/store_order', - arguments: { - "id": shopId, - "tenant": tenantCode, - "storeName": "", - "tableId": int.tryParse(tableId), - }, - ); - } - } else { - await Permission.camera.request(); - } - } - } diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 96214aac..5d80f3cb 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -4,36 +4,23 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart'; import 'package:flutter_bmflocation/flutter_bmflocation.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/main.dart'; -import 'package:huixiang/retrofit/data/base_data.dart'; -import 'package:huixiang/retrofit/data/store.dart'; +import 'package:huixiang/retrofit/data/ip_data.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/union/union_list.dart'; import 'package:huixiang/utils/event_type.dart'; -import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/location.dart'; -import 'package:huixiang/view_widget/border_text.dart'; -import 'package:huixiang/view_widget/classic_header.dart'; -import 'package:huixiang/view_widget/custom_image.dart'; -import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_tab.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'; import 'package:flutter/rendering.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; -import '../utils/flutter_utils.dart'; -import '../view_widget/item_title.dart'; +import '../view_widget/no_data_view.dart'; class UnionPage extends StatefulWidget { final int initialIndex; @@ -51,19 +38,12 @@ class UnionPageState extends State AutomaticKeepAliveClientMixin, WidgetsBindingObserver, SingleTickerProviderStateMixin { - final RefreshController refreshController = - RefreshController(initialRefresh: false); - final RefreshController refreshController1 = - RefreshController(initialRefresh: false); - final RefreshController refreshController2 = - RefreshController(initialRefresh: false); - final RefreshController refreshController3 = - RefreshController(initialRefresh: false); - ApiService apiService; + final TextEditingController editingController = TextEditingController(); bool isKeyBoardShow = false; + TabController tabController; BMFCoordinate latLng; - final TextEditingController editingController = TextEditingController(); - String areaName = ""; + String areaName; + List _allKey = []; jumpIndex(jpIndex) { tabController.index = jpIndex; @@ -76,11 +56,6 @@ class UnionPageState extends State if (Location.getInstance() != null && Location.getInstance().aMapFlutterLocation != null) Location.getInstance().aMapFlutterLocation.stopLocation(); - - if (refreshController != null) refreshController.dispose(); - if (refreshController1 != null) refreshController1.dispose(); - if (refreshController2 != null) refreshController2.dispose(); - if (refreshController3 != null) refreshController3.dispose(); } @override @@ -105,78 +80,36 @@ class UnionPageState extends State @override void initState() { super.initState(); - if (tabController == null) - tabController = TabController( - length: 4, vsync: this, initialIndex: widget.initialIndex); - // tabController?.addListener(() { - // startLocation(); - // }); + tabController = TabController( + length: 4, vsync: this, initialIndex: widget.initialIndex); WidgetsBinding.instance.addObserver(this); - eventBus.on().listen((event) { if (event.type < 3) { setState(() {}); } }); - - getLatLng(); - startLocation(false); - } - - RefreshController tabRefresh() { - RefreshController tempRef; - if (tabController.index == 0) - tempRef = refreshController; - else if (tabController.index == 1) - tempRef = refreshController1; - else if (tabController.index == 2) - tempRef = refreshController2; - else if (tabController.index == 3) tempRef = refreshController3; - return tempRef; + queryIpInfo(); } - startLocation(bool isOnRefresh) async { - if (!isOnRefresh) EasyLoading.show(status: S.current.zhengzaijiazai); - Location.getInstance().startLocation(context, (BaiduLocation result) { + startLocation() async { + Location.getInstance().startLocation(context, (BaiduLocation result) async { if (result != null && result.latitude != null && result.longitude != null) { print("location: $result"); latLng = BMFCoordinate(result.latitude, result.longitude); - BMFCalculateUtils.coordConvert( + latLng = await BMFCalculateUtils.coordConvert( coordinate: latLng, fromType: BMF_COORD_TYPE.BD09LL, - toType: BMF_COORD_TYPE.COMMON) - .then((value) { - this.latLng = value; - saveLatLng( - value, result.province, result.city, result.district); - print("union: Location result ${value.latitude} " - "${value.longitude}"); - Location.getInstance().stopLocation(); - queryStore( - "${value.latitude}", - "${value.longitude}", - result.province, - result.city, - result.district, - "", - -1); - if (_mapController != null) - _mapController.updateMapOptions(BMFMapOptions( - center: value, - zoomLevel: 15, - )); - }); + toType: BMF_COORD_TYPE.COMMON); + await saveLatLng(latLng, result.province, result.city, result.district); + print("union: Location result ${latLng.latitude} " + "${latLng.longitude}"); + Location.getInstance().stopLocation(); } else { - getLatLng(); - // EasyLoading.dismiss(); - } - }).then((value) { - if (!value) { - EasyLoading.dismiss(); - tabRefresh().refreshCompleted(); + await getLatLng(); } + loadFinish(showLoading: false); }); } @@ -190,400 +123,163 @@ class UnionPageState extends State } getLatLng() async { - SharedPreferences.getInstance().then( - (value) => { - // apiService = ApiService(Dio(), - // context: context, - // token: value.getString('token'), - // showLoading: false), - if (value.containsKey("latitude") && - value.containsKey("longitude") && - value.containsKey("province") && - value.containsKey("city") && - value.containsKey("district")) - { - latLng = BMFCoordinate(double.tryParse(value.getString("latitude")), - double.tryParse(value.getString("longitude"))), - queryStore( - value.getString("latitude"), - value.getString("longitude"), - value.getString("province"), - value.getString("city"), - value.getString("district"), - "", - -1), - setState(() { - if (_mapController != null) { - _mapController.updateMapOptions(BMFMapOptions( - center: latLng, - zoomLevel: 15, - )); - } - }) - } - else - { - queryStore("", "", "", "", "", "", -1), - } - }, - ); + var tempLatLng = await SharedPreferences.getInstance(); + if (tempLatLng.containsKey("latitude") && + tempLatLng.containsKey("longitude") && + tempLatLng.containsKey("province") && + tempLatLng.containsKey("city") && + tempLatLng.containsKey("district")) { + latLng = BMFCoordinate(double.tryParse(tempLatLng.getString("latitude")), + double.tryParse(tempLatLng.getString("longitude"))); + } } - List storeList; - List storeList1; - List storeList2; - List storeList3; - - queryStore(latitude, longitude, province, city, district, searchKey, - int index) async { - if (apiService == null) { - SharedPreferences value = await SharedPreferences.getInstance(); - apiService = ApiService( - Dio(), - context: context, - token: value.getString("token"), - ); + queryIpInfo() async { + EasyLoading.show(status: S.current.zhengzaijiazai); + ApiService apiIpService = ApiService(Dio(), context: context, isIp: true); + IpData baseData = await apiIpService.getIpInfo().catchError((onError) {}); + if (baseData != null) { + areaName = baseData.city.replaceAll("市", ""); } - BaseData> baseData = await apiService.queryStore({ - "city": city, - // "district": district, - // "province": province, - "latitude": latitude, - "longitude": longitude, - if(searchKey != "") - "searchKey": searchKey, - "serviceType": (tabController.index == 0 && index == -1) || index == 0 - ? "" - : ((tabController.index == 1 && index == -1) || index == 1 - ? "EATSTORE" - : ((tabController.index == 2 && index == -1) || index == 2 - ? "DRINKSTORE" - : "HAPPYSTORE")), - "exchange":false, - }).catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); - if (index == -1) tabRefresh().refreshFailed(); - }); - if (baseData != null && baseData.isSuccess) { - if (index == -1 && storeList == null) { - if (tabController.index != 0) - queryStore( - latitude, longitude, province, city, district, searchKey, 0); - if (tabController.index != 1) - queryStore( - latitude, longitude, province, city, district, searchKey, 1); - if (tabController.index != 2) - queryStore( - latitude, longitude, province, city, district, searchKey, 2); - if (tabController.index != 3) - queryStore( - latitude, longitude, province, city, district, searchKey, 3); - } - if ((tabController.index == 0 && index == -1) || index == 0) - storeList = baseData.data; - else if ((tabController.index == 1 && index == -1) || index == 1) - storeList1 = baseData.data; - else if ((tabController.index == 2 && index == -1) || index == 2) - storeList2 = baseData.data; - else if ((tabController.index == 3 && index == -1) || index == 3) - storeList3 = baseData.data; - if (index == -1) tabRefresh().refreshCompleted(); - } else { - if (index == -1) tabRefresh().refreshFailed(); - } - EasyLoading.dismiss(); - setState(() {}); + startLocation(); } - TabController tabController; + loadFinish({bool showLoading = true}) { + if (showLoading) EasyLoading.show(status: S.current.zhengzaijiazai); + _allKey = [GlobalKey(), GlobalKey(), GlobalKey(), GlobalKey()]; + setState(() {}); + } @override Widget build(BuildContext context) { super.build(context); return GestureDetector( - behavior: HitTestBehavior.translucent, - onTap: () { - FocusScope.of(context).requestFocus(FocusNode()); - }, - child:Stack( + behavior: HitTestBehavior.translucent, + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: Container( + child: Column( children: [ - Container( - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage("assets/image/settlement_bg.webp"), + Row( + children: [ + Padding( + padding: EdgeInsets.only(left: 18.w, right: 10.w), + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context).pushNamed( + '/router/union_select_city', + arguments: {"cityName": areaName}).then((value) { + if (value != null) { + areaName = value; + loadFinish(); + } + }); + }, + child: Row( + children: [ + Text( + areaName ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.bold, + color: Colors.white), + ), + Icon( + Icons.keyboard_arrow_down, + color: Colors.white, + size: 24, + ) + ], + ), + ), ), - ), - width: double.infinity, - height: 306.h, + Expanded(child: buildSearchItem()) + ], ), - Scaffold( - backgroundColor: Colors.transparent, - resizeToAvoidBottomInset: false, - appBar: PreferredSize( - preferredSize: Size(double.infinity, 100.h), - child: MyAppBar( - background: Color(0xFF32A060), - title: "", - leading: false, - brightness: Brightness.light, - bottom: PreferredSize( - preferredSize: Size(double.infinity, 38.h), - child:Align( - alignment: Alignment.centerLeft, - child: Theme( - data: ThemeData( - splashColor: Colors.transparent, // 点击时的水波纹颜色设置为透明 - highlightColor: Colors.transparent, // 点击时的背景高亮颜色设置为透明 - ), - child: TabBar( - controller: tabController, - isScrollable: true, - //可滚动 - indicatorColor: Colors.white, - labelColor: Colors.white, - labelStyle: TextStyle( - fontSize: 18.sp, - fontWeight: FontWeight.bold, - ), - unselectedLabelStyle: TextStyle( - fontSize: 15.sp, - fontWeight: FontWeight.normal, - ), - // controller: tabController, - //未选中文字颜色 - unselectedLabelColor: Colors.white, - indicatorSize: TabBarIndicatorSize.label, - //指示器与文字等宽 - tabs: [ - MyTab(text: S.of(context).quanbu), - MyTab(text: S.of(context).chi), - MyTab(text: S.of(context).he), - MyTab(text: S.of(context).wan), - ], - )), - ), - ), - titleChild:Row(children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: (){ - Navigator.of(context) - .pushNamed('/router/union_select_city') - .then((value) { - if (value != null) - setState(() { - areaName = value; - }); - }); - }, - child: Row( - children: [ - Text( - areaName ?? "武汉", - overflow: TextOverflow.ellipsis, - maxLines:1, - style: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.bold, - color: Colors.white), - ), - Icon( - Icons.keyboard_arrow_down, - color: Colors.white, - size: 24, - ) - ], - ), - ), - SizedBox(width:10.w,), - Expanded(child:buildSearchItem()) - ],)), + Align( + alignment: Alignment.centerLeft, + child: TabBar( + controller: tabController, + isScrollable: true, + //可滚动 + indicatorColor: Colors.white, + labelColor: Colors.white, + labelStyle: TextStyle( + fontSize: 18.sp, + fontWeight: FontWeight.bold, + ), + unselectedLabelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.normal, + ), + //未选中文字颜色 + unselectedLabelColor: Colors.white, + indicatorSize: TabBarIndicatorSize.label, + //指示器与文字等宽 + tabs: [ + MyTab(text: S.of(context).quanbu), + MyTab(text: S.of(context).chi), + MyTab(text: S.of(context).he), + MyTab(text: S.of(context).wan), + ], ), - body: TabBarView( + ), + _allKey.isEmpty + ? NoDataView( + src: "assets/image/di_zhi.webp", + isShowBtn: false, + text: "暂无店铺列表~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ) + : Expanded( + child: TabBarView( controller: tabController, children: [ - UnionList(refreshController, storeList, () { - startLocation(true); - },(txt){ - queryStore("","","","","",txt,0); - }), - UnionList(refreshController1, storeList1, () { - startLocation(true); - },(txt){ - queryStore("","","","","",txt,0); - }), - UnionList(refreshController2, storeList2, () { - startLocation(true); - },(txt){ - queryStore("","","","","",txt,0); - }), - UnionList(refreshController3, storeList3, () { - startLocation(true); - },(txt){ - queryStore("","","","","",txt,0); - }), + UnionList(_allKey[0], "", latLng, + editingController.text, areaName), + UnionList(_allKey[1], "EATSTORE", latLng, + editingController.text, areaName), + UnionList(_allKey[2], "DRINKSTORE", latLng, + editingController.text, areaName), + UnionList(_allKey[3], "HAPPYSTORE", latLng, + editingController.text, areaName), ], ), - ), + ) ], - )); - // GestureDetector( - // onTap: () { - // FocusScope.of(context).requestFocus(FocusNode()); - // }, - // child: Scaffold( - // backgroundColor: Colors.white, - // resizeToAvoidBottomInset: false, - // appBar: MyAppBar( - // // titleChild: buildSearchItem(), - // title: "", - // leading: false, - // background: Colors.white, - // brightness: Brightness.light, - // ), - // body: Column( - // children: [ - // // Row( - // // mainAxisAlignment: MainAxisAlignment.start, - // // crossAxisAlignment: CrossAxisAlignment.end, - // // children: [ - // // Expanded(child:PreferredSize( - // // preferredSize: Size(double.infinity, 52.h), - // // child: Container( - // // padding: EdgeInsets.only(top:15.h), - // // color: Color(0xFFFAFAFA), - // // child: ItemTitle( - // // text: S.of(context).jingbilianmenghuiyuandian, - // // imgPath: "assets/image/icon_union_store.webp", - // // ), - // // ), - // // )), - // // GestureDetector( - // // onTap: (){ - // // setState(() { - // // var storeName = storeList.firstWhere((x)=>x.storeName == "一心回乡商城"); - // // if(storeName == null) - // // return; - // // Navigator.of(context).pushNamed( - // // '/router/shopping_mall_home', - // // arguments: { - // // "type":0, - // // "id":storeName.id, - // // "tenant": storeName.tenantCode, - // // "storeName":storeName.storeName - // // }, - // // ); - // // }); - // // }, - // // child:Container( - // // margin: EdgeInsets.only(right: 18), - // // height: 25.h, - // // width: 102.w, - // // color: Colors.white, - // // child:Row( - // // mainAxisAlignment: MainAxisAlignment.center, - // // crossAxisAlignment: CrossAxisAlignment.center, - // // children: [ - // // Text( - // // "一心回乡商城", - // // style: TextStyle( - // // fontSize: 12.sp, - // // fontWeight: MyFontWeight.regular, - // // color: Colors.black, - // // ), - // // ), - // // Icon( - // // Icons.keyboard_arrow_right, - // // size: 16, - // // ), - // // ], - // // ), - // // ), - // // ), - // // ], - // // ), - // buildItem() - // ], - // ), - // ), - // ); - } - - Widget buildItem( - RefreshController refreshController, - ) { - return Column( - children: [ - // buildSearchItem(), - Container( - height: MediaQuery.of(context).size.height - - 103.h - - MediaQuery.of(context).padding.top, - child: SmartRefresher( - controller: refreshController, - enablePullUp: false, - enablePullDown: true, - physics: BouncingScrollPhysics(), - header: MyHeader(), - onRefresh: () { - startLocation(false); - }, - child: ListView.builder( - itemCount: storeList == null ? 0 : storeList.length, - padding: EdgeInsets.only( - top: 8.h, - bottom: 84.h, /* + (375.h - 88.h) + 4.h*/ - ), - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, position) { - return InkWell( - onTap: () { - if (storeList[position].posType.code == "NORMALSTORE") { - showDeleteDialog(); - } else if (storeList[position].posType.code == - "RETAILSTORE" && - storeList[position].storeName == "一心回乡商城") { - Navigator.of(context).pushNamed( - '/router/shopping_mall_home', - arguments: { - "type": 0, - "id": storeList[position].id, - "tenant": storeList[position].tenantCode, - "storeName": storeList[position].storeName - }, - ); - } else { - Navigator.of(context).pushNamed( - '/router/store_order', - arguments: { - "id": storeList[position].id, - "tenant": storeList[position].tenantCode, - "storeName": storeList[position].storeName - }, - ); - } - }, - child: buildStoreItem(storeList[position], position), - ); - })), - ) - ], + ), + padding: + EdgeInsets.only(top: MediaQuery.of(context).padding.top + 17.h), + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color(0xFF32A060), + Color(0xFF32A060), + Colors.white, + Colors.white, + ], + stops: [ + 0, + 0.2, + 0.4, + 1 + ]), + ), + ), ); } - BMFMapController _mapController; - - void onMapCreated(BMFMapController controller) { - _mapController = controller; - } - Widget buildSearchItem() { return Container( height: 36.h, margin: EdgeInsets.fromLTRB(6.w, 0, 14.w, 0), - padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), decoration: BoxDecoration( color: Color(0xFFF5FAF7), borderRadius: BorderRadius.circular(4), @@ -600,23 +296,21 @@ class UnionPageState extends State textInputAction: TextInputAction.search, onEditingComplete: () { FocusScope.of(context).requestFocus(FocusNode()); - queryStore("","","","","",editingController.text,0); + loadFinish(); }, controller: editingController, cursorHeight: 25.h, decoration: InputDecoration( contentPadding: EdgeInsets.symmetric( - vertical: 12.h, + vertical: 14.h, ), hintText: "搜索联盟会员店", hintStyle: TextStyle( fontSize: 12.sp, color: Color(0xFFB3B3B3), ), - prefixIcon:InkWell( - onTap: () { - queryStore("","","","","",editingController.text,0); - }, + prefixIcon: GestureDetector( + onTap: loadFinish, child: Image.asset( "assets/image/icon_search.webp", width: 16, @@ -629,334 +323,6 @@ class UnionPageState extends State ); } - Widget buildSliverAppBar(BMFMapWidget map) { - return SliverAppBar( - // 滑上去时搜索隐藏 - // floating: true, - // snap: true, - pinned: true, - backgroundColor: Color(0xFFFAFAFA), - elevation: 0, - automaticallyImplyLeading: false, - title: Container( - height: 36.h, - margin: EdgeInsets.fromLTRB(16.w, 0, 16.w, 0), - padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(4)), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ]), - child: TextField( - textInputAction: TextInputAction.search, - onEditingComplete: () { - startLocation(false); - }, - controller: editingController, - cursorHeight: 30.h, - decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric(vertical: 12.h), - prefixIcon: Icon( - Icons.search, - size: 24, - color: Colors.black, - ), - suffixIcon: InkWell( - onTap: () { - editingController.clear(); - }, - child: Icon( - Icons.close, - size: 19, - color: Colors.grey, - ), - ), - border: InputBorder.none, - ), - ), - ), - flexibleSpace: FlexibleSpaceBar( - background: Container( - child: map, - ), - ), - expandedHeight: 375.h, - bottom: PreferredSize( - preferredSize: Size(double.infinity, 52.h), - child: Container( - padding: EdgeInsets.only(top: 6.h), - color: Color(0xFFFAFAFA), - child: ItemTitle( - text: S.of(context).jingbilianmenghuiyuandian, - imgPath: "assets/image/icon_union_store.webp", - ), - ), - ), - ); - } - - Widget buildStoreItem(Store store, position) { - return Container( - margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h), - // padding: EdgeInsets.fromLTRB(20.w, 20.h, 20.w, 20.h), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(8)), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(25), - offset: Offset(0, 1), - blurRadius: 12, - spreadRadius: 0, - ) - ]), - width: double.infinity, - height: 228.h, - child: Stack( - children: [ - Positioned( - top: 0, - left: 0, - right: 0, - child: ClipRRect( - child: MImage( - store.facade, - width: double.infinity, - height: 140.h, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.webp", - fadeSrc: "assets/image/default_1.webp", - ), - borderRadius: BorderRadius.vertical( - top: Radius.circular(4), - ), - ), - ), - Positioned( - bottom: 0, - left: 0, - right: 0, - child: Container(), - ), - Positioned( - bottom: 16.h, - left: 12.w, - right: 0, - child: Container( - height: 100.h, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - MImage( - store.logo, - width: 57, - height: 57, - fit: BoxFit.cover, - isCircle: true, - errorSrc: "assets/image/default_1.webp", - fadeSrc: "assets/image/default_1.webp", - ), - SizedBox( - width: 6.w, - ), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 40.h, - ), - Text( - store.storeName, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFF0D0D0D), - fontSize: 14.sp, - fontWeight: MyFontWeight.bold, - ), - ), - SizedBox( - height: 5.h, - ), - Text( - "${S.of(context).dizhi}:${store.address}", - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFF4D4D4D), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ], - )), - Container( - width: 59.w, - height: 18.h, - alignment: Alignment.center, - margin: EdgeInsets.only(top: 20.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2), - color: Color(0xFF32A060), - ), - child: Visibility( - child: Text( - (store.distance ?? 0) > 1000 - ? S.of(context).gongli( - ((store.distance ?? 0) / 1000 * 100).toInt() / - 100.0) - : S.of(context).mi( - ((store.distance ?? 0) * 100).toInt() / 100.0), - style: TextStyle( - color: Color(0xFFFFFFFF), - fontSize: 10.sp, - ), - ), - visible: store.distance != null, - ), - ), - ], - ), - ), - ), - ], - ), - ); - } - - ///扫码提示弹窗 - showDeleteDialog() { - showDialog( - context: context, - builder: (context) { - return AlertDialog( - content: Container( - width: MediaQuery.of(context).size.width - 84.w, - 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: () { - toScan(); - Navigator.of(context).pop(); - }, - ), - flex: 1, - ), - ], - ) - ], - ), - ), - ); - }, - ); - } - - ///扫码 - toScan() async { - if (await Permission.camera.isPermanentlyDenied) { - showCupertinoDialog( - context: context, - builder: (context) { - return RequestPermission( - "assets/image/icon_camera_permission_tips.webp", - S.of(context).ninxiangjiquanxianweikaiqi, - S.of(context).weilekaipaizhaoxuanzhetouxiang, - S.of(context).kaiqiquanxian, - (result) async { - if (result) { - await openAppSettings(); - } - }, - heightRatioWithWidth: 0.82, - ); - }); - } else if (await Permission.camera.isGranted) { - // http://pos.app.gznl.top/placeorder/?tableId=1315903669597634560&tenantCode=1166&shopId=1300372027722432512 - // 新版桌子码跳转 - // http://miniscan.lotus-wallet.com/placeorder?tenant_code=1194&table_id=1669609340031467520&store_id=1637659387134738432 - var result = await Navigator.of(context).pushNamed('/router/qr_scan'); - // String result = await scanner.scan(); - Uri uri = Uri.parse(result); - String tableId = uri.queryParameters["tableId"] ?? uri.queryParameters["table_id"]; - String tenantCode = uri.queryParameters["tenantCode"] ?? uri.queryParameters["tenant_code"]; - String shopId = uri.queryParameters["shopId"] ?? uri.queryParameters["store_id"]; - if (tableId != null && - tableId != "" && - tenantCode != null && - tenantCode != "" && - shopId != null && - shopId != "") { - Navigator.of(context).pushNamed( - '/router/store_order', - arguments: { - "id": shopId, - "tenant": tenantCode, - "storeName": "", - "tableId": int.tryParse(tableId), - }, - ); - } - } else { - await Permission.camera.request(); - } - } - @override bool get wantKeepAlive => true; } diff --git a/lib/union/union_select_city.dart b/lib/union/union_select_city.dart index ad582e09..710e6bf4 100644 --- a/lib/union/union_select_city.dart +++ b/lib/union/union_select_city.dart @@ -1,14 +1,20 @@ 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:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; +import '../retrofit/data/ip_data.dart'; +import '../retrofit/retrofit_api.dart'; + class UnionSelectCity extends StatefulWidget { + final Map arguments; + + UnionSelectCity({this.arguments}); @override State createState() { return _UnionSelectCity(); @@ -18,25 +24,58 @@ class UnionSelectCity extends StatefulWidget { class _UnionSelectCity extends State { RefreshController refreshController = RefreshController(); Map areaMap; + ApiService apiIpService; + String ipName; + int ipState = 0; + List hotCity = []; List areaList = []; - final TextEditingController editingController = TextEditingController(); @override void initState() { super.initState(); areaCode(); + queryIpInfo(); } - void areaCode() async { + void areaCode({String searchTxt}) async { var value = await rootBundle.loadString('assets/map_style/chinese_cities.json'); + areaList.clear(); areaMap = jsonDecode(value); + hotCity = (areaMap["热门城市"] as List).map((e) { + return e["area"].toString(); + }).toList(); + areaMap.remove("热门城市"); + Map tempAreaMap = jsonDecode(value); areaMap.forEach((key, value) { - areaList.add(key); + if (searchTxt != null && searchTxt.trim() != "") + value.forEach((element) { + if (!element["area"].contains(searchTxt)) + (tempAreaMap[key] as List) + .removeWhere((el) => el["area"] == element["area"]); + }); + if (tempAreaMap[key].isNotEmpty) areaList.add(key); }); + areaMap = tempAreaMap; setState(() {}); } + queryIpInfo() async { + apiIpService = ApiService( + Dio(), + context: context, + isIp: true + ); + IpData baseData = await apiIpService.getIpInfo().catchError((onError) {}); + if (baseData != null) { + ipName = baseData.city.replaceAll("市", ""); + if(ipName != widget.arguments["cityName"] ){ + ipState=2; + setState((){}); + } + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -60,9 +99,9 @@ class _UnionSelectCity extends State { onTap: () { Navigator.of(context).pop(); }, - child:Container( - padding: EdgeInsets.only(right:21.w), - child: Icon( + child: Container( + padding: EdgeInsets.only(right: 21.w), + child: Icon( Icons.arrow_back_ios, color: Colors.black, ), @@ -70,206 +109,112 @@ class _UnionSelectCity extends State { Expanded(child: searchCityItem()) ], ), - Padding(padding:EdgeInsets.only(top: 16.h,bottom: 24.h), - child:Row( - children: [ - Padding(padding:EdgeInsets.only(right: 10.w), - child: Text( - "当前位置", - style: TextStyle( - color: Color(0xFFA29E9E), - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - ), - ),), - Image.asset( - "assets/image/icon_union_location.webp", - width:20, - height:20, - ), - Padding(padding:EdgeInsets.only(left:8.w,), - child: Text( - "当前位置", - style: TextStyle( - color: Color(0xFF4D4D4D), - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - ), - ),), - ], - )), - Padding(padding:EdgeInsets.only(bottom: 16.h), - child: Text( - "热门城市", - style: TextStyle( - color: Color(0xFFA29E9E), - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - ), - ),), - Padding(padding:EdgeInsets.only(right: 14.h,bottom: 14.h), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: (){ - Navigator.of(context).pop("上海");}, - child: Container( - decoration: BoxDecoration( - color: Color(0xFFF7F7F7), - borderRadius: BorderRadius.circular(4), - ), - padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), - child: Text( - "上海", - style: TextStyle( - color: Color(0xFF4D4D4D), - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - ), - ) - )), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: (){ - Navigator.of(context).pop("深圳");}, - child: Container( - decoration: BoxDecoration( - color: Color(0xFFF7F7F7), - borderRadius: BorderRadius.circular(4), - ), - padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), - child: Text( - "深圳", - style: TextStyle( - color: Color(0xFF4D4D4D), - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - ), - ) - )), GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: (){ - Navigator.of(context).pop("北京");}, - child: Container( - decoration: BoxDecoration( - color: Color(0xFFF7F7F7), - borderRadius: BorderRadius.circular(4), - ), - padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), - child: Text( - "北京", - style: TextStyle( - color: Color(0xFF4D4D4D), - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - ), - ) - )), GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: (){ - Navigator.of(context).pop("广州");}, - child: Container( - decoration: BoxDecoration( - color: Color(0xFFF7F7F7), - borderRadius: BorderRadius.circular(4), - ), - padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), - child: Text( - "广州", - style: TextStyle( - color: Color(0xFF4D4D4D), - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - ), - ) - )), - ], - ),), - Padding(padding:EdgeInsets.only(right: 14.h,), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: (){ - Navigator.of(context).pop("成都");}, - child: Container( - decoration: BoxDecoration( - color: Color(0xFFF7F7F7), - borderRadius: BorderRadius.circular(4), - ), - padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), + Padding( + padding: EdgeInsets.only(top: 16.h, bottom: 24.h), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.only(right: 10.w), child: Text( - "成都", + (ipState == 0||ipState == 1) ? "当前位置" : "已选:", style: TextStyle( - color: Color(0xFF4D4D4D), + color: Color(0xFFA29E9E), fontWeight: MyFontWeight.medium, fontSize: 16.sp, ), - ) - )), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: (){ - Navigator.of(context).pop("杭州");}, - child: Container( - decoration: BoxDecoration( - color: Color(0xFFF7F7F7), - borderRadius: BorderRadius.circular(4), ), - padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), + ), + Image.asset( + "assets/image/icon_union_location.webp", + width: 20, + height: 20, + ), + Expanded( + // padding: EdgeInsets.only( + // left: 8.w, + // ), child: Text( - "杭州", + (ipState== 1) ? (ipName??""):widget.arguments["cityName"] ?? "", style: TextStyle( color: Color(0xFF4D4D4D), fontWeight: MyFontWeight.medium, fontSize: 16.sp, ), - ) - )), - GestureDetector( + ), + ), + if(ipState == 2) + Icon( + Icons.gps_fixed, + color: Colors.grey, + size: 18, + ), + if(ipState == 2) + Padding(padding:EdgeInsets.only(left:5.w,right: 12.w), + child:GestureDetector( behavior: HitTestBehavior.opaque, onTap: (){ - Navigator.of(context).pop("南京");}, - child: Container( - decoration: BoxDecoration( - color: Color(0xFFF7F7F7), - borderRadius: BorderRadius.circular(4), - ), - padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), - child: Text( - "南京", + setState((){ + ipState = 1; + Navigator.of(context).pop(ipName); + }); + }, + child: Text( + "重新定位", style: TextStyle( color: Color(0xFF4D4D4D), fontWeight: MyFontWeight.medium, fontSize: 16.sp, ), - ) - )), - GestureDetector( + ), + ),) + ], + )), + Padding( + padding: EdgeInsets.only(bottom: 16.h), + child: Text( + "热门城市", + style: TextStyle( + color: Color(0xFFA29E9E), + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + ), + ), + ), + GridView.builder( + itemCount: hotCity.length, + padding: EdgeInsets.only(right: 14.h, bottom: 14.h), + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, + crossAxisSpacing: 12.w, + mainAxisSpacing: 12.w, + childAspectRatio: 2.5, + ), + itemBuilder: (context, index) { + return GestureDetector( behavior: HitTestBehavior.opaque, - onTap: (){ - Navigator.of(context).pop("重庆");}, + onTap: () { + Navigator.of(context).pop(hotCity[index]); + setState((){}); + }, child: Container( decoration: BoxDecoration( color: Color(0xFFF7F7F7), borderRadius: BorderRadius.circular(4), ), - padding: EdgeInsets.symmetric(horizontal:24.w,vertical:5.h), + alignment: Alignment.center, child: Text( - "重庆", + hotCity[index], style: TextStyle( color: Color(0xFF4D4D4D), fontWeight: MyFontWeight.medium, fontSize: 16.sp, ), - ) - ), - ), - ], - ),) + ))); + }, + ), ], ), ), @@ -284,7 +229,7 @@ class _UnionSelectCity extends State { return Container( height: 36.h, margin: EdgeInsets.fromLTRB(6.w, 0, 14.w, 0), - padding: EdgeInsets.fromLTRB(0, 6.h, 0, 0), + // padding: EdgeInsets.fromLTRB(0, 6.h, 0, 0), decoration: BoxDecoration( color: Color(0xFFF1F1F1), borderRadius: BorderRadius.circular(6), @@ -302,12 +247,14 @@ class _UnionSelectCity extends State { onEditingComplete: () { FocusScope.of(context).requestFocus(FocusNode()); }, - controller: editingController, + onChanged: (txt) { + areaCode(searchTxt: txt); + }, cursorHeight: 25.h, decoration: InputDecoration( - // contentPadding: EdgeInsets.symmetric( - // vertical: 12.h, - // ), + contentPadding: EdgeInsets.symmetric( + vertical: 14.h, + ), hintText: "输入城市名进行搜索", hintStyle: TextStyle( fontSize: 12.sp, @@ -315,7 +262,7 @@ class _UnionSelectCity extends State { ), prefixIcon: InkWell( onTap: () {}, - child:Image.asset( + child: Image.asset( "assets/image/icon_search.webp", width: 16, height: 16, @@ -328,7 +275,7 @@ class _UnionSelectCity extends State { } Widget sortList() { - return ListView.builder( + return areaList.length != 0 ?ListView.builder( padding: EdgeInsets.zero, itemCount: areaList.length, scrollDirection: Axis.vertical, @@ -340,7 +287,15 @@ class _UnionSelectCity extends State { child: sortItem(position), ); }, - ); + ):Padding(padding:EdgeInsets.only(top:12.h), + child: Text( + "抱歉,未找到相关位置,可尝试修改后重试", + style: TextStyle( + color: Color(0xFF4D4D4D), + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + ), + )); } Widget sortItem(int position) { @@ -369,46 +324,51 @@ class _UnionSelectCity extends State { padding: EdgeInsets.only( top: 8.h, ), - child: Column( - children: (areaMap[areaList[position]] as List).map((e) { - return globalRoamingItem(e); - }).toList(), - ), + child: mapWidget(position), ) ], ); } - Widget globalRoamingItem(data) { + Widget mapWidget(position) { + int mapIndex = 0; + return Column( + children: (areaMap[areaList[position]] as List).map((e) { + mapIndex += 1; + return globalRoamingItem( + e, mapIndex == areaMap[areaList[position]].length); + }).toList(), + ); + } + + Widget globalRoamingItem(data, isLast) { return GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { Navigator.of(context).pop(data["area"]); }, child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 12.w), - child: Text( - data["area"], - style: TextStyle( - color: Color(0xFF000000), - fontWeight: MyFontWeight.regular, - fontSize: 14.sp, + width: double.infinity, + child: Text( + data["area"], + style: TextStyle( + color: Color(0xFF000000), + fontWeight: MyFontWeight.regular, + fontSize: 14.sp, + ), + ), + decoration: BoxDecoration( + border: isLast + ? null + : Border( + bottom: BorderSide( + width: 1.w, + color: Color(0xFFDCDCDC), + style: BorderStyle.solid, + ), ), - ), - ), - Container( - margin: EdgeInsets.symmetric(vertical: 16.h), - width: double.infinity, - height: 1.h, - color: Color(0xFFDCDCDC), - ) - ], ), + padding: EdgeInsets.only(top: 16.h, bottom: 16.h, left: 16.w), ), ); } From 92100c224bb655e71f4352fd94ca511b12e45dca Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Thu, 24 Aug 2023 11:29:22 +0800 Subject: [PATCH 11/35] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=95=B4=E4=BD=93?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9B=20=E8=81=94=E7=9B=9F=EF=BC=9A?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E9=97=A8=E5=BA=97=E5=88=97=E8=A1=A8ui?= =?UTF-8?q?=EF=BC=9B=20=20=20=20=20=20=E6=9B=B4=E6=94=B9=E6=9B=BE=E6=98=AF?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E8=8C=83=E5=9B=B4=EF=BC=8C=E6=9A=82=E5=AE=9A?= =?UTF-8?q?=EF=BC=88=E6=AD=A6=E6=B1=89=EF=BC=8C=E5=8C=97=E4=BA=AC=EF=BC=8C?= =?UTF-8?q?=E9=83=91=E5=B7=9E=EF=BC=89=EF=BC=9B=20=20=20=20=20=20=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=EF=BC=88productShow=E5=88=97=E8=A1=A8=EF=BC=8C=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=95=86=E5=93=81=E6=95=B0=E6=8D=AE=EF=BC=89=EF=BC=9B?= =?UTF-8?q?=20=E6=89=80=E6=9C=89loading=E6=9B=B4=E6=94=B9=EF=BC=8Cloading?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=81=AE=E7=BD=A9=E5=B1=82=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E5=8A=A0=E8=BD=BD=E6=95=B0=E6=8D=AE=E6=97=B6=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=BF=87=E5=BF=AB=E6=93=8D=E4=BD=9C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=8D=E5=87=86=E7=A1=AE=E7=9A=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=93=8D=E4=BD=9C=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/community/community_details.dart | 4 +- lib/home/home_page.dart | 684 ++++++++-------- lib/home/huixiang_brand_page.dart | 2 +- lib/home/points_mall_page.dart | 2 +- lib/home/welfare_exchange.dart | 2 +- lib/integral/integral_page.dart | 2 +- lib/login/login_page.dart | 2 +- lib/login/new_login_page.dart | 18 +- lib/mine/scan_web.dart | 2 +- lib/order/order_detail_page.dart | 2 +- lib/retrofit/data/product_show.dart | 749 ++++++++++++++++++ lib/retrofit/data/store.dart | 160 ++-- lib/retrofit/min_api.dart | 6 +- lib/retrofit/retrofit_api.dart | 14 +- lib/retrofit/retrofit_api.g.dart | 2 +- lib/setting/account_security_page.dart | 2 +- lib/setting/treaty_page.dart | 2 +- lib/setting/user_service_page.dart | 2 +- lib/settlement/settlement.dart | 6 +- lib/store/shop_details_page.dart | 4 +- .../shopping/activity_prefecture_details.dart | 2 +- .../shopping/shopping_goods_details.dart | 2 +- lib/store/shopping/shopping_mall_home.dart | 2 +- lib/store/store_order.dart | 4 +- lib/store/store_view/product_sku.dart | 4 +- lib/union/union_list.dart | 206 ++++- lib/union/union_page.dart | 95 ++- lib/view_widget/channel_dialog.dart | 2 +- lib/vip/user_vip_service_page.dart | 2 +- 29 files changed, 1498 insertions(+), 488 deletions(-) create mode 100644 lib/retrofit/data/product_show.dart diff --git a/lib/community/community_details.dart b/lib/community/community_details.dart index e4cacff3..3051a971 100644 --- a/lib/community/community_details.dart +++ b/lib/community/community_details.dart @@ -100,7 +100,7 @@ class _CommunityDetails extends State void initState() { super.initState(); // comunity = widget.arguments["comment"]; - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); businessId = widget.arguments["businessId"]; WidgetsBinding.instance.addObserver(this); commentFocus.addListener(_focusNodeListener); @@ -399,7 +399,7 @@ class _CommunityDetails extends State ///评论列表 _queryMemberCommentList(bool isOnRefresh) async { - if (!isOnRefresh) EasyLoading.show(status: S.current.zhengzaijiazai); + if (!isOnRefresh) EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); if (apiService == null) apiService = ApiService( diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index 1730b133..f4b816fc 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -8,7 +8,6 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/home/home_view/discount_zone.dart'; -import 'package:huixiang/home/home_view/home_banner.dart'; import 'package:huixiang/home/home_view/home_recommend_goods.dart'; import 'package:huixiang/home/home_view/top_selling_list.dart'; import 'package:huixiang/home/home_view/union_entry.dart'; @@ -27,7 +26,6 @@ import 'package:huixiang/retrofit/data/goods.dart'; import 'package:huixiang/retrofit/data/goods_category.dart'; import 'package:huixiang/retrofit/data/home_rank.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'; @@ -42,8 +40,8 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../retrofit/data/user_info.dart'; -import '../utils/flutter_utils.dart'; import '../view_widget/channel_dialog.dart'; +import '../view_widget/custom_image.dart'; import 'home_view/happy_help_farmers.dart'; import 'home_view/shortcut_operation.dart'; @@ -54,7 +52,8 @@ class HomePage extends StatefulWidget { final List firstLoginCouponList; HomePage(Key key, this.changeTab, - {this.invite, this.interviewCouponList, this.firstLoginCouponList}): super(key: key); + {this.invite, this.interviewCouponList, this.firstLoginCouponList}) + : super(key: key); @override State createState() { @@ -64,6 +63,30 @@ class HomePage extends StatefulWidget { class HomePageState extends State with AutomaticKeepAliveClientMixin { ApiService apiService; + final RefreshController refreshController = RefreshController(); + String categoryId; + bool showInvite = false; + bool showNew = false; + + //排序类型枚举:1-自然排序,2-销量,3-价格 + int orderType = 1; + + //是否降序排列 + bool orderDesc = true; + List goods = []; + List gooodsCategorys = []; + List bannerData = []; + List brandData = []; + List
articles = []; + Founder founder; + bool isSigned = false; + int totalMsg = 0; + List coupons = []; + int state = 1; + HomeRank homeRank; + UserInfo userInfo; + dynamic mRaiseMoney = 0; //众筹金余额 + int _loadCount = 0; @override void initState() { @@ -74,8 +97,11 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { setState(() {}); } }); - queryActivity(); - _onRefresh(); + _onRefresh(isFirstIn: true); + if (showInvite) { + inviteShowAlertDialog(widget.invite, widget.interviewCouponList[0]); + showInvite = false; + } if ((widget.invite ?? "") != "" || widget.interviewCouponList != null && @@ -84,7 +110,6 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { //判断新人弹窗 // if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0) // showNew = true; - } ///邀请成功 @@ -99,18 +124,21 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { } ///活动海报弹窗 - posterShowAlertDialog(ActivityPos activityPos,firstLoginCouponList) { + posterShowAlertDialog(ActivityPos activityPos, firstLoginCouponList) { var today = DateTime.now().day; SharedPreferences.getInstance().then((value) { - if(value.getInt("today")==today && (value.getString("ActivityPosCode") ?? "").contains("${activityPos.code}_${value.getString("userId")};")) + if (value.getInt("today") == today && + (value.getString("ActivityPosCode") ?? "") + .contains("${activityPos.code}_${value.getString("userId")};")) return; - value.setString("ActivityPosCode", "${(value.getString("ActivityPosCode")??"")}${activityPos.code}_${value.getString("userId")};"); + value.setString("ActivityPosCode", + "${(value.getString("ActivityPosCode") ?? "")}${activityPos.code}_${value.getString("userId")};"); value.setInt("today", today); //显示对话框 showDialog( context: context, builder: (BuildContext context) { - return ActivityPoster(activityPos,firstLoginCouponList); + return ActivityPoster(activityPos, firstLoginCouponList); }, ); }); @@ -127,178 +155,111 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { ); } - final SwiperController controller = SwiperController(); - - String categoryId; - int pageNum = 1; - int couponPageNum = 1; - bool showInvite = false; - bool showNew = false; - - //排序类型枚举:1-自然排序,2-销量,3-价格 - int orderType = 1; - - //是否降序排列 - bool orderDesc = true; - List goods = []; - List gooodsCategorys = []; - - List bannerData = []; - List brandData = []; - List
articles = []; - List gooods = []; - Founder founder; - bool isSigned = false; - int totalMsg = 0; - List coupons = []; - int state = 1; - HomeRank homeRank; - UserInfo userInfo; - dynamic mRaiseMoney = 0;//众筹金余额 - - queryHome() async { - // EasyLoading.show(status: S.of(context).zhengzaijiazai); - - final SharedPreferences value = await SharedPreferences.getInstance(); - apiService = ApiService(Dio(), - context: context, token: value.getString('token'), showLoading: false); - - final BaseData brand = - await apiService.queryHomeBrand().catchError((onError) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type), - alignment: Alignment.center); - refreshController.refreshFailed(); - }); - if (brand != null && brand.isSuccess) { - brandData.clear(); - brandData.addAll((brand.data["brandList"] as List) - .map((e) => Brand.fromJson(e)) - .toList()); - founder = Founder.fromJson(brand.data["founder"]); - } - - final BaseData> article = await apiService.queryArticle({ - "pageNum": 1, - "pageSize": 3, - "searchKey": "", - "state": 1, - "type": 2 - }).catchError((onError) { - refreshController.refreshFailed(); - }); - articles.clear(); - if (article != null && article.isSuccess) { - articles.addAll(article.data.list); + ///头部banner + queryBanner() async { + try { + BaseData> baseData = await apiService.queryBanner({ + "model": {"type": "HOME_PAGE"}, + }).catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + bannerData = baseData.data.records; + // if (bannerData.length > 0) swiperController.move(0, animation: false); + } + } finally { + addLoadCount(); } + } - final BaseData rank = await apiService.recommendRank().catchError((onError) {}); - if (rank != null && rank.isSuccess) { - homeRank = rank.data; + addLoadCount() { + _loadCount += 1; + if (_loadCount == 6) { + _loadCount = 0; + EasyLoading.dismiss(); + if (refreshController.isRefresh) refreshController.refreshCompleted(); + if (mounted) setState(() {}); } + } - final BaseData> goodsData = await apiService.creditGoods({ - "orderDesc": true, - "orderType": 1, - "pageNum": 1, - "pageSize": 100, - "state": 1 - }).catchError((onError) { - refreshController.refreshFailed(); - }); - if (goodsData != null && goodsData.isSuccess) { - gooods.clear(); - gooods.addAll(goodsData.data.list); + ///推荐排行 + queryRecommendRank() async { + try { + BaseData rank = + await apiService.recommendRank().catchError((onError) {}); + if (rank != null && rank.isSuccess) { + homeRank = rank.data; + } + } finally { + addLoadCount(); } + } - BaseData> dataCategory = - await apiService.goodsCategory({ - "current": 1, - "map": {}, - "model": {"pageNum": 1, "pageSize": 20, "searchKey": ""}, - "order": "descending", - "size": 20, - "sort": "sortOrder" - }).catchError((onError) { - refreshController.loadFailed(); - refreshController.refreshFailed(); - }); - - if (dataCategory != null && - dataCategory.isSuccess && - dataCategory.data != null && - dataCategory.data.records != null && - dataCategory.data.records.length > 0) { - gooodsCategorys.clear(); - gooodsCategorys.add(GoodsCategory(name: S.of(context).quanbu)); - gooodsCategorys.addAll(dataCategory.data.records); + ///积分商城商品分類列表 + queryGoodsCategory() async { + try { + BaseData> dataCategory = + await apiService.goodsCategory({ + "current": 1, + "map": {}, + "model": {"pageNum": 1, "pageSize": 20, "searchKey": ""}, + "order": "descending", + "size": 20, + "sort": "sortOrder" + }).catchError((onError) {}); + if (dataCategory != null && + dataCategory.isSuccess && + dataCategory.data != null && + dataCategory.data.records != null && + dataCategory.data.records.length > 0) { + gooodsCategorys.clear(); + gooodsCategorys.add(GoodsCategory(name: S.of(context).quanbu)); + gooodsCategorys.addAll(dataCategory.data.records); + } + } finally { + addLoadCount(); } + } - var param = { - "categoryId": categoryId ?? "", - "orderDesc": orderDesc, - "orderType": orderType, - "pageNum": pageNum, - "pageSize": 100, - "state": 1 - }; - BaseData> pageGoods = - await apiService.creditGoods(param).catchError((onError) { - refreshController.loadFailed(); - refreshController.refreshFailed(); - }); - EasyLoading.dismiss(); - if (pageGoods != null && pageGoods.isSuccess) { - if (pageNum == 1) { - goods.clear(); + ///积分商城商品列表 + queryPointsProductList(bool isRefresh) async { + try { + if (!isRefresh) + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); + var param = { + "categoryId": categoryId ?? "", + "orderDesc": orderDesc, + "orderType": orderType, + "pageNum": 1, + "pageSize": 100, + "state": 1 + }; + BaseData> pageGoods = + await apiService.creditGoods(param).catchError((onError) {}); + if (pageGoods != null && pageGoods.isSuccess) { + goods = pageGoods.data.list; } - goods.addAll(pageGoods.data.list); - refreshController.refreshCompleted(); - refreshController.loadComplete(); - if (pageGoods.data.pageNum == pageGoods.data.pages) { - refreshController.loadNoData(); - } else { - pageNum += 1; + } finally { + if(isRefresh) + addLoadCount(); + else { + EasyLoading.dismiss(); + setState((){}); } - } else { - refreshController.loadFailed(); - refreshController.refreshFailed(); - } - - final BaseData> baseData = - await apiService.queryBanner({ - "model": {"type": "HOME_PAGE"}, - }).catchError((onError) { - refreshController.refreshFailed(); - }); - if (baseData != null && baseData.isSuccess) { - bannerData.clear(); - bannerData.addAll(baseData.data.records); - refreshController.refreshCompleted(); - if (bannerData.length > 0) controller.move(0, animation: false); - } else { - refreshController.refreshFailed(); } - EasyLoading.dismiss(); - if (showInvite) { - inviteShowAlertDialog(widget.invite, widget.interviewCouponList[0]); - showInvite = false; - } - - //判断新人弹窗 - // if (showNew) { - // newShowAlertDialog(widget.firstLoginCouponList); - // showNew = false; - // } } ///查询会员信息 queryUserBalance() async { - BaseData baseData = - await apiService.queryInfo().catchError((onError) {}); - if (baseData != null && baseData.isSuccess) { - userInfo = baseData.data; - mRaiseMoney = double.tryParse(userInfo.raiseMoney); - if (mounted) setState(() {}); + try { + BaseData baseData = + await apiService.queryInfo().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + userInfo = baseData.data; + mRaiseMoney = double.tryParse(userInfo.raiseMoney); + } + } finally { + addLoadCount(); } } @@ -326,35 +287,18 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { ///活动弹窗 queryActivity() async { - if (apiService == null) { - SharedPreferences value = await SharedPreferences.getInstance(); - apiService = ApiService( - Dio(), - context: context, - token: value.getString("token"), - showLoading: true - ); - } BaseData baseData = - await apiService.appPopup().catchError((onError) { - }); + await apiService.appPopup().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { - if(baseData.data?.enabled ?? true) - posterShowAlertDialog(baseData.data,widget.firstLoginCouponList); + if (baseData.data?.enabled ?? true) + posterShowAlertDialog(baseData.data, widget.firstLoginCouponList); } } ///核销用户优惠券 queryWiped(memberCouponId) async { - if (apiService == null) { - SharedPreferences value = await SharedPreferences.getInstance(); - apiService = ApiService( - Dio(), - context: context, - token: value.getString("token"), - ); - } - BaseData baseData = await apiService.wiped(memberCouponId).catchError((onError) {}); + BaseData baseData = + await apiService.wiped(memberCouponId).catchError((onError) {}); if (baseData != null && baseData.isSuccess) { SmartDialog.showToast("核销成功", alignment: Alignment.center); } else { @@ -363,6 +307,25 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { } queryCoupon() async { + try { + BaseData> baseData = await apiService.queryCoupon({ + "centre": true, + "pageNum": 1, + "pageSize": 10, + "searchKey": "", + "state": 0 + }).catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + coupons = baseData.data.list; + } + } finally { + addLoadCount(); + } + } + + _onRefresh({bool isFirstIn = false}) async { + EasyLoading.show( + status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); if (apiService == null) { SharedPreferences value = await SharedPreferences.getInstance(); apiService = ApiService( @@ -371,39 +334,14 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { token: value.getString("token"), ); } - BaseData> baseData = await apiService.queryCoupon({ - "centre": true, - "pageNum": couponPageNum, - "pageSize": 10, - "searchKey": "", - "state": 0 - }).catchError((onError) { - refreshController.refreshFailed(); - refreshController.loadFailed(); - }); - if (couponPageNum == 1) coupons.clear(); - if (baseData != null && baseData.isSuccess) { - coupons.addAll(baseData.data.list); - refreshController.refreshCompleted(); - refreshController.loadComplete(); - if (baseData.data.pageNum == baseData.data.pages) { - refreshController.loadNoData(); - } else { - couponPageNum += 1; - } - setState(() {}); - } - else { - refreshController.refreshFailed(); - refreshController.loadFailed(); - } - } - - _onRefresh() async{ - await queryHome(); - await queryUserBalance(); + if (isFirstIn) queryActivity(); + queryBanner(); + queryRecommendRank(); + queryGoodsCategory(); + queryPointsProductList(true); + queryUserBalance(); // queryMsgStats(); - await queryCoupon(); + queryCoupon(); } @override @@ -412,8 +350,6 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { if (refreshController != null) refreshController.dispose(); } - final RefreshController refreshController = RefreshController(); - @override Widget build(BuildContext context) { super.build(context); @@ -502,96 +438,90 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { enablePullUp: false, header: MyHeader(), physics: BouncingScrollPhysics(), - onRefresh: () { - setState(() {_onRefresh(); - }); - }, + onRefresh: _onRefresh, child: SingleChildScrollView( - physics: NeverScrollableScrollPhysics(), - child: FutureBuilder( - future: queryHome(), - builder: (context, snapshot) { - return Column( - children: [ - ///banner - HomeBanner(bannerData, controller), - - ///吃喝玩 - UnionEntry((int jpIndex) { - widget.changeTab(1,jpIndex); - }), - - ///快捷操作 - ShortcutOperation((int jpIndex) { - widget.changeTab(1,jpIndex); - }), - - ///推广图 - spread(), - - // ///签到 - // SignView(isSigned, (value) { - // setState(() { - // isSigned = value; - // }); - // }), - - ///特惠专区 - if(coupons != null && coupons.length != 0) - DiscountZone(coupons), - - ///特惠专区-推荐商品展示 - if(homeRank != null && homeRank.commodityZone.length != 0) - HomeRecommendGoods(homeRank), - - ///助农专区 - // if(mRaiseMoney != 0) - HappyHelpFarmers(), - - ///福利中心 - WelfareCore(), - - ///吃喝玩商品热销榜 - if(homeRank != null && homeRank.commodityList.length != 0) - TopSellingList(homeRank), - - // ///店铺推荐 - // QuickOrder(), - - // ///超级优惠券 - // CouponView(), - - // ///精选活动 - // FeaturedActivity(), - - // ///积分商城 - // HomeIntegralStore(gooods), - - ///积分商品头Tab - PointsGoodsTitle( - gooodsCategorys, - (orderType, orderDesc) { - this.orderType = orderType; - this.orderDesc = orderDesc; - setState(() {}); - }, - (index) { - categoryId = gooodsCategorys[index].id; - pageNum = 1; - setState(() {}); - }, - ), - - ///积分商品列表 - PointGoods( - goods, - (index) { - _toDetails(index); - }, - ), - ], - );}) - ), + physics: NeverScrollableScrollPhysics(), + child: Column( + children: [ + ///banner + homeBanner(), + + ///吃喝玩 + UnionEntry((int jpIndex) { + widget.changeTab(1, jpIndex); + }), + + ///快捷操作 + ShortcutOperation((int jpIndex) { + widget.changeTab(1, jpIndex); + }), + + ///推广图 + spread(), + + // ///签到 + // SignView(isSigned, (value) { + // setState(() { + // isSigned = value; + // }); + // }), + + ///特惠专区 + if (coupons != null && coupons.length != 0) + DiscountZone(coupons), + + ///特惠专区-推荐商品展示 + if (homeRank != null && + homeRank.commodityZone.length != 0) + HomeRecommendGoods(homeRank), + + ///助农专区 + // if(mRaiseMoney != 0) + HappyHelpFarmers(), + + ///福利中心 + WelfareCore(), + + ///吃喝玩商品热销榜 + if (homeRank != null && + homeRank.commodityList.length != 0) + TopSellingList(homeRank), + + // ///店铺推荐 + // QuickOrder(), + + // ///超级优惠券 + // CouponView(), + + // ///精选活动 + // FeaturedActivity(), + + // ///积分商城 + // HomeIntegralStore(gooods), + + ///积分商品头Tab + PointsGoodsTitle( + gooodsCategorys, + (orderType, orderDesc) { + this.orderType = orderType; + this.orderDesc = orderDesc; + queryPointsProductList(false); + }, + (index) { + categoryId = gooodsCategorys[index].id; + queryPointsProductList(false); + }, + ), + + ///积分商品列表 + PointGoods( + goods, + (index) { + _toDetails(index); + }, + ), + ], + )), ), ), ), @@ -602,7 +532,99 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { ); } - Widget spread(){ + Widget homeBanner() { + return Container( + child: AspectRatio( + aspectRatio: 1.25, + child: bannerData != null && bannerData.isNotEmpty + ? Swiper( + pagination: SwiperPagination( + margin: EdgeInsets.only(bottom: 12.h), + alignment: Alignment.bottomCenter, + builder: DotSwiperPaginationBuilder( + size: 8, + activeSize: 8, + space: 5, + activeColor: Colors.white, + color: Colors.white.withAlpha(76), + ), + ), + autoplay: true, + duration: 1000, + autoplayDelay: 2000, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return InkWell( + onTap: () { + bannerClick(bannerData[position]); + }, + child: Container( + child: MImage( + bannerData[position].imgUrl, + fit: BoxFit.cover, + errorSrc: "assets/image/default_2_1.webp", + fadeSrc: "assets/image/default_2_1.webp", + ), + ), + ); + }, + itemCount: bannerData.length, + ) + : Image.asset( + "assets/image/default_2_1.webp", + fit: BoxFit.cover, + ), + ), + ); + } + + /// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程,7:门店跳转) + bannerClick(BannerData bannerData) async { + switch (bannerData.contentType) { + case 1: + Navigator.of(context).pushNamed('/router/integral_store_page', + arguments: {"goodsId": bannerData.content}); + break; + case 2: + Navigator.of(context).pushNamed('/router/web_page', arguments: { + "activityId": bannerData.content, + }); + break; + case 3: + Navigator.of(context).pushNamed('/router/web_page', arguments: { + "articleId": bannerData.content, + }); + 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("?") + 1); + Map map = jsonDecode(params); + Navigator.of(context).pushNamed( + router.substring(0, router.indexOf("?")), + arguments: map); + } else { + Navigator.of(context).pushNamed(router); + } + break; + case 5: + Navigator.of(context).pushNamed('/router/class_details', arguments: { + "id": bannerData.content, + }); + break; + case 7: + String params = + bannerData.content.substring(bannerData.content.indexOf("?") + 1); + Map map = jsonDecode(params); + Navigator.of(context).pushNamed( + bannerData.content.substring(0, bannerData.content.indexOf("?")), + arguments: map); + break; + } + } + + Widget spread() { return Container( width: double.infinity, height: 85.h, @@ -618,33 +640,33 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { color: Colors.white.withAlpha(76), ), ), - autoplay:true, + autoplay: true, duration: 1000, autoplayDelay: 2000, itemBuilder: (context, position) { return GestureDetector( - onTap: (){ - if(position == 0){ + onTap: () { + if (position == 0) { Navigator.of(context).pushNamed('/router/invite_friends'); - }else if(position == 1){ + } else if (position == 1) { Navigator.of(context).pushNamed('/router/trading_card_page'); } }, - child:Container( - margin: EdgeInsets.symmetric(horizontal:14.w), + child: Container( + margin: EdgeInsets.symmetric(horizontal: 14.w), child: ClipRRect( - child:Image.asset( + child: Image.asset( spreadItem[position], - width:double.infinity, + width: double.infinity, fit: BoxFit.fill, - height:double.infinity, + height: double.infinity, ), borderRadius: BorderRadius.circular(6.w), ), ), ); }, - itemCount:2, + itemCount: 2, ), ); } @@ -678,20 +700,24 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { // 新版桌子码跳转 // http://miniscan.lotus-wallet.com/placeorder?tenant_code=1194&table_id=1669609340031467520&store_id=1637659387134738432 var result = await Navigator.of(context).pushNamed('/router/qr_scan'); - if(result.toString().contains("type\":\"coupon")){ + if (result.toString().contains("type\":\"coupon")) { ///活动优惠券赠送弹窗 activityShowAlertDialog(result.toString()); return; - }if(result.toString().contains("type\":\"wiped")){ + } + if (result.toString().contains("type\":\"wiped")) { ///核销券 queryWiped(jsonDecode(result.toString())["memberCouponId"]); return; } // String result = await scanner.scan(); Uri uri = Uri.parse(result); - String tableId = uri.queryParameters["tableId"] ?? uri.queryParameters["table_id"]; - String tenantCode = uri.queryParameters["tenantCode"] ?? uri.queryParameters["tenant_code"]; - String shopId = uri.queryParameters["shopId"] ?? uri.queryParameters["store_id"]; + String tableId = + uri.queryParameters["tableId"] ?? uri.queryParameters["table_id"]; + String tenantCode = uri.queryParameters["tenantCode"] ?? + uri.queryParameters["tenant_code"]; + String shopId = + uri.queryParameters["shopId"] ?? uri.queryParameters["store_id"]; if (tableId != null && tableId != "" && tenantCode != null && diff --git a/lib/home/huixiang_brand_page.dart b/lib/home/huixiang_brand_page.dart index 22ec8ead..af0a5425 100644 --- a/lib/home/huixiang_brand_page.dart +++ b/lib/home/huixiang_brand_page.dart @@ -44,7 +44,7 @@ class _BrandPage extends State Founder founder; queryHome() async { - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); final SharedPreferences value = await SharedPreferences.getInstance(); apiService = ApiService( diff --git a/lib/home/points_mall_page.dart b/lib/home/points_mall_page.dart index e3c86fba..4e0d55fe 100644 --- a/lib/home/points_mall_page.dart +++ b/lib/home/points_mall_page.dart @@ -95,7 +95,7 @@ class _PointsMallPage extends State } creditGoods() async { - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); final SharedPreferences value = await SharedPreferences.getInstance(); client = ApiService(Dio(), diff --git a/lib/home/welfare_exchange.dart b/lib/home/welfare_exchange.dart index 4fa8ecaa..b4ec8b8e 100644 --- a/lib/home/welfare_exchange.dart +++ b/lib/home/welfare_exchange.dart @@ -62,7 +62,7 @@ class _WelfareExchange extends State } queryUser() async { - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); BaseData baseData = await apiService.queryInfo().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { diff --git a/lib/integral/integral_page.dart b/lib/integral/integral_page.dart index 06ae97a7..04f8b83f 100644 --- a/lib/integral/integral_page.dart +++ b/lib/integral/integral_page.dart @@ -191,7 +191,7 @@ class _IntegralPage extends State { SmartDialog.showToast("今日已签到了", alignment: Alignment.center); return; } - EasyLoading.show(status: S.of(context).zhengzaijiazai); + EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); BaseData baseData = await apiService.signIn().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { setState(() {}); diff --git a/lib/login/login_page.dart b/lib/login/login_page.dart index 67bcc0ee..bc68553f 100644 --- a/lib/login/login_page.dart +++ b/lib/login/login_page.dart @@ -326,7 +326,7 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { "mobile": mobile, "invite":invite, }; - EasyLoading.show(status: S.of(context).zhengzaijiazai); + EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); BaseData value = await client.memberLogin(param).catchError((error) { print(error.message); SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), alignment: Alignment.center); diff --git a/lib/login/new_login_page.dart b/lib/login/new_login_page.dart index c4d5f9b1..580b4890 100644 --- a/lib/login/new_login_page.dart +++ b/lib/login/new_login_page.dart @@ -61,17 +61,9 @@ class _NewLoginPage extends State { void initState() { super.initState(); isLogin(); - queryChannels(); } queryChannels() async{ - SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); - if (!sharedPreferences.containsKey("isShowPrivacyPolicy") || - !sharedPreferences.getBool("isShowPrivacyPolicy")) { - showAlertDialog(); - return; - } - apiService = ApiService(Dio(), context: context); BaseData baseData = await apiService.appChannels().catchError((error) { print(error.message); SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), @@ -80,7 +72,6 @@ class _NewLoginPage extends State { if (baseData != null && baseData.isSuccess) { channelsList = baseData.data; setState((){}); - EasyLoading.dismiss(); } else { if (baseData?.msg != null) SmartDialog.showToast(baseData.msg, alignment: Alignment.center); @@ -241,7 +232,7 @@ class _NewLoginPage extends State { "areaCode": area, "regChannel":channelName ?? "" }; - EasyLoading.show(status: S.of(context).zhengzaijiazai); + EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); BaseData value = await apiService.memberLogin(param).catchError((error) { print(error.message); SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), @@ -262,11 +253,11 @@ class _NewLoginPage extends State { "interviewCouponList": userInfo.interviewCouponList, "firstLoginCouponList": userInfo.firstLoginCouponList }); - EasyLoading.dismiss(); } else { if (value.msg != null) SmartDialog.showToast(value?.msg, alignment: Alignment.center); } + EasyLoading.dismiss(); } saveUserJson(userJson) { @@ -295,11 +286,10 @@ class _NewLoginPage extends State { sharedPreferences.getString("mobile") == "13800138000"; Navigator.of(context).popAndPushNamed('/router/main_page'); } else { - initController(); - apiService = ApiService(Dio(), context: context); + initController(); isShowLogin = true; - setState(() {}); + queryChannels(); } } diff --git a/lib/mine/scan_web.dart b/lib/mine/scan_web.dart index b738be34..acab322e 100644 --- a/lib/mine/scan_web.dart +++ b/lib/mine/scan_web.dart @@ -26,7 +26,7 @@ class _ScanWeb extends State { super.initState(); result = widget.arguments["result"]; title = widget.arguments["title"]; - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); } @override diff --git a/lib/order/order_detail_page.dart b/lib/order/order_detail_page.dart index 798a9c0b..925720ff 100644 --- a/lib/order/order_detail_page.dart +++ b/lib/order/order_detail_page.dart @@ -48,7 +48,7 @@ class _OrderDetailPage extends State { super.initState(); jumpState = widget.arguments["jumpState"]; SharedPreferences.getInstance().then((value) { - EasyLoading.show(status: S.of(context).zhengzaijiazai); + EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); apiService = ApiService(Dio(), context: context, token: value.getString("token"),); queryDetails(); diff --git a/lib/retrofit/data/product_show.dart b/lib/retrofit/data/product_show.dart new file mode 100644 index 00000000..c4774b6b --- /dev/null +++ b/lib/retrofit/data/product_show.dart @@ -0,0 +1,749 @@ +/// id : "1484156758195699712" +/// createTime : "2022-01-20 21:32:00" +/// createUser : "1364043181062094848" +/// updateTime : "2022-01-21 18:27:02" +/// updateUser : "1364043181062094848" +/// supplierName : "一心回乡生态农场" +/// storeId : "1460885296764682240" +/// categoryId : "1460889654206136320" +/// groupId : "1484146679266410496" +/// shortName : "【一心回乡】三益米 筋道绵润、鲜稻尝鲜;自留种老品种,非转基因种子" +/// productName : "三益米1kg" +/// sellDesc : "" +/// productCode : "PRO202201202132000000000000001" +/// weight : "0" +/// applyPrice : "39.00" +/// price : "24.00" +/// vipPrice : null +/// stock : -13 +/// sellCount : 19 +/// needLogistics : 1 +/// oversold : 1 +/// organic : 0 +/// status : 1 +/// posShow : true +/// subscribeParam : null +/// isRaise : false +/// productType : 0 +/// productNumber : 1 +/// setMeal : 1 +/// attrStyle : 0 +/// detail : "" +/// isDelete : 0 +/// printerFlag : "DEFAULT" +/// materials : null +/// materialId : null +/// details : "" +/// thumbnailImg : "" +/// info : "" +/// buyCount : 12 +/// sellCountLimit : 0 +/// stockRecoveryTime : null +/// isAddPurchase : null +/// limitNum : 0 +/// rankId : "0" +/// happyBean : 0 +/// imgs : ["https://pos.upload.lotus-wallet.com/1179/2022/01/243f54db-2dc8-4a9b-9ccc-09fc7a4e2a2e.jpg"] +/// productSkuList : [{"id":"1484156758229254144","createTime":"2022-01-20 21:32:00","createUser":"1364043181062094848","updateTime":"2022-01-20 21:32:00","updateUser":"1364043181062094848","storeId":"1460885296764682240","skuCode":"P202201202132002","skuNameStr":"","productId":"1484156758195699712","skuPrice":"24.00","applyPrice":"39.00","vipPrice":"24.00","packagingFee":"0.00","skuImg":null,"skuStock":-13,"autoRenewSkuStock":0,"deliveries":0,"ticketType":"","ticketWipedTimeTemplateId":null,"takeType":null,"ticketDays":"0","ticketExpireTime":"23:59:59","sort":50,"setMeal":"","productSetMeals":null,"weight":0.0,"volume":0.0,"isDelete":0,"material":null,"version":0,"skuTickets":null,"ticketStyle":""}] + +class ProductShow { + ProductShow({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String supplierName, + String storeId, + String categoryId, + String groupId, + String shortName, + String productName, + String sellDesc, + String productCode, + String weight, + String applyPrice, + String price, + dynamic vipPrice, + num stock, + num sellCount, + num needLogistics, + num oversold, + num organic, + num status, + bool posShow, + dynamic subscribeParam, + bool isRaise, + num productType, + num productNumber, + num setMeal, + num attrStyle, + String detail, + num isDelete, + String printerFlag, + dynamic materials, + dynamic materialId, + String details, + String thumbnailImg, + String info, + num buyCount, + num sellCountLimit, + dynamic stockRecoveryTime, + dynamic isAddPurchase, + num limitNum, + String rankId, + num happyBean, + List imgs, + List productSkuList,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _supplierName = supplierName; + _storeId = storeId; + _categoryId = categoryId; + _groupId = groupId; + _shortName = shortName; + _productName = productName; + _sellDesc = sellDesc; + _productCode = productCode; + _weight = weight; + _applyPrice = applyPrice; + _price = price; + _vipPrice = vipPrice; + _stock = stock; + _sellCount = sellCount; + _needLogistics = needLogistics; + _oversold = oversold; + _organic = organic; + _status = status; + _posShow = posShow; + _subscribeParam = subscribeParam; + _isRaise = isRaise; + _productType = productType; + _productNumber = productNumber; + _setMeal = setMeal; + _attrStyle = attrStyle; + _detail = detail; + _isDelete = isDelete; + _printerFlag = printerFlag; + _materials = materials; + _materialId = materialId; + _details = details; + _thumbnailImg = thumbnailImg; + _info = info; + _buyCount = buyCount; + _sellCountLimit = sellCountLimit; + _stockRecoveryTime = stockRecoveryTime; + _isAddPurchase = isAddPurchase; + _limitNum = limitNum; + _rankId = rankId; + _happyBean = happyBean; + _imgs = imgs; + _productSkuList = productSkuList; +} + + ProductShow.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _supplierName = json['supplierName']; + _storeId = json['storeId']; + _categoryId = json['categoryId']; + _groupId = json['groupId']; + _shortName = json['shortName']; + _productName = json['productName']; + _sellDesc = json['sellDesc']; + _productCode = json['productCode']; + _weight = json['weight']; + _applyPrice = json['applyPrice']; + _price = json['price']; + _vipPrice = json['vipPrice']; + _stock = json['stock']; + _sellCount = json['sellCount']; + _needLogistics = json['needLogistics']; + _oversold = json['oversold']; + _organic = json['organic']; + _status = json['status']; + _posShow = json['posShow']; + _subscribeParam = json['subscribeParam']; + _isRaise = json['isRaise']; + _productType = json['productType']; + _productNumber = json['productNumber']; + _setMeal = json['setMeal']; + _attrStyle = json['attrStyle']; + _detail = json['detail']; + _isDelete = json['isDelete']; + _printerFlag = json['printerFlag']; + _materials = json['materials']; + _materialId = json['materialId']; + _details = json['details']; + _thumbnailImg = json['thumbnailImg']; + _info = json['info']; + _buyCount = json['buyCount']; + _sellCountLimit = json['sellCountLimit']; + _stockRecoveryTime = json['stockRecoveryTime']; + _isAddPurchase = json['isAddPurchase']; + _limitNum = json['limitNum']; + _rankId = json['rankId']; + _happyBean = json['happyBean']; + _imgs = json['imgs'] != null ? json['imgs'].cast() : []; + if (json['productSkuList'] != null) { + _productSkuList = []; + json['productSkuList'].forEach((v) { + _productSkuList.add(ProductSkuList.fromJson(v)); + }); + } + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _supplierName; + String _storeId; + String _categoryId; + String _groupId; + String _shortName; + String _productName; + String _sellDesc; + String _productCode; + String _weight; + String _applyPrice; + String _price; + dynamic _vipPrice; + num _stock; + num _sellCount; + num _needLogistics; + num _oversold; + num _organic; + num _status; + bool _posShow; + dynamic _subscribeParam; + bool _isRaise; + num _productType; + num _productNumber; + num _setMeal; + num _attrStyle; + String _detail; + num _isDelete; + String _printerFlag; + dynamic _materials; + dynamic _materialId; + String _details; + String _thumbnailImg; + String _info; + num _buyCount; + num _sellCountLimit; + dynamic _stockRecoveryTime; + dynamic _isAddPurchase; + num _limitNum; + String _rankId; + num _happyBean; + List _imgs; + List _productSkuList; +ProductShow copyWith({ String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String supplierName, + String storeId, + String categoryId, + String groupId, + String shortName, + String productName, + String sellDesc, + String productCode, + String weight, + String applyPrice, + String price, + dynamic vipPrice, + num stock, + num sellCount, + num needLogistics, + num oversold, + num organic, + num status, + bool posShow, + dynamic subscribeParam, + bool isRaise, + num productType, + num productNumber, + num setMeal, + num attrStyle, + String detail, + num isDelete, + String printerFlag, + dynamic materials, + dynamic materialId, + String details, + String thumbnailImg, + String info, + num buyCount, + num sellCountLimit, + dynamic stockRecoveryTime, + dynamic isAddPurchase, + num limitNum, + String rankId, + num happyBean, + List imgs, + List productSkuList, +}) => ProductShow( id: id ?? _id, + createTime: createTime ?? _createTime, + createUser: createUser ?? _createUser, + updateTime: updateTime ?? _updateTime, + updateUser: updateUser ?? _updateUser, + supplierName: supplierName ?? _supplierName, + storeId: storeId ?? _storeId, + categoryId: categoryId ?? _categoryId, + groupId: groupId ?? _groupId, + shortName: shortName ?? _shortName, + productName: productName ?? _productName, + sellDesc: sellDesc ?? _sellDesc, + productCode: productCode ?? _productCode, + weight: weight ?? _weight, + applyPrice: applyPrice ?? _applyPrice, + price: price ?? _price, + vipPrice: vipPrice ?? _vipPrice, + stock: stock ?? _stock, + sellCount: sellCount ?? _sellCount, + needLogistics: needLogistics ?? _needLogistics, + oversold: oversold ?? _oversold, + organic: organic ?? _organic, + status: status ?? _status, + posShow: posShow ?? _posShow, + subscribeParam: subscribeParam ?? _subscribeParam, + isRaise: isRaise ?? _isRaise, + productType: productType ?? _productType, + productNumber: productNumber ?? _productNumber, + setMeal: setMeal ?? _setMeal, + attrStyle: attrStyle ?? _attrStyle, + detail: detail ?? _detail, + isDelete: isDelete ?? _isDelete, + printerFlag: printerFlag ?? _printerFlag, + materials: materials ?? _materials, + materialId: materialId ?? _materialId, + details: details ?? _details, + thumbnailImg: thumbnailImg ?? _thumbnailImg, + info: info ?? _info, + buyCount: buyCount ?? _buyCount, + sellCountLimit: sellCountLimit ?? _sellCountLimit, + stockRecoveryTime: stockRecoveryTime ?? _stockRecoveryTime, + isAddPurchase: isAddPurchase ?? _isAddPurchase, + limitNum: limitNum ?? _limitNum, + rankId: rankId ?? _rankId, + happyBean: happyBean ?? _happyBean, + imgs: imgs ?? _imgs, + productSkuList: productSkuList ?? _productSkuList, +); + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get supplierName => _supplierName; + String get storeId => _storeId; + String get categoryId => _categoryId; + String get groupId => _groupId; + String get shortName => _shortName; + String get productName => _productName; + String get sellDesc => _sellDesc; + String get productCode => _productCode; + String get weight => _weight; + String get applyPrice => _applyPrice; + String get price => _price; + dynamic get vipPrice => _vipPrice; + num get stock => _stock; + num get sellCount => _sellCount; + num get needLogistics => _needLogistics; + num get oversold => _oversold; + num get organic => _organic; + num get status => _status; + bool get posShow => _posShow; + dynamic get subscribeParam => _subscribeParam; + bool get isRaise => _isRaise; + num get productType => _productType; + num get productNumber => _productNumber; + num get setMeal => _setMeal; + num get attrStyle => _attrStyle; + String get detail => _detail; + num get isDelete => _isDelete; + String get printerFlag => _printerFlag; + dynamic get materials => _materials; + dynamic get materialId => _materialId; + String get details => _details; + String get thumbnailImg => _thumbnailImg; + String get info => _info; + num get buyCount => _buyCount; + num get sellCountLimit => _sellCountLimit; + dynamic get stockRecoveryTime => _stockRecoveryTime; + dynamic get isAddPurchase => _isAddPurchase; + num get limitNum => _limitNum; + String get rankId => _rankId; + num get happyBean => _happyBean; + List get imgs => _imgs; + List get productSkuList => _productSkuList; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['supplierName'] = _supplierName; + map['storeId'] = _storeId; + map['categoryId'] = _categoryId; + map['groupId'] = _groupId; + map['shortName'] = _shortName; + map['productName'] = _productName; + map['sellDesc'] = _sellDesc; + map['productCode'] = _productCode; + map['weight'] = _weight; + map['applyPrice'] = _applyPrice; + map['price'] = _price; + map['vipPrice'] = _vipPrice; + map['stock'] = _stock; + map['sellCount'] = _sellCount; + map['needLogistics'] = _needLogistics; + map['oversold'] = _oversold; + map['organic'] = _organic; + map['status'] = _status; + map['posShow'] = _posShow; + map['subscribeParam'] = _subscribeParam; + map['isRaise'] = _isRaise; + map['productType'] = _productType; + map['productNumber'] = _productNumber; + map['setMeal'] = _setMeal; + map['attrStyle'] = _attrStyle; + map['detail'] = _detail; + map['isDelete'] = _isDelete; + map['printerFlag'] = _printerFlag; + map['materials'] = _materials; + map['materialId'] = _materialId; + map['details'] = _details; + map['thumbnailImg'] = _thumbnailImg; + map['info'] = _info; + map['buyCount'] = _buyCount; + map['sellCountLimit'] = _sellCountLimit; + map['stockRecoveryTime'] = _stockRecoveryTime; + map['isAddPurchase'] = _isAddPurchase; + map['limitNum'] = _limitNum; + map['rankId'] = _rankId; + map['happyBean'] = _happyBean; + map['imgs'] = _imgs; + if (_productSkuList != null) { + map['productSkuList'] = _productSkuList.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// id : "1484156758229254144" +/// createTime : "2022-01-20 21:32:00" +/// createUser : "1364043181062094848" +/// updateTime : "2022-01-20 21:32:00" +/// updateUser : "1364043181062094848" +/// storeId : "1460885296764682240" +/// skuCode : "P202201202132002" +/// skuNameStr : "" +/// productId : "1484156758195699712" +/// skuPrice : "24.00" +/// applyPrice : "39.00" +/// vipPrice : "24.00" +/// packagingFee : "0.00" +/// skuImg : null +/// skuStock : -13 +/// autoRenewSkuStock : 0 +/// deliveries : 0 +/// ticketType : "" +/// ticketWipedTimeTemplateId : null +/// takeType : null +/// ticketDays : "0" +/// ticketExpireTime : "23:59:59" +/// sort : 50 +/// setMeal : "" +/// productSetMeals : null +/// weight : 0.0 +/// volume : 0.0 +/// isDelete : 0 +/// material : null +/// version : 0 +/// skuTickets : null +/// ticketStyle : "" + +class ProductSkuList { + ProductSkuList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + String skuCode, + String skuNameStr, + String productId, + String skuPrice, + String applyPrice, + String vipPrice, + String packagingFee, + dynamic skuImg, + num skuStock, + num autoRenewSkuStock, + num deliveries, + String ticketType, + dynamic ticketWipedTimeTemplateId, + dynamic takeType, + String ticketDays, + String ticketExpireTime, + num sort, + String setMeal, + dynamic productSetMeals, + num weight, + num volume, + num isDelete, + dynamic material, + num version, + dynamic skuTickets, + String ticketStyle,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _skuCode = skuCode; + _skuNameStr = skuNameStr; + _productId = productId; + _skuPrice = skuPrice; + _applyPrice = applyPrice; + _vipPrice = vipPrice; + _packagingFee = packagingFee; + _skuImg = skuImg; + _skuStock = skuStock; + _autoRenewSkuStock = autoRenewSkuStock; + _deliveries = deliveries; + _ticketType = ticketType; + _ticketWipedTimeTemplateId = ticketWipedTimeTemplateId; + _takeType = takeType; + _ticketDays = ticketDays; + _ticketExpireTime = ticketExpireTime; + _sort = sort; + _setMeal = setMeal; + _productSetMeals = productSetMeals; + _weight = weight; + _volume = volume; + _isDelete = isDelete; + _material = material; + _version = version; + _skuTickets = skuTickets; + _ticketStyle = ticketStyle; +} + + ProductSkuList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _skuCode = json['skuCode']; + _skuNameStr = json['skuNameStr']; + _productId = json['productId']; + _skuPrice = json['skuPrice']; + _applyPrice = json['applyPrice']; + _vipPrice = json['vipPrice']; + _packagingFee = json['packagingFee']; + _skuImg = json['skuImg']; + _skuStock = json['skuStock']; + _autoRenewSkuStock = json['autoRenewSkuStock']; + _deliveries = json['deliveries']; + _ticketType = json['ticketType']; + _ticketWipedTimeTemplateId = json['ticketWipedTimeTemplateId']; + _takeType = json['takeType']; + _ticketDays = json['ticketDays']; + _ticketExpireTime = json['ticketExpireTime']; + _sort = json['sort']; + _setMeal = json['setMeal']; + _productSetMeals = json['productSetMeals']; + _weight = json['weight']; + _volume = json['volume']; + _isDelete = json['isDelete']; + _material = json['material']; + _version = json['version']; + _skuTickets = json['skuTickets']; + _ticketStyle = json['ticketStyle']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _storeId; + String _skuCode; + String _skuNameStr; + String _productId; + String _skuPrice; + String _applyPrice; + String _vipPrice; + String _packagingFee; + dynamic _skuImg; + num _skuStock; + num _autoRenewSkuStock; + num _deliveries; + String _ticketType; + dynamic _ticketWipedTimeTemplateId; + dynamic _takeType; + String _ticketDays; + String _ticketExpireTime; + num _sort; + String _setMeal; + dynamic _productSetMeals; + num _weight; + num _volume; + num _isDelete; + dynamic _material; + num _version; + dynamic _skuTickets; + String _ticketStyle; +ProductSkuList copyWith({ String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + String skuCode, + String skuNameStr, + String productId, + String skuPrice, + String applyPrice, + String vipPrice, + String packagingFee, + dynamic skuImg, + num skuStock, + num autoRenewSkuStock, + num deliveries, + String ticketType, + dynamic ticketWipedTimeTemplateId, + dynamic takeType, + String ticketDays, + String ticketExpireTime, + num sort, + String setMeal, + dynamic productSetMeals, + num weight, + num volume, + num isDelete, + dynamic material, + num version, + dynamic skuTickets, + String ticketStyle, +}) => ProductSkuList( id: id ?? _id, + createTime: createTime ?? _createTime, + createUser: createUser ?? _createUser, + updateTime: updateTime ?? _updateTime, + updateUser: updateUser ?? _updateUser, + storeId: storeId ?? _storeId, + skuCode: skuCode ?? _skuCode, + skuNameStr: skuNameStr ?? _skuNameStr, + productId: productId ?? _productId, + skuPrice: skuPrice ?? _skuPrice, + applyPrice: applyPrice ?? _applyPrice, + vipPrice: vipPrice ?? _vipPrice, + packagingFee: packagingFee ?? _packagingFee, + skuImg: skuImg ?? _skuImg, + skuStock: skuStock ?? _skuStock, + autoRenewSkuStock: autoRenewSkuStock ?? _autoRenewSkuStock, + deliveries: deliveries ?? _deliveries, + ticketType: ticketType ?? _ticketType, + ticketWipedTimeTemplateId: ticketWipedTimeTemplateId ?? _ticketWipedTimeTemplateId, + takeType: takeType ?? _takeType, + ticketDays: ticketDays ?? _ticketDays, + ticketExpireTime: ticketExpireTime ?? _ticketExpireTime, + sort: sort ?? _sort, + setMeal: setMeal ?? _setMeal, + productSetMeals: productSetMeals ?? _productSetMeals, + weight: weight ?? _weight, + volume: volume ?? _volume, + isDelete: isDelete ?? _isDelete, + material: material ?? _material, + version: version ?? _version, + skuTickets: skuTickets ?? _skuTickets, + ticketStyle: ticketStyle ?? _ticketStyle, +); + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get storeId => _storeId; + String get skuCode => _skuCode; + String get skuNameStr => _skuNameStr; + String get productId => _productId; + String get skuPrice => _skuPrice; + String get applyPrice => _applyPrice; + String get vipPrice => _vipPrice; + String get packagingFee => _packagingFee; + dynamic get skuImg => _skuImg; + num get skuStock => _skuStock; + num get autoRenewSkuStock => _autoRenewSkuStock; + num get deliveries => _deliveries; + String get ticketType => _ticketType; + dynamic get ticketWipedTimeTemplateId => _ticketWipedTimeTemplateId; + dynamic get takeType => _takeType; + String get ticketDays => _ticketDays; + String get ticketExpireTime => _ticketExpireTime; + num get sort => _sort; + String get setMeal => _setMeal; + dynamic get productSetMeals => _productSetMeals; + num get weight => _weight; + num get volume => _volume; + num get isDelete => _isDelete; + dynamic get material => _material; + num get version => _version; + dynamic get skuTickets => _skuTickets; + String get ticketStyle => _ticketStyle; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['skuCode'] = _skuCode; + map['skuNameStr'] = _skuNameStr; + map['productId'] = _productId; + map['skuPrice'] = _skuPrice; + map['applyPrice'] = _applyPrice; + map['vipPrice'] = _vipPrice; + map['packagingFee'] = _packagingFee; + map['skuImg'] = _skuImg; + map['skuStock'] = _skuStock; + map['autoRenewSkuStock'] = _autoRenewSkuStock; + map['deliveries'] = _deliveries; + map['ticketType'] = _ticketType; + map['ticketWipedTimeTemplateId'] = _ticketWipedTimeTemplateId; + map['takeType'] = _takeType; + map['ticketDays'] = _ticketDays; + map['ticketExpireTime'] = _ticketExpireTime; + map['sort'] = _sort; + map['setMeal'] = _setMeal; + map['productSetMeals'] = _productSetMeals; + map['weight'] = _weight; + map['volume'] = _volume; + map['isDelete'] = _isDelete; + map['material'] = _material; + map['version'] = _version; + map['skuTickets'] = _skuTickets; + map['ticketStyle'] = _ticketStyle; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/store.dart b/lib/retrofit/data/store.dart index 1dd45b68..e94cc87a 100644 --- a/lib/retrofit/data/store.dart +++ b/lib/retrofit/data/store.dart @@ -1,8 +1,7 @@ - import 'package:huixiang/retrofit/data/coupon_vo.dart'; +import 'package:huixiang/retrofit/data/product_show.dart'; import 'package:huixiang/retrofit/data/store_type.dart'; - class Store { Store(); @@ -38,81 +37,94 @@ class Store { CouponVo couponVO; dynamic deliveryInfo; String businessType; + String businessService; + List productShow; StoreType posType; - factory Store.fromJson(Map json) => Store() - ..id = json['id'] as String - ..createTime = json['createTime'] as String - ..createUser = json['createUser'] as String - ..updateTime = json['updateTime'] as String - ..updateUser = json['updateUser'] as String - ..tenantCode = json['tenantCode'] as String - ..useErp = json['useErp'] as bool - ..openStartTime = json['openStartTime'] as String - ..openEndTime = json['openEndTime'] as String - ..perCapitaConsumption = json['perCapitaConsumption'] as String - ..storeName = json['storeName'] as String - ..distance = (json['distance'] as num)?.toDouble() - ..logo = json['logo'] as String - ..facade = json['facade'] as String - ..shipAddress = json['shipAddress'] as String - ..remark = json['remark'] - ..mobile = json['mobile'] as String - ..longitude = json['longitude'] as String - ..latitude = json['latitude'] as String - ..refundAddress = json['refundAddress'] - ..refundTel = json['refundTel'] - ..refundContact = json['refundContact'] - ..isAutoSendRefundAddress = json['isAutoSendRefundAddress'] as int - ..province = json['province'] as String - ..city = json['city'] as String - ..district = json['district'] as String - ..address = json['address'] as String - ..headName = json['headName'] as String - ..headMobile = json['headMobile'] as String - ..deliveryInfo = json['deliveryInfo'] - ..businessType = json['businessType'] as String - ..couponVO = json['couponVO'] == null ? null : CouponVo.fromJson(json['couponVO']) - ..posType = json['posType'] == null - ? null - : StoreType.fromJson(json['posType'] as Map); - - Map toJson() => { - 'id': this.id, - 'createTime': this.createTime, - 'createUser': this.createUser, - 'updateTime': this.updateTime, - 'updateUser': this.updateUser, - 'tenantCode': this.tenantCode, - 'useErp': this.useErp, - 'openStartTime': this.openStartTime, - 'openEndTime': this.openEndTime, - 'perCapitaConsumption': this.perCapitaConsumption, - 'storeName': this.storeName, - 'distance': this.distance, - 'logo': this.logo, - 'facade': this.facade, - 'shipAddress': this.shipAddress, - 'remark': this.remark, - 'mobile': this.mobile, - 'longitude': this.longitude, - 'latitude': this.latitude, - 'refundAddress': this.refundAddress, - 'refundTel': this.refundTel, - 'refundContact': this.refundContact, - 'isAutoSendRefundAddress': this.isAutoSendRefundAddress, - 'province': this.province, - 'city': this.city, - 'district': this.district, - 'address': this.address, - 'headName': this.headName, - 'headMobile': this.headMobile, - 'deliveryInfo': this.deliveryInfo, - 'businessType': this.businessType, - 'couponVO': this.couponVO != null ? this.couponVO.toJson() : null, - 'posType': this.posType, - }; + factory Store.fromJson(Map json) => + Store() + ..id = json['id'] as String + ..createTime = json['createTime'] as String + ..createUser = json['createUser'] as String + ..updateTime = json['updateTime'] as String + ..updateUser = json['updateUser'] as String + ..tenantCode = json['tenantCode'] as String + ..useErp = json['useErp'] as bool + ..openStartTime = json['openStartTime'] as String + ..openEndTime = json['openEndTime'] as String + ..perCapitaConsumption = json['perCapitaConsumption'] as String + ..storeName = json['storeName'] as String + ..distance = (json['distance'] as num)?.toDouble() + ..logo = json['logo'] as String + ..facade = json['facade'] as String + ..shipAddress = json['shipAddress'] as String + ..remark = json['remark'] + ..mobile = json['mobile'] as String + ..longitude = json['longitude'] as String + ..latitude = json['latitude'] as String + ..refundAddress = json['refundAddress'] + ..refundTel = json['refundTel'] + ..refundContact = json['refundContact'] + ..isAutoSendRefundAddress = json['isAutoSendRefundAddress'] as int + ..province = json['province'] as String + ..city = json['city'] as String + ..district = json['district'] as String + ..address = json['address'] as String + ..headName = json['headName'] as String + ..headMobile = json['headMobile'] as String + ..deliveryInfo = json['deliveryInfo'] + ..businessType = json['businessType'] as String + ..businessService = json['businessService'] as String + ..couponVO = json['couponVO'] == null ? null : CouponVo.fromJson( + json['couponVO']) + ..productShow = (json['productShow'] as List) + ?.map((e) => + e == null ? null : ProductShow.fromJson(e as Map)) + ?.toList() + ..posType = json['posType'] == null + ? null + : StoreType.fromJson(json['posType'] as Map); + Map toJson() => + { + 'id': this.id, + 'createTime': this.createTime, + 'createUser': this.createUser, + 'updateTime': this.updateTime, + 'updateUser': this.updateUser, + 'tenantCode': this.tenantCode, + 'useErp': this.useErp, + 'openStartTime': this.openStartTime, + 'openEndTime': this.openEndTime, + 'perCapitaConsumption': this.perCapitaConsumption, + 'storeName': this.storeName, + 'distance': this.distance, + 'logo': this.logo, + 'facade': this.facade, + 'shipAddress': this.shipAddress, + 'remark': this.remark, + 'mobile': this.mobile, + 'longitude': this.longitude, + 'latitude': this.latitude, + 'refundAddress': this.refundAddress, + 'refundTel': this.refundTel, + 'refundContact': this.refundContact, + 'isAutoSendRefundAddress': this.isAutoSendRefundAddress, + 'province': this.province, + 'city': this.city, + 'district': this.district, + 'address': this.address, + 'headName': this.headName, + 'headMobile': this.headMobile, + 'deliveryInfo': this.deliveryInfo, + 'businessType': this.businessType, + 'businessService': this.businessService, + 'couponVO': this.couponVO != null ? this.couponVO.toJson() : null, + 'productShow': this.productShow.map((e) => e.toJson()).toList(), + 'posType': this.posType, + }; } + + diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index ac89ea53..6415e490 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -26,7 +26,7 @@ import 'data/shopping_home_config.dart'; part 'min_api.g.dart'; -const localBaseUrl = "http://192.168.10.15:8765/app/";///本地 +const localBaseUrl = "http://app-api.test.yixinhuixiang.com/app/";///本地 // const localBaseUrl = "http://pos-test.api.lotus-wallet.com/app/";///测试 const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线上 @@ -49,7 +49,7 @@ abstract class MinApiService { headers["tenant"] = tenant; } if (storeId != null && storeId != "") { - headers["store_id"] = storeId; + headers["store-id"] = storeId; } headers["Environment"] = "app"; dio.options = BaseOptions( @@ -67,7 +67,7 @@ abstract class MinApiService { debugPrint("headers = ${options.headers}"); if (showLoading && !EasyLoading.isShow) { //是否显示loading - EasyLoading.show(status: S.of(context).zhengzaijiazai); + EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); } if (options.data is FormData) { debugPrint("params data = FormData"); diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 6fbd44d8..4a602f8e 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -67,17 +67,11 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -const localBaseUrl = "http://platform-api.test.yixinhuixiang.com/app/"; - -///本地 +const localBaseUrl = "http://platform-api.test.yixinhuixiang.com/app/";///本地 // const localBaseUrl = "http://platform.test.api.lotus-wallet.com/app/";///测试 -const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/"; - -///线上 - -const ipBaseUrl = "https://api.ooomn.com"; +const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线上 -///ip +const ipBaseUrl = "https://api.ooomn.com";///ip @RestApi(baseUrl: localBaseUrl) abstract class ApiService { @@ -110,7 +104,7 @@ abstract class ApiService { debugPrint("headers = ${options.headers}"); if (showLoading && !EasyLoading.isShow) { //是否显示loading - EasyLoading.show(status: S.of(context).zhengzaijiazai); + EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); } if (options.data is FormData) { debugPrint("params data = FormData"); diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 32506277..4e59be99 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -592,7 +592,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData>.fromJson( _result.data, - (json) => (json as List) + (json) => ((json??"") == "")?null:(json as List) .map((i) => Store.fromJson(i as Map)) .toList()); return value; diff --git a/lib/setting/account_security_page.dart b/lib/setting/account_security_page.dart index bb9e859d..50ee2cf4 100644 --- a/lib/setting/account_security_page.dart +++ b/lib/setting/account_security_page.dart @@ -26,7 +26,7 @@ class _AccountSecurityPage extends State { @override void initState() { super.initState(); - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); SharedPreferences.getInstance().then((value) => { apiService = ApiService(Dio(), context: context, token: value.getString("token"),), diff --git a/lib/setting/treaty_page.dart b/lib/setting/treaty_page.dart index a3c2ec26..cd44bac6 100644 --- a/lib/setting/treaty_page.dart +++ b/lib/setting/treaty_page.dart @@ -23,7 +23,7 @@ class _TreatyPage extends State { @override void initState() { super.initState(); - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); // if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView(); // if (Platform.isIOS) WebView.platform = CupertinoWebView(); } diff --git a/lib/setting/user_service_page.dart b/lib/setting/user_service_page.dart index 83e6e9d7..95c1316c 100644 --- a/lib/setting/user_service_page.dart +++ b/lib/setting/user_service_page.dart @@ -25,7 +25,7 @@ class _UserServicePage extends State with WidgetsBindingObserve void initState() { super.initState(); WidgetsBinding.instance.addObserver(this); - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView(); if (Platform.isIOS) WebView.platform = CupertinoWebView(); } diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index b68d529a..9aef543d 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -228,7 +228,7 @@ class _Settlement extends State { payChannel, tableId) async { try { - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); BaseData baseData = await minService.getOrderInfo({ "addressId": addressId, @@ -329,7 +329,7 @@ class _Settlement extends State { ///查看订单详情 queryOrderDetails(id) async { - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); BaseData baseData = await minService.getOrderDetails({ "id": pageType != null ? widget.arguments["orderId"] : id ?? parentId, }).catchError((error) {}); @@ -632,7 +632,7 @@ class _Settlement extends State { print("error: $error"); }); if (baseData != null && baseData.isSuccess) { - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); placeOrder = true; this.downOrder = DownOrder.fromJson(baseData.data); querySettlement(); diff --git a/lib/store/shop_details_page.dart b/lib/store/shop_details_page.dart index c2285615..51731ef2 100644 --- a/lib/store/shop_details_page.dart +++ b/lib/store/shop_details_page.dart @@ -94,7 +94,7 @@ class _ShopDetailsPage extends State { /// 查询店铺信息 queryStoreInfo() async { - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); SharedPreferences value = await SharedPreferences.getInstance(); if (apiService == null) apiService = ApiService( @@ -321,7 +321,7 @@ class _ShopDetailsPage extends State { ///选规格 _queryMiNiDetail(String id, int count) async { - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); if (count < 0) { shopCarGoods.shoppingCartSkuItemList.forEach((element) { if (element.productId == id) { diff --git a/lib/store/shopping/activity_prefecture_details.dart b/lib/store/shopping/activity_prefecture_details.dart index c3d645ed..743cb5af 100644 --- a/lib/store/shopping/activity_prefecture_details.dart +++ b/lib/store/shopping/activity_prefecture_details.dart @@ -95,7 +95,7 @@ class _ActivityPrefectureDetails extends State { /// 小程序登录 minLogin(SharedPreferences shared) async { - EasyLoading.show(status: S.of(context).zhengzaijiazai); + EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); apiService = ApiService( Dio(), context: context, diff --git a/lib/store/shopping/shopping_goods_details.dart b/lib/store/shopping/shopping_goods_details.dart index 970ef188..60e8fb5e 100644 --- a/lib/store/shopping/shopping_goods_details.dart +++ b/lib/store/shopping/shopping_goods_details.dart @@ -116,7 +116,7 @@ class _ShoppingGoodsDetails extends State { /// 小程序登录 minLogin(SharedPreferences shared) async { - EasyLoading.show(status: S.of(context).zhengzaijiazai); + EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); apiService = ApiService( Dio(), context: context, diff --git a/lib/store/shopping/shopping_mall_home.dart b/lib/store/shopping/shopping_mall_home.dart index b761fedf..0de56f71 100644 --- a/lib/store/shopping/shopping_mall_home.dart +++ b/lib/store/shopping/shopping_mall_home.dart @@ -55,7 +55,7 @@ class _ShoppingMallHome extends State /// 小程序登录 minLogin(SharedPreferences shared) async { - EasyLoading.show(status: S.of(context).zhengzaijiazai); + EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); apiService = ApiService( Dio(), context: context, diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index feb7a4fd..357649ce 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -97,7 +97,7 @@ class _StoreOrderPage extends State /// 小程序登录 minLogin(SharedPreferences shared) async { - EasyLoading.show(status: S.of(context).zhengzaijiazai); + EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); apiService = ApiService( Dio(), context: context, @@ -754,7 +754,7 @@ class _StoreOrderPage extends State ///选规格 _queryMiNiDetail(String id, int count) async { - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); if (count < 0) { shopCarGoods.shoppingCartSkuItemList.forEach((element) async { if (element.productId == id) { diff --git a/lib/store/store_view/product_sku.dart b/lib/store/store_view/product_sku.dart index 45144057..08902b3e 100644 --- a/lib/store/store_view/product_sku.dart +++ b/lib/store/store_view/product_sku.dart @@ -244,7 +244,7 @@ class _ProductSku extends State { false) == false) { _isTapEd = true; - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); await widget.reduce(widget.miNiDetail, selectSkus); } count -= 1; @@ -275,7 +275,7 @@ class _ProductSku extends State { false) == false) { _isTapEd = true; - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); if (count == 1 && realCount == 0) await widget.addShopCar( widget.miNiDetail, selectSkus, 2); diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index b00e8b0b..439610b0 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -2,11 +2,14 @@ import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; +import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart'; +import 'package:flutter_bmflocation/flutter_bmflocation.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/store.dart'; import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/utils/location.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; @@ -14,10 +17,12 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'package:shimmer/shimmer.dart'; import '../retrofit/data/base_data.dart'; +import '../retrofit/data/product_show.dart'; import '../retrofit/retrofit_api.dart'; import '../utils/flutter_utils.dart'; import '../view_widget/classic_header.dart'; import '../view_widget/no_data_view.dart'; +import '../view_widget/round_button.dart'; class UnionList extends StatefulWidget { final String serviceType; @@ -37,6 +42,7 @@ class UnionList extends StatefulWidget { class _UnionList extends State with AutomaticKeepAliveClientMixin { ApiService apiService; List storeList; + BMFCoordinate latLng; final RefreshController _refreshController = RefreshController(); @override @@ -84,7 +90,9 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { controller: _refreshController, enablePullDown: true, enablePullUp: false, - header: MyHeader(color: Colors.white,), + header: MyHeader( + color: Colors.white, + ), physics: BouncingScrollPhysics(), onRefresh: queryStore, child: (storeList == null || storeList.length == 0) @@ -182,6 +190,202 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { } Widget buildStoreItem(Store store, position) { + return Container( + margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 12.h), + padding: EdgeInsets.all(12.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(6)), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(25), + offset: Offset(0, 1), + blurRadius: 12, + spreadRadius: 0, + ) + ]), + width: double.infinity, + // height: 235.h, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + MImage( + store.facade, + width: 74, + height: 74, + fit: BoxFit.cover, + radius: BorderRadius.circular(6), + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + Container( + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(6), + bottomRight: Radius.circular(6), + topRight: Radius.circular(2), + bottomLeft: Radius.circular(2)), + ), + padding: EdgeInsets.symmetric(horizontal: 3.w, vertical: 2.h), + child: Text( + "品牌", + style: TextStyle( + color: Colors.white, + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ) + ], + ), + SizedBox( + width: 12.w, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + store?.storeName ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 14.sp, + fontWeight: MyFontWeight.bold, + ), + ), + SizedBox(height: 6.h), + Row( + children: [ + Text( + S.of(context).ren( + store?.perCapitaConsumption ?? "", + ), + style: TextStyle( + color: Color(0xFF4D4D4D), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + SizedBox(width: 22.w), + Image.asset( + "assets/image/icon_union_location_black.webp", + fit: BoxFit.fill, + height: 12, + width: 12, + ), + SizedBox(width: 4.w), + Text( + (store.distance ?? 0) > 1000 + ? S.of(context).gongli( + ((store.distance ?? 0) / 1000 * 100).toInt() / + 100.0) + : S + .of(context) + .mi(((store.distance ?? 0) * 100).toInt() / 100.0), + style: TextStyle( + color: Color(0xFF4D4D4D), + fontSize: 12.sp, + ), + ), + ], + ), + SizedBox(height: 10.h), + Row( + children: []..addAll( + itemServer(store != null ? store.businessService : "")), + ), + SizedBox(height: store.businessService == ""?40.h:23.h), + if(storeList[position].productShow != null) + Container( + height: 100.h, + child: ListView.builder( + padding: EdgeInsets.zero, + itemCount: (storeList[position].productShow?.length ??0) > 3 ?3:storeList[position].productShow?.length ?? 0, + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, index) { + return GestureDetector( + onTap: () {}, + child: unionGoodsItem( + storeList[position].productShow[index]), + ); + }, + ), + ), + ], + )) + ], + ), + ); + } + + ///标签 + List itemServer(String businessService) { + if (businessService == null || businessService == "") return []; + var list = businessService.split(","); + return list + .map((e) => Container( + margin: EdgeInsets.only(right: 8.w), + child: Container( + decoration: BoxDecoration( + color: Color(0xFFF65720), + borderRadius: BorderRadius.circular(1), + ), + padding: EdgeInsets.all(2), + margin: EdgeInsets.only(right: 10.w), + child: Text( + "$e", + style: TextStyle( + color: Colors.white, + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ), + )) + .toList(); + } + + /// + Widget unionGoodsItem(ProductShow productShow) { + return Container( + width: 74.w, + margin: EdgeInsets.only(right: 8.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MImage( + productShow?.imgs[0] ?? "", + width: 74, + height: 74, + fit: BoxFit.cover, + radius: BorderRadius.circular(4), + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + Padding(padding:EdgeInsets.only(top: 8.h), + child: Text( + productShow?.productName ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFFA29E9E), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ),), + ], + ), + ); + } + + //旧ui + Widget buildStoreItems(Store store, position) { return Container( margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 12.h), decoration: BoxDecoration( diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 5d80f3cb..edb2ae17 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -15,6 +15,7 @@ import 'package:huixiang/union/union_list.dart'; import 'package:huixiang/utils/event_type.dart'; import 'package:huixiang/utils/location.dart'; import 'package:huixiang/view_widget/my_tab.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -54,8 +55,13 @@ class UnionPageState extends State super.dispose(); WidgetsBinding.instance.removeObserver(this); if (Location.getInstance() != null && - Location.getInstance().aMapFlutterLocation != null) - Location.getInstance().aMapFlutterLocation.stopLocation(); + Location + .getInstance() + .aMapFlutterLocation != null) + Location + .getInstance() + .aMapFlutterLocation + .stopLocation(); } @override @@ -63,8 +69,14 @@ class UnionPageState extends State super.didChangeMetrics(); WidgetsBinding.instance.addPostFrameCallback((_) { setState(() { - print("object: ${MediaQuery.of(context).viewInsets.bottom}"); - if (MediaQuery.of(context).viewInsets.bottom == 0) { + print("object: ${MediaQuery + .of(context) + .viewInsets + .bottom}"); + if (MediaQuery + .of(context) + .viewInsets + .bottom == 0) { if (isKeyBoardShow) { isKeyBoardShow = false; //关闭键盘 软键盘关闭了, 清除输入控件的焦点, 否则重新进入页面会导致软键盘再弹出问题 @@ -92,25 +104,37 @@ class UnionPageState extends State } startLocation() async { - Location.getInstance().startLocation(context, (BaiduLocation result) async { - if (result != null && - result.latitude != null && - result.longitude != null) { - print("location: $result"); - latLng = BMFCoordinate(result.latitude, result.longitude); - latLng = await BMFCalculateUtils.coordConvert( - coordinate: latLng, - fromType: BMF_COORD_TYPE.BD09LL, - toType: BMF_COORD_TYPE.COMMON); - await saveLatLng(latLng, result.province, result.city, result.district); - print("union: Location result ${latLng.latitude} " - "${latLng.longitude}"); - Location.getInstance().stopLocation(); - } else { - await getLatLng(); - } - loadFinish(showLoading: false); - }); + bool powerFlag = false; + try { + powerFlag = await Location.getInstance().startLocation(context, + (BaiduLocation result) async { + if (result != null && + result.latitude != null && + result.longitude != null) { + print("location: $result"); + latLng = BMFCoordinate(result.latitude, result.longitude); + latLng = await BMFCalculateUtils.coordConvert( + coordinate: latLng, + fromType: BMF_COORD_TYPE.BD09LL, + toType: BMF_COORD_TYPE.COMMON); + await saveLatLng( + latLng, result.province, result.city, result.district); + print("union: Location result ${latLng.latitude} " + "${latLng.longitude}"); + Location.getInstance().stopLocation(); + } else { + await getLatLng(); + } + loadFinish(showLoading: false); + }); + } finally { + if (!powerFlag) { + if (await Permission.locationWhenInUse.status.isGranted) { + startLocation(); + } else + loadFinish(showLoading: false); + } + } } saveLatLng(BMFCoordinate latLng, province, city, district) async { @@ -135,7 +159,7 @@ class UnionPageState extends State } queryIpInfo() async { - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); ApiService apiIpService = ApiService(Dio(), context: context, isIp: true); IpData baseData = await apiIpService.getIpInfo().catchError((onError) {}); if (baseData != null) { @@ -145,7 +169,7 @@ class UnionPageState extends State } loadFinish({bool showLoading = true}) { - if (showLoading) EasyLoading.show(status: S.current.zhengzaijiazai); + if (showLoading) EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); _allKey = [GlobalKey(), GlobalKey(), GlobalKey(), GlobalKey()]; setState(() {}); } @@ -221,10 +245,18 @@ class UnionPageState extends State indicatorSize: TabBarIndicatorSize.label, //指示器与文字等宽 tabs: [ - MyTab(text: S.of(context).quanbu), - MyTab(text: S.of(context).chi), - MyTab(text: S.of(context).he), - MyTab(text: S.of(context).wan), + MyTab(text: S + .of(context) + .quanbu), + MyTab(text: S + .of(context) + .chi), + MyTab(text: S + .of(context) + .he), + MyTab(text: S + .of(context) + .wan), ], ), ), @@ -254,7 +286,10 @@ class UnionPageState extends State ], ), padding: - EdgeInsets.only(top: MediaQuery.of(context).padding.top + 17.h), + EdgeInsets.only(top: MediaQuery + .of(context) + .padding + .top + 17.h), decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, diff --git a/lib/view_widget/channel_dialog.dart b/lib/view_widget/channel_dialog.dart index 9e133439..9b235dd9 100644 --- a/lib/view_widget/channel_dialog.dart +++ b/lib/view_widget/channel_dialog.dart @@ -28,7 +28,7 @@ class _ChannelDialog extends State { @override void initState() { super.initState(); - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); queryChannels(); } diff --git a/lib/vip/user_vip_service_page.dart b/lib/vip/user_vip_service_page.dart index 29a2d908..038ec2d9 100644 --- a/lib/vip/user_vip_service_page.dart +++ b/lib/vip/user_vip_service_page.dart @@ -25,7 +25,7 @@ class _UserVipServicePage extends State with WidgetsBindingO void initState() { super.initState(); WidgetsBinding.instance.addObserver(this); - EasyLoading.show(status: S.current.zhengzaijiazai); + EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView(); if (Platform.isIOS) WebView.platform = CupertinoWebView(); } From 4b25a338589660c2743b14e7edc7541e05ec6517 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Thu, 24 Aug 2023 11:31:48 +0800 Subject: [PATCH 12/35] =?UTF-8?q?=E8=81=94=E7=9B=9F=EF=BC=9A=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=E6=9B=BE=E6=98=AF=E9=80=89=E6=8B=A9=E8=8C=83=E5=9B=B4?= =?UTF-8?q?=EF=BC=8C=E6=9A=82=E5=AE=9A=EF=BC=88=E6=AD=A6=E6=B1=89=EF=BC=8C?= =?UTF-8?q?=E5=8C=97=E4=BA=AC=EF=BC=8C=E9=83=91=E5=B7=9E=EF=BC=89=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/map_style/chinese_cities.json | 472 +-------------------------- 1 file changed, 5 insertions(+), 467 deletions(-) diff --git a/assets/map_style/chinese_cities.json b/assets/map_style/chinese_cities.json index e9742bde..b2a647be 100644 --- a/assets/map_style/chinese_cities.json +++ b/assets/map_style/chinese_cities.json @@ -1,476 +1,14 @@ { "热门城市": [ - {"area": "上海"}, - {"area": "深圳"}, - {"area": "北京"}, - {"area": "广州"}, - {"area": "成都"}, - {"area": "杭州"}, {"area": "武汉"}, - {"area": "重庆"} - ], - "A": [ - { "area": "阿坝" }, - { "area": "阿克苏" }, - { "area": "阿拉善" }, - { "area": "阿勒泰" }, - { "area": "阿里" }, - { "area": "安庆" }, - { "area": "鞍山" }, - { "area": "安顺" }, - { "area": "安阳" }, - { "area": "澳门" } + {"area": "北京"}, + { "area": "郑州" } ], "B": [ - { "area": "北京" }, - { "area": "白银" }, - { "area": "保定" }, - { "area": "宝鸡" }, - { "area": "保山" }, - { "area": "包头" }, - { "area": "巴彦淖尔" }, - { "area": "巴音郭楞" }, - { "area": "巴中" }, - { "area": "北海" }, - { "area": "蚌埠" }, - { "area": "本溪" }, - { "area": "毕节" }, - { "area": "滨州" }, - { "area": "百色" } - ], - "C": [ - { "area": "重庆" }, - { "area": "成都" }, - { "area": "长春" }, - { "area": "常德" }, - { "area": "昌都" }, - { "area": "长沙" }, - { "area": "长治" }, - { "area": "常州" }, - { "area": "巢湖" }, - { "area": "朝阳" }, - { "area": "潮州" }, - { "area": "承德" }, - { "area": "郴州" }, - { "area": "赤峰" }, - { "area": "池州" }, - { "area": "崇左" }, - { "area": "楚雄" }, - { "area": "滁州" } - ], - "D": [ - { "area": "大理" }, - { "area": "大连" }, - { "area": "丹东" }, - { "area": "大庆" }, - { "area": "大同" }, - { "area": "大兴安岭" }, - { "area": "达州" }, - { "area": "德宏" }, - { "area": "德阳" }, - { "area": "德州" }, - { "area": "迪庆" }, - { "area": "定西" }, - { "area": "东莞" }, - { "area": "东营" } - ], - "E": [ - { "area": "鄂尔多斯" }, - { "area": "恩施" }, - { "area": "鄂州" } - ], - "F": [ - { "area": "防城港" }, - { "area": "佛山" }, - { "area": "抚顺" }, - { "area": "阜新" }, - { "area": "阜阳" }, - { "area": "福州" }, - { "area": "抚州" } - ], - "G": [ - { "area": "广元" }, - { "area": "广安" }, - { "area": "广州" }, - { "area": "贵港" }, - { "area": "桂林" }, - { "area": "贵阳" }, - { "area": "甘南" }, - { "area": "甘孜" }, - { "area": "赣州" }, - { "area": "固原" }, - { "area": "果洛" } - ], - "H": [ - { "area": "哈尔滨" }, - { "area": "海口" }, - { "area": "海北" }, - { "area": "海东" }, - { "area": "海南" }, - { "area": "海西" }, - { "area": "邯郸" }, - { "area": "杭州" }, - { "area": "汉中" }, - { "area": "鹤壁" }, - { "area": "河池" }, - { "area": "合肥" }, - { "area": "鹤岗" }, - { "area": "黑河" }, - { "area": "衡水" }, - { "area": "衡阳" }, - { "area": "河源" }, - { "area": "菏泽" }, - { "area": "贺州" }, - { "area": "红河" }, - { "area": "淮安" }, - { "area": "淮北" }, - { "area": "怀化" }, - { "area": "淮南" }, - { "area": "黄冈" }, - { "area": "黄南" }, - { "area": "黄山" }, - { "area": "黄石" }, - { "area": "呼和浩特" }, - { "area": "葫芦岛" }, - { "area": "呼伦贝尔" }, - { "area": "湖州" }, - { "area": "惠州" }, - { "area": "蚌埠" } - ], - "J": [ - { "area": "佳木斯" }, - { "area": "吉安" }, - { "area": "江门" }, - { "area": "焦作" }, - { "area": "嘉兴" }, - { "area": "嘉峪关" }, - { "area": "揭阳" }, - { "area": "吉林" }, - { "area": "济南" }, - { "area": "金昌" }, - { "area": "晋城" }, - { "area": "景德镇" }, - { "area": "荆门" }, - { "area": "荆州" }, - { "area": "金华" }, - { "area": "济宁" }, - { "area": "晋中" }, - { "area": "锦州" }, - { "area": "九江" }, - { "area": "酒泉" } - ], - "K": [ - { "area": "昆明" }, - { "area": "开封" }, - { "area": "喀什" }, - { "area": "克拉玛依" }, - { "area": "克孜勒苏" }, - { "area": "来宾" }, - { "area": "莱芜" }, - { "area": "廊坊" }, - { "area": "拉萨" }, - { "area": "乐山" }, - { "area": "凉山" }, - { "area": "连云港" }, - { "area": "聊城" }, - { "area": "辽阳" }, - { "area": "辽源" }, - { "area": "丽江" }, - { "area": "临沧" }, - { "area": "临汾" }, - { "area": "临夏" }, - { "area": "临沂" }, - { "area": "林芝" }, - { "area": "丽水" }, - { "area": "六安" }, - { "area": "六盘水" }, - { "area": "陇南" }, - { "area": "龙岩" }, - { "area": "娄底" }, - { "area": "漯河" }, - { "area": "洛阳" }, - { "area": "泸州" } - ], - "L": [ - { "area": "吕梁" }, - { "area": "来宾" }, - { "area": "莱芜" }, - { "area": "廊坊" }, - { "area": "拉萨" }, - { "area": "乐山" }, - { "area": "凉山" }, - { "area": "连云港" }, - { "area": "聊城" }, - { "area": "辽阳" }, - { "area": "辽源" }, - { "area": "丽江" }, - { "area": "临沧" }, - { "area": "临汾" }, - { "area": "临夏" }, - { "area": "临沂" }, - { "area": "林芝" }, - { "area": "丽水" }, - { "area": "六安" }, - { "area": "六盘水" }, - { "area": "陇南" }, - { "area": "龙岩" }, - { "area": "娄底" }, - { "area": "漯河" }, - { "area": "洛阳" }, - { "area": "泸州" } - ], - "M": [ - { "area": "马鞍山" }, - { "area": "茂名" }, - { "area": "眉山" }, - { "area": "梅州" }, - { "area": "绵阳" }, - { "area": "牡丹江" } - ], - "N": [ - { "area": "南京" }, - { "area": "南昌" }, - { "area": "南宁" }, - { "area": "南充" }, - { "area": "南平" }, - { "area": "南通" }, - { "area": "南阳" }, - { "area": "那曲" }, - { "area": "内江" }, - { "area": "宁德" }, - { "area": "怒江" } - ], - "P": [ - { "area": "攀枝花" }, - { "area": "盘锦" }, - { "area": "平顶山" }, - { "area": "平凉" }, - { "area": "萍乡" }, - { "area": "普洱" }, - { "area": "莆田" }, - { "area": "濮阳" } - ], - "Q": [ - { "area": "黔东南" }, - { "area": "黔南" }, - { "area": "黔西南" }, - { "area": "青岛" }, - { "area": "庆阳" }, - { "area": "清远" }, - { "area": "秦皇岛" }, - { "area": "钦州" }, - { "area": "齐齐哈尔" }, - { "area": "七台河" }, - { "area": "泉州" }, - { "area": "曲靖" }, - { "area": "衢州" } - ], - "R": [ - { "area": "日喀则" }, - { "area": "日照" } - ], - "S": [ - { "area": "上海" }, - { "area": "深圳" }, - { "area": "苏州" }, - { "area": "三门峡" }, - { "area": "三明" }, - { "area": "三亚" }, - { "area": "商洛" }, - { "area": "商丘" }, - { "area": "上饶" }, - { "area": "山南" }, - { "area": "汕头" }, - { "area": "汕尾" }, - { "area": "韶关" }, - { "area": "绍兴" }, - { "area": "邵阳" }, - { "area": "十堰" }, - { "area": "朔州" }, - { "area": "四平" }, - { "area": "松原" }, - { "area": "绥化" }, - { "area": "遂宁" }, - { "area": "随州" }, - { "area": "宿迁" }, - { "area": "宿州" } - ], - "T": [ - { "area": "天津" }, - { "area": "塔城" }, - { "area": "泰安" }, - { "area": "太原" }, - { "area": "台州" }, - { "area": "泰州" }, - { "area": "唐山" }, - { "area": "天水" }, - { "area": "铁岭" }, - { "area": "铜川" }, - { "area": "通化" }, - { "area": "通辽" }, - { "area": "铜陵" }, - { "area": "铜仁" }, - { "area": "台湾" }, - { "area": "吐鲁番" } - ], - "W": [ - { "area": "武汉" }, - { "area": "乌鲁木齐" }, - { "area": "无锡" }, - { "area": "威海" }, - { "area": "潍坊" }, - { "area": "文山" }, - { "area": "温州" }, - { "area": "乌海" }, - { "area": "芜湖" }, - { "area": "乌兰察布" }, - { "area": "武威" }, - { "area": "梧州" } - ], - "X": [ - { "area": "厦门" }, - { "area": "西安" }, - { "area": "湘潭" }, - { "area": "湘西" }, - { "area": "襄阳" }, - { "area": "咸宁" }, - { "area": "咸阳" }, - { "area": "孝感" }, - { "area": "邢台" }, - { "area": "西宁" }, - { "area": "新乡" }, - { "area": "信阳" }, - { "area": "新余" }, - { "area": "忻州" }, - { "area": "西双版纳" }, - { "area": "宣城" }, - { "area": "许昌" }, - { "area": "徐州" } - ], - "Y": [ - { "area": "雅安" }, - { "area": "延安" }, - { "area": "延边" }, - { "area": "盐城" }, - { "area": "阳江" }, - { "area": "阳泉" }, - { "area": "扬州" }, - { "area": "烟台" }, - { "area": "宜宾" }, - { "area": "宜昌" }, - { "area": "伊春" }, - { "area": "宜春" }, - { "area": "伊犁" }, - { "area": "银川" }, - { "area": "营口" }, - { "area": "鹰潭" }, - { "area": "益阳" }, - { "area": "永州" }, - { "area": "岳阳" }, - { "area": "玉林" }, - { "area": "榆林" }, - { "area": "运城" }, - { "area": "云浮" }, - { "area": "玉树" }, - { "area": "玉溪" } + { "area": "北京" } ], + "W": [{ "area": "武汉" }], "Z": [ - { "area": "杂多县" }, - { "area": "赞皇县" }, - { "area": "枣强县" }, - { "area": "枣阳市" }, - { "area": "枣庄" }, - { "area": "泽库县" }, - { "area": "增城市" }, - { "area": "曾都区" }, - { "area": "泽普县" }, - { "area": "泽州县" }, - { "area": "札达县" }, - { "area": "扎赉特旗" }, - { "area": "扎兰屯市" }, - { "area": "扎鲁特旗" }, - { "area": "扎囊县" }, - { "area": "张北县" }, - { "area": "张家港市" }, - { "area": "张家界" }, - { "area": "张家口" }, - { "area": "漳平市" }, - { "area": "漳州" }, - { "area": "章丘市" }, - { "area": "彰化县" }, - { "area": "张掖" }, - { "area": "漳浦县" }, - { "area": "章贡区" }, - { "area": "樟树市" }, - { "area": "长子县" }, - { "area": "湛江" }, - { "area": "诏安县" }, - { "area": "召陵区" }, - { "area": "昭平县" }, - { "area": "肇庆" }, - { "area": "昭通" }, - { "area": "赵县" }, - { "area": "昭阳区" }, - { "area": "招远市" }, - { "area": "正安县" }, - { "area": "正定县" }, - { "area": "正蓝旗" }, - { "area": "正宁县" }, - { "area": "蒸湘区" }, - { "area": "政和县" }, - { "area": "柘城县" }, - { "area": "正镶白旗" }, - { "area": "正阳县" }, - { "area": "郑州" }, - { "area": "镇安县" }, - { "area": "镇巴县" }, - { "area": "镇海区" }, - { "area": "镇江" }, - { "area": "镇康县" }, - { "area": "镇宁布依族苗族自治县" }, - { "area": "镇平县" }, - { "area": "镇坪县" }, - { "area": "镇雄县" }, - { "area": "镇原县" }, - { "area": "浈江区" }, - { "area": "志丹县" }, - { "area": "治多县" }, - { "area": "芷江侗族自治县" }, - { "area": "织金县" }, - { "area": "中江县" }, - { "area": "中牟县" }, - { "area": "中宁县" }, - { "area": "中山" }, - { "area": "中卫" }, - { "area": "钟祥市" }, - { "area": "中阳县" }, - { "area": "周宁县" }, - { "area": "周至县" }, - { "area": "庄河市" }, - { "area": "诸城市" }, - { "area": "驻马店" }, - { "area": "准格尔旗" }, - { "area": "涿鹿县" }, - { "area": "卓尼" }, - { "area": "涿州市" }, - { "area": "卓资县" }, - { "area": "珠海" }, - { "area": "珠晖区" }, - { "area": "株洲" }, - { "area": "株洲县" }, - { "area": "诸暨市" }, - { "area": "驻马店" }, - { "area": "庄河市" }, - { "area": "诸城市" }, - { "area": "准格尔旗" }, - { "area": "涿鹿县" }, - { "area": "卓尼" }, - { "area": "涿州市" }, - { "area": "卓资县" }, - { "area": "珠海" }, - { "area": "珠晖区" }, - { "area": "株洲" }, - { "area": "株洲县" }, - { "area": "诸暨市" } + { "area": "郑州" } ] } \ No newline at end of file From b2d180cb0a111eece373ad667516259755f7d5a2 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Sat, 26 Aug 2023 16:39:07 +0800 Subject: [PATCH 13/35] =?UTF-8?q?=E9=A6=96=E9=A1=B5=EF=BC=8C=E7=A7=AF?= =?UTF-8?q?=E5=88=86=EF=BC=8C=E6=88=91=E7=9A=84=E6=88=90=E5=B0=B1=EF=BC=8C?= =?UTF-8?q?=E6=88=91=E7=9A=84=E9=A1=B5=E9=9D=A2-=E5=85=B6=E4=BB=96?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E5=91=98=E5=8D=A1=E5=88=97=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E5=BA=97=E9=93=BA=E5=85=85=E5=80=BC=EF=BC=8C=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=8C=E5=85=85=E5=80=BC=EF=BC=8C=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E5=88=97=E8=A1=A8=EF=BC=8C=E7=A6=8F=E5=88=A9=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E7=AD=89=E6=9D=BF=E5=9D=97=EF=BC=8C=E6=95=B4=E4=BD=93?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9B=B4=E6=94=B9=EF=BC=9B=20=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E5=85=85=E5=80=BC=EF=BC=9A=E5=BA=97=E9=93=BA=E5=85=85?= =?UTF-8?q?=E5=80=BC=E5=88=97=E8=A1=A8=EF=BC=8C=E5=BA=97=E9=93=BA=E5=85=85?= =?UTF-8?q?=E5=80=BC=E6=8E=A5=E5=8F=A3=E9=83=BD=E6=94=B9=E4=B8=BA=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E6=8E=A5=E5=8F=A3=EF=BC=9B=EF=BC=88=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=BE=AE=E4=BF=A1=E6=94=AF=E4=BB=98=E5=AE=9D=EF=BC=89?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=E5=BA=97=E9=93=BA=E5=85=85=E5=80=BC?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AE=9E=E4=BD=93=E7=B1=BB=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/home/home_page.dart | 181 +++- lib/home/welfare_page.dart | 774 +++++++-------- lib/integral/integral_page.dart | 46 +- lib/integral/intergra_view/integral_task.dart | 56 +- lib/mine/mine_shop_page.dart | 41 +- lib/mine/mine_shop_recharge.dart | 624 ++++++++---- lib/mine/mine_view/mine_item.dart | 71 +- lib/mine/mine_vip/mine_attainment_page.dart | 326 ++++--- lib/mine/recharge_page.dart | 906 +++++++++--------- lib/order/order_history_page.dart | 354 ++++--- lib/retrofit/data/member_recharge_list.dart | 159 +++ lib/retrofit/min_api.dart | 10 + lib/retrofit/min_api.g.dart | 45 + lib/retrofit/retrofit_api.dart | 14 +- lib/retrofit/retrofit_api.g.dart | 4 +- lib/store/store_view/shop_goods.dart | 12 +- lib/union/union_list.dart | 65 +- lib/view_widget/my_appbar.dart | 3 +- lib/view_widget/recharge_details_dialog.dart | 8 - 19 files changed, 2187 insertions(+), 1512 deletions(-) create mode 100644 lib/retrofit/data/member_recharge_list.dart diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index f4b816fc..c6bf0ad8 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -40,6 +40,7 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../retrofit/data/user_info.dart'; +import '../utils/flutter_utils.dart'; import '../view_widget/channel_dialog.dart'; import '../view_widget/custom_image.dart'; import 'home_view/happy_help_farmers.dart'; @@ -76,6 +77,7 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { List goods = []; List gooodsCategorys = []; List bannerData = []; + List activityBannerData = []; List brandData = []; List
articles = []; Founder founder; @@ -87,6 +89,7 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { UserInfo userInfo; dynamic mRaiseMoney = 0; //众筹金余额 int _loadCount = 0; + DioErrorType dioErrorType; @override void initState() { @@ -160,7 +163,9 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { try { BaseData> baseData = await apiService.queryBanner({ "model": {"type": "HOME_PAGE"}, - }).catchError((onError) {}); + }).catchError((onError) { + dioErrorType = onError.type; + }); if (baseData != null && baseData.isSuccess) { bannerData = baseData.data.records; // if (bannerData.length > 0) swiperController.move(0, animation: false); @@ -170,12 +175,32 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { } } + ///宣传banner + queryActivityBanner() async { + try { + BaseData> baseData = await apiService.queryBanner({ + "model": {"type": "HOME_STORE_PAGE"}, + }).catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + activityBannerData = baseData.data.records; + } + } finally { + addLoadCount(); + } + } + addLoadCount() { _loadCount += 1; - if (_loadCount == 6) { + if (_loadCount == 7) { _loadCount = 0; EasyLoading.dismiss(); - if (refreshController.isRefresh) refreshController.refreshCompleted(); + if (dioErrorType == null) + refreshController.refreshCompleted(); + else { + SmartDialog.showToast(AppUtils.dioErrorTypeToString(dioErrorType), + alignment: Alignment.center); + refreshController.refreshFailed(); + } if (mounted) setState(() {}); } } @@ -240,11 +265,11 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { goods = pageGoods.data.list; } } finally { - if(isRefresh) - addLoadCount(); + if (isRefresh) + addLoadCount(); else { EasyLoading.dismiss(); - setState((){}); + setState(() {}); } } } @@ -334,8 +359,10 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { token: value.getString("token"), ); } + dioErrorType = null; if (isFirstIn) queryActivity(); queryBanner(); + queryActivityBanner(); queryRecommendRank(); queryGoodsCategory(); queryPointsProductList(true); @@ -627,50 +654,118 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { Widget spread() { return Container( width: double.infinity, + // margin: EdgeInsets.symmetric(horizontal:14.w), height: 85.h, - child: Swiper( - pagination: SwiperPagination( - alignment: Alignment.bottomCenter, - margin: EdgeInsets.only(top: 5.h), - builder: DotSwiperPaginationBuilder( - size: 8.w, - activeSize: 8.w, - space: 5.w, - activeColor: Colors.white, - color: Colors.white.withAlpha(76), - ), - ), - autoplay: true, - duration: 1000, - autoplayDelay: 2000, - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - if (position == 0) { - Navigator.of(context).pushNamed('/router/invite_friends'); - } else if (position == 1) { - Navigator.of(context).pushNamed('/router/trading_card_page'); - } - }, - child: Container( - margin: EdgeInsets.symmetric(horizontal: 14.w), - child: ClipRRect( - child: Image.asset( - spreadItem[position], - width: double.infinity, - fit: BoxFit.fill, - height: double.infinity, + child: bannerData != null && bannerData.isNotEmpty + ? Swiper( + pagination: SwiperPagination( + alignment: Alignment.bottomCenter, + margin: EdgeInsets.only(top: 5.h), + builder: DotSwiperPaginationBuilder( + size: 8.w, + activeSize: 8.w, + space: 5.w, + activeColor: Colors.white, + color: Colors.white.withAlpha(76), ), - borderRadius: BorderRadius.circular(6.w), ), + autoplay: true, + duration: 1000, + autoplayDelay: 2000, + itemBuilder: (context, position) { + return InkWell( + onTap: () { + spreadBannerClick(activityBannerData[position]); + }, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 14.w), + child: MImage( + activityBannerData[position].imgUrl, + fit: BoxFit.cover, + radius: BorderRadius.circular(6), + errorSrc: "assets/image/default_2_1.webp", + fadeSrc: "assets/image/default_2_1.webp", + ), + ), + ); + // GestureDetector( + // onTap: () { + // if (position == 0) { + // Navigator.of(context).pushNamed('/router/invite_friends'); + // } else if (position == 1) { + // Navigator.of(context).pushNamed('/router/trading_card_page'); + // } + // }, + // child: Container( + // margin: EdgeInsets.symmetric(horizontal: 14.w), + // child: ClipRRect( + // child: Image.asset( + // spreadItem[position], + // width: double.infinity, + // fit: BoxFit.fill, + // height: double.infinity, + // ), + // borderRadius: BorderRadius.circular(6.w), + // ), + // ), + // ); + }, + itemCount: activityBannerData.length, + ) + : Image.asset( + "assets/image/default_2_1.webp", + fit: BoxFit.cover, ), - ); - }, - itemCount: 2, - ), ); } + /// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程,7:门店跳转) + spreadBannerClick(BannerData activityBannerData) async { + switch (activityBannerData.contentType) { + case 1: + Navigator.of(context).pushNamed('/router/integral_store_page', + arguments: {"goodsId": activityBannerData.content}); + break; + case 2: + Navigator.of(context).pushNamed('/router/web_page', arguments: { + "activityId": activityBannerData.content, + }); + break; + case 3: + Navigator.of(context).pushNamed('/router/web_page', arguments: { + "articleId": activityBannerData.content, + }); + break; + case 4: + String router = activityBannerData.content; + // String router = "/router/store_order?{\"id\":\"1512378184161558528\",\"tenant\":\"1188\",\"storeName\":\"农场煮意\"}"; + if (router.contains("?")) { + String params = router.substring(router.indexOf("?") + 1); + Map map = jsonDecode(params); + Navigator.of(context).pushNamed( + router.substring(0, router.indexOf("?")), + arguments: map); + } else { + Navigator.of(context).pushNamed(router); + } + break; + case 5: + Navigator.of(context).pushNamed('/router/class_details', arguments: { + "id": activityBannerData.content, + }); + break; + case 7: + String params = activityBannerData.content + .substring(activityBannerData.content.indexOf("?") + 1); + Map map = jsonDecode(params); + Navigator.of(context).pushNamed( + activityBannerData.content + .substring(0, activityBannerData.content.indexOf("?")), + arguments: map); + break; + } + } + final List spreadItem = [ "assets/image/welfare_spread.webp", "assets/image/welfare_yz.webp", diff --git a/lib/home/welfare_page.dart b/lib/home/welfare_page.dart index 902a9511..a6cb8fdf 100644 --- a/lib/home/welfare_page.dart +++ b/lib/home/welfare_page.dart @@ -39,69 +39,48 @@ class _WelfarePage extends State { List goods = []; Goods goodsPrice; List coupons = []; - List> coupon=[]; + List> coupon = []; String categoryId; bool orderDesc = true; int orderType = 1; int type = 1; int couponIndex = 0; int swiperIndex = 0; + int _loadCount = 0; @override void initState() { super.initState(); - SharedPreferences.getInstance().then((value) => { - apiService = ApiService(Dio(), context: context, token: value.getString("token")), - _onRefresh(), - - }); + _onRefresh(); } queryGoods() async { - if (apiService == null) { - SharedPreferences value = await SharedPreferences.getInstance(); - apiService = ApiService( - Dio(), - context: context, - token: value.getString("token"), - ); - } - var param = { - "categoryId": categoryId ?? "", - "orderDesc": orderDesc, - "orderType": orderType, - "pageNum": 1, - "pageSize": 100, - "state": 1 - }; - BaseData> pageGoods = - await apiService.creditGoods(param).catchError((onError) { - refreshController.loadFailed(); - refreshController.refreshFailed(); - }); - EasyLoading.dismiss(); - if (pageGoods != null && pageGoods.isSuccess) { - setState(() { + try { + var param = { + "categoryId": categoryId ?? "", + "orderDesc": orderDesc, + "orderType": orderType, + "pageNum": 1, + "pageSize": 100, + "state": 1 + }; + BaseData> pageGoods = + await apiService.creditGoods(param).catchError((onError) { + refreshController.loadFailed(); + refreshController.refreshFailed(); + }); + EasyLoading.dismiss(); + if (pageGoods != null && pageGoods.isSuccess) { goods.clear(); goods.addAll(pageGoods.data.list); - }); - refreshController.refreshCompleted(); - refreshController.loadComplete(); - } else { - refreshController.loadFailed(); - refreshController.refreshFailed(); + } + } finally { + addLoadCount(); } } queryCoupon() async { - if (apiService == null) { - SharedPreferences value = await SharedPreferences.getInstance(); - apiService = ApiService( - Dio(), - context: context, - token: value.getString("token"), - ); - } + try{ BaseData> baseData = await apiService.queryCoupon({ "centre": true, "pageNum": 1, @@ -110,36 +89,48 @@ class _WelfarePage extends State { "state": 0 }).catchError((onError) { SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type), - alignment: Alignment.center); - refreshController.refreshFailed(); - refreshController.loadFailed(); + alignment: Alignment.center); }); coupons.clear(); coupon.clear(); if (baseData != null && baseData.isSuccess) { coupons.addAll(baseData.data.list); - for(var i = 0;i < coupons.length~/3+1;i++){ + for (var i = 0; i < coupons.length ~/ 3 + 1; i++) { List con = []; - con = coupons.skip(i*3).take((i*3 0 && coupon[coupon.length - 1].isEmpty) - coupon.removeAt(coupon.length-1); - refreshController.refreshCompleted(); - refreshController.loadComplete(); + if (coupon.length > 0 && coupon[coupon.length - 1].isEmpty) + coupon.removeAt(coupon.length - 1); setState(() {}); - } else { - refreshController.refreshFailed(); - refreshController.loadFailed(); + }}finally{ + addLoadCount(); } } - - _onRefresh(){ + _onRefresh() async{ + EasyLoading.show(status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = + ApiService(Dio(), context: context, token: value.getString("token")); + } queryGoods(); queryCoupon(); } + addLoadCount() { + _loadCount += 1; + if (_loadCount == 2) { + _loadCount = 0; + EasyLoading.dismiss(); + if (refreshController.isRefresh) refreshController.refreshCompleted(); + if (mounted) setState(() {}); + } + } @override Widget build(BuildContext context) { @@ -157,7 +148,10 @@ class _WelfarePage extends State { width: double.infinity, height: 236.h, ), - Expanded(child: Container(color: Colors.white,)) + Expanded( + child: Container( + color: Colors.white, + )) ], ), Scaffold( @@ -170,7 +164,7 @@ class _WelfarePage extends State { titleSize: 18.sp, brightness: Brightness.dark, ), - body:SmartRefresher( + body: SmartRefresher( controller: refreshController, enablePullDown: true, enablePullUp: false, @@ -180,18 +174,15 @@ class _WelfarePage extends State { return MyFooter(mode); }, ), - onRefresh:(){ - setState(() { - _onRefresh(); - }); - }, + onRefresh:_onRefresh, physics: BouncingScrollPhysics(), scrollController: ScrollController(), child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(6), - topRight: Radius.circular(6),), + topRight: Radius.circular(6), + ), color: Colors.white, boxShadow: [ BoxShadow( @@ -213,12 +204,10 @@ class _WelfarePage extends State { Container( color: Colors.white, - padding: EdgeInsets.only(left: 14,right: 14), - child:Column( + padding: EdgeInsets.only(left: 14, right: 14), + child: Column( children: [ - inviteFriends(), - benefitExchange(), ], ), @@ -242,7 +231,8 @@ class _WelfarePage extends State { decoration: BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(6), - topRight: Radius.circular(6),), + topRight: Radius.circular(6), + ), color: Colors.white, boxShadow: [ BoxShadow( @@ -253,14 +243,13 @@ class _WelfarePage extends State { ), ], ), - child: Column( + child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.symmetric(horizontal: 17.w,vertical: 16.h), - child: - Row( + padding: EdgeInsets.symmetric(horizontal: 17.w, vertical: 16.h), + child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -282,81 +271,82 @@ class _WelfarePage extends State { ), ], )), - coupon.length == 0? - NoDataView( + coupon.length == 0 + ? NoDataView( + src: "assets/image/ka.webp", + isShowBtn: false, + text: S.of(context).haimeiyouyouhuiquankeyilingqu, + fontSize: 16.sp, + ) + : AspectRatio( + aspectRatio: 1.10, + child: Swiper( + onIndexChanged: (it) { + swiperIndex = it; + }, + index: couponIndex, + viewportFraction: 0.9, + scale: 0.7, + key: UniqueKey(), + pagination: SwiperPagination( + alignment: Alignment.bottomCenter, + builder: DotSwiperPaginationBuilder( + size: 8, + activeSize: 8, + space: 5, + activeColor: Colors.black, + color: Colors.black.withAlpha(76), + ), + ), + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return Column( + children: [ + Container( + child: weekList(coupon[position]), + ), + ], + ); + }, + itemCount: coupon.length ?? 0, + ), + ) + ], + )); + } + + Widget weekList(List cops) { + return Expanded( + child: (cops == null && cops.length == 0) + ? NoDataView( src: "assets/image/ka.webp", isShowBtn: false, text: S.of(context).haimeiyouyouhuiquankeyilingqu, fontSize: 16.sp, - ): AspectRatio( - aspectRatio: 1.10, - child: Swiper( - onIndexChanged: (it){ - swiperIndex = it; - }, - index: couponIndex, - viewportFraction: 0.9, - scale: 0.7, - key: UniqueKey(), - pagination: SwiperPagination( - alignment: Alignment.bottomCenter, - builder: DotSwiperPaginationBuilder( - size: 8, - activeSize: 8, - space: 5, - activeColor: Colors.black, - color: Colors.black.withAlpha(76), - ), - ), - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return Column( - children: [ - Container( - child: weekList(coupon[position]), - ), - ], - ); - }, - itemCount:coupon.length ?? 0, - ), ) - ], - ) + : ListView.builder( + padding: EdgeInsets.zero, + itemCount: cops.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () {}, + child: weekCoupon(cops[position]), + ); + }, + ), ); } - Widget weekList(List cops){ - return Expanded( - child:(cops == null && cops.length == 0)? - NoDataView( - src: "assets/image/ka.webp", - isShowBtn: false, - text: S.of(context).haimeiyouyouhuiquankeyilingqu, - fontSize: 16.sp, - ):ListView.builder( - padding: EdgeInsets.zero, - itemCount: cops.length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - }, - child: weekCoupon(cops[position]), - ); - }, - ),); - } - ///优惠券列表 Widget weekCoupon(Coupon cop) { return Container( height: 95.h, width: double.infinity, - margin: EdgeInsets.only(bottom:10), - padding:EdgeInsets.symmetric(horizontal: 12), + margin: EdgeInsets.only(bottom: 10), + padding: EdgeInsets.symmetric(horizontal: 12), decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, @@ -367,8 +357,9 @@ class _WelfarePage extends State { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded(child: Container( - margin: EdgeInsets.only(top: 12,bottom: 12), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 12, bottom: 12), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, @@ -383,31 +374,37 @@ class _WelfarePage extends State { color: Color(0xFF0D0D0D), ), ), - SizedBox(height: 12,), - (cop.status == 0)? - Text( - "发放时间: ${cop?.publishStartTime ?? ""}", - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: cop.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D), - ), - ):Text( - "有效期至 ${cop?.useEndTime ?? ""}", - maxLines:1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: cop.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D), - ), - ) + SizedBox( + height: 12, + ), + (cop.status == 0) + ? Text( + "发放时间: ${cop?.publishStartTime ?? ""}", + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: cop.status == 3 + ? Color(0xFFB3B3B3) + : Color(0xFF4D4D4D), + ), + ) + : Text( + "有效期至 ${cop?.useEndTime ?? ""}", + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: cop.status == 3 + ? Color(0xFFB3B3B3) + : Color(0xFF4D4D4D), + ), + ) ], ), )), - Column( // mainAxisAlignment: MainAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.end, @@ -441,7 +438,8 @@ class _WelfarePage extends State { style: TextStyle( fontSize: 16.sp, fontWeight: MyFontWeight.medium, - color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), + color: + cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), ), ), SizedBox( @@ -450,26 +448,25 @@ class _WelfarePage extends State { Text( coupon != null ? double.tryParse("${cop.discountAmount}" ?? "0") - .toInt() - .toString() + .toInt() + .toString() : "", style: TextStyle( fontSize: 24.sp, fontWeight: MyFontWeight.semi_bold, - color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), + color: + cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), ), ), ], ), Text( - S.of(context).manyuankeyong(coupon != null - ? ("${cop.fullAmount}" ?? "0") - .toString() - : ""), + S.of(context).manyuankeyong( + coupon != null ? ("${cop.fullAmount}" ?? "0").toString() : ""), style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.semi_bold, - color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), + color: cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), ), ), ], @@ -489,7 +486,8 @@ class _WelfarePage extends State { style: TextStyle( fontSize: 22.sp, fontWeight: MyFontWeight.semi_bold, - color:cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), + color: + cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), ), ), ], @@ -500,7 +498,7 @@ class _WelfarePage extends State { style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.semi_bold, - color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), + color: cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), ), ), ], @@ -511,7 +509,7 @@ class _WelfarePage extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( - padding: EdgeInsets.only(bottom:10,top: 7), + padding: EdgeInsets.only(bottom: 10, top: 7), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -520,7 +518,8 @@ class _WelfarePage extends State { style: TextStyle( fontSize: 26.sp, fontWeight: MyFontWeight.semi_bold, - color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), + color: + cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), ), ), ], @@ -531,7 +530,7 @@ class _WelfarePage extends State { style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.semi_bold, - color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), + color: cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), ), ), ], @@ -547,31 +546,35 @@ class _WelfarePage extends State { textBaseline: TextBaseline.alphabetic, children: [ Text( - cop.limitAmount != "0.00"?"¥":"", + cop.limitAmount != "0.00" ? "¥" : "", style: TextStyle( fontSize: 16.sp, fontWeight: MyFontWeight.medium, - color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), + color: + cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), ), ), SizedBox( height: 4.h, ), Text( - cop.limitAmount != "0.00"?(coupon != null - ? "${AppUtils.calculateDouble(double.tryParse(cop.limitAmount) ?? 0)}" - : "") :"", + cop.limitAmount != "0.00" + ? (coupon != null + ? "${AppUtils.calculateDouble(double.tryParse(cop.limitAmount) ?? 0)}" + : "") + : "", style: TextStyle( fontSize: 24.sp, fontWeight: FontWeight.bold, - color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), + color: + cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), ), ), ], ), ], ); - }else{ + } else { return Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -582,25 +585,29 @@ class _WelfarePage extends State { textBaseline: TextBaseline.alphabetic, children: [ Text( - cop.discountPercent != 0 ? (coupon != null - ? "${(cop.discountPercent / 10.0 >= 10) ? 10 : cop.discountPercent / 10.0}" ?? - "0" - : ""):"", + cop.discountPercent != 0 + ? (coupon != null + ? "${(cop.discountPercent / 10.0 >= 10) ? 10 : cop.discountPercent / 10.0}" ?? + "0" + : "") + : "", style: TextStyle( fontSize: 30.sp, fontWeight: MyFontWeight.semi_bold, - color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), + color: + cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), ), ), SizedBox( height: 4.h, ), Text( - cop.discountPercent != 0 ? "折" :"", + cop.discountPercent != 0 ? "折" : "", style: TextStyle( fontSize: 16.sp, fontWeight: MyFontWeight.semi_bold, - color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), + color: + cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), ), ), ], @@ -612,67 +619,66 @@ class _WelfarePage extends State { ///优惠券领取状态 Widget weekBtn(Coupon cop) { - if(cop.status == 0) - return Align( - alignment: Alignment.centerRight, - child: InkWell( - onTap: () { - receiveCoupon(cop.id); - }, - child: Container( - padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 2.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(3), - color: Color(0xFF32A060), - ), - child: Text( - S.of(context).lingqu, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, - ), - ), - ), + if (cop.status == 0) + return Align( + alignment: Alignment.centerRight, + child: InkWell( + onTap: () { + receiveCoupon(cop.id); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 2.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(3), + color: Color(0xFF32A060), + ), + child: Text( + S.of(context).lingqu, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, ), - ); - if(cop.status == 1 || cop.status == 2) + ), + ), + ), + ); + if (cop.status == 1 || cop.status == 2) return Align( - alignment: Alignment.centerRight, - child: InkWell( - onTap: () { - if (cop.bizType == 5 || cop.bizType == 3) { - Navigator.of(context).pushNamed( - '/router/write_off_page', - arguments: { - "couponId": cop.id, - "coupon": jsonEncode(cop.toJson()), - }); - } else { - showStoreSelector(cop.storeList); - } - }, - child: Container( - // height: 19.h, - padding: EdgeInsets.symmetric(horizontal:8.w,vertical: 1.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(3), - border: Border.all( - width: 1, color: Color(0xFF32A060), style: BorderStyle.solid), - color: Colors.transparent, - ), - alignment: Alignment.center, - child:Text( - S.of(context).qushiyong, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF32A060), - ), - ), - ), + alignment: Alignment.centerRight, + child: InkWell( + onTap: () { + if (cop.bizType == 5 || cop.bizType == 3) { + Navigator.of(context) + .pushNamed('/router/write_off_page', arguments: { + "couponId": cop.id, + "coupon": jsonEncode(cop.toJson()), + }); + } else { + showStoreSelector(cop.storeList); + } + }, + child: Container( + // height: 19.h, + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 1.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(3), + border: Border.all( + width: 1, color: Color(0xFF32A060), style: BorderStyle.solid), + color: Colors.transparent, + ), + alignment: Alignment.center, + child: Text( + S.of(context).qushiyong, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF32A060), ), - ); + ), + ), + ), + ); } ///领取优惠券 @@ -682,8 +688,8 @@ class _WelfarePage extends State { if (baseData != null && baseData.isSuccess) { queryCoupon(); showAlertDialog(); - }else{ - SmartDialog.showToast(baseData?.msg,alignment: Alignment.center); + } else { + SmartDialog.showToast(baseData?.msg, alignment: Alignment.center); } } @@ -710,8 +716,8 @@ class _WelfarePage extends State { ///邀请好友 Widget inviteFriends() { return Container( - margin: EdgeInsets.only(top:24.h,bottom:20.h), - child:Column( + margin: EdgeInsets.only(top: 24.h, bottom: 20.h), + child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -723,17 +729,19 @@ class _WelfarePage extends State { color: Color(0xFF0D0D0D), ), ), - SizedBox(height: 12,), + SizedBox( + height: 12, + ), GestureDetector( - onTap: (){ + onTap: () { Navigator.of(context).pushNamed('/router/invite_friends'); }, - child:ClipRRect( - child:Image.asset( + child: ClipRRect( + child: Image.asset( "assets/image/welfare_spread.webp", - width:double.infinity, + width: double.infinity, fit: BoxFit.fill, - height:80.h, + height: 80.h, ), borderRadius: BorderRadius.circular(6.w), ), @@ -747,28 +755,29 @@ class _WelfarePage extends State { Widget benefitExchange() { return Container( width: double.infinity, - margin: EdgeInsets.only(top:24.h,bottom:20.h), - child:Column( + margin: EdgeInsets.only(top: 24.h, bottom: 20.h), + child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ GestureDetector( - onTap: (){ + onTap: () { Navigator.of(context).pushNamed('/router/welfare_exchange'); }, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Expanded(child: - Text( - S.of(context).fuliduihuan, - style: TextStyle( - fontSize: 15.sp, - fontWeight: MyFontWeight.bold, - color: Color(0xFF0D0D0D), + Expanded( + child: Text( + S.of(context).fuliduihuan, + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.bold, + color: Color(0xFF0D0D0D), + ), ), - ),), + ), Text( S.of(context).gengduo, style: TextStyle( @@ -785,47 +794,50 @@ class _WelfarePage extends State { ], ), ), - SizedBox(height: 12,), - (goods == null || goods.length == 0)? NoDataView( - src: "assets/image/xiao_fei.webp", - isShowBtn: false, - text: "暂无商品可兑换", - fontSize: 16.sp, - margin: EdgeInsets.all(60.h), - ) - :GridView.builder( - itemCount:goods.length>6?6:goods.length, - padding: EdgeInsets.only( - // left: 16.w, - // right: 16.w, - top: 18.h, - bottom: 16.h, - ), - shrinkWrap: true, - physics: BouncingScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - //一行的Widget数量 - crossAxisCount: 2, - //水平子Widget之间间距 - crossAxisSpacing: 11.w, - //垂直子Widget之间间距 - mainAxisSpacing: 16.w, - //子Widget宽高比例 0.59 - childAspectRatio: - 200 / (285 / 2 + (285 / 2) * AppUtils.textScale(context)), - ), - itemBuilder: (context, index) { - return GestureDetector( - onTap: () { - Navigator.of(context).pushNamed( - '/router/integral_store_page', - arguments: {"goodsId": goods[index].id}, - ); - }, - child: exchangeItem(goods[index]), - ); - }, - ) + SizedBox( + height: 12, + ), + (goods == null || goods.length == 0) + ? NoDataView( + src: "assets/image/xiao_fei.webp", + isShowBtn: false, + text: "暂无商品可兑换", + fontSize: 16.sp, + margin: EdgeInsets.all(60.h), + ) + : GridView.builder( + itemCount: goods.length > 6 ? 6 : goods.length, + padding: EdgeInsets.only( + // left: 16.w, + // right: 16.w, + top: 18.h, + bottom: 16.h, + ), + shrinkWrap: true, + physics: BouncingScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + //一行的Widget数量 + crossAxisCount: 2, + //水平子Widget之间间距 + crossAxisSpacing: 11.w, + //垂直子Widget之间间距 + mainAxisSpacing: 16.w, + //子Widget宽高比例 0.59 + childAspectRatio: 200 / + (285 / 2 + (285 / 2) * AppUtils.textScale(context)), + ), + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/integral_store_page', + arguments: {"goodsId": goods[index].id}, + ); + }, + child: exchangeItem(goods[index]), + ); + }, + ) ], ), ); @@ -871,10 +883,8 @@ class _WelfarePage extends State { margin: EdgeInsets.only( right: 12.w, top: 10.h, - ),padding: EdgeInsets.only( - bottom: 8, - left: 8 - ), + ), + padding: EdgeInsets.only(bottom: 8, left: 8), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, @@ -894,12 +904,12 @@ class _WelfarePage extends State { Text( pointPrice(goods), style: TextStyle( - color: Color(0xFFE5600D), - fontSize: 16.sp, + color: Color(0xFFE5600D), + fontSize: 16.sp, fontFamily: 'JDZhengHT', - fontWeight: MyFontWeight.semi_bold, - ), - ), + fontWeight: MyFontWeight.semi_bold, + ), + ), ], ), ), @@ -912,16 +922,22 @@ class _WelfarePage extends State { ); } - String pointPrice(Goods goodsPrice){ - if(goodsPrice == null) - return ""; - if(goodsPrice?.oneBean!=null && goodsPrice?.oneBean!="0"){ + String pointPrice(Goods goodsPrice) { + if (goodsPrice == null) return ""; + if (goodsPrice?.oneBean != null && goodsPrice?.oneBean != "0") { return "${goodsPrice?.oneBean}印章"; - } else if(goodsPrice?.onePrice!=null && goodsPrice?.onePrice!="0"){ + } else if (goodsPrice?.onePrice != null && goodsPrice?.onePrice != "0") { return S.of(context).jifen_(goodsPrice?.onePrice); - }else if((goodsPrice?.onePrice == null || goodsPrice?.onePrice == "0") && ((goodsPrice?.price != null && goodsPrice?.price != "0") || (goodsPrice?.money != null && goodsPrice?.money != "0.00"))){ - return (goodsPrice?.price== "0"|| goodsPrice?.price == null ? "" : S.of(context).jifen_(goodsPrice?.price)) + (goodsPrice?.money== "0"|| goodsPrice?.money == null ? "" : " + ${AppUtils.calculateDouble(double.tryParse(goodsPrice?.money) ?? 0)}元"); - }else if(goodsPrice.oneMoney != null && goodsPrice.oneMoney != "0.00"){ + } else if ((goodsPrice?.onePrice == null || goodsPrice?.onePrice == "0") && + ((goodsPrice?.price != null && goodsPrice?.price != "0") || + (goodsPrice?.money != null && goodsPrice?.money != "0.00"))) { + return (goodsPrice?.price == "0" || goodsPrice?.price == null + ? "" + : S.of(context).jifen_(goodsPrice?.price)) + + (goodsPrice?.money == "0" || goodsPrice?.money == null + ? "" + : " + ${AppUtils.calculateDouble(double.tryParse(goodsPrice?.money) ?? 0)}元"); + } else if (goodsPrice.oneMoney != null && goodsPrice.oneMoney != "0.00") { return "${AppUtils.calculateDouble(double.tryParse(goodsPrice.oneMoney) ?? 0)}元"; } } @@ -929,8 +945,10 @@ class _WelfarePage extends State { ///活动任务 Widget activityTask() { return Container( - margin: EdgeInsets.only(bottom:20.h,), - child:Column( + margin: EdgeInsets.only( + bottom: 20.h, + ), + child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -956,17 +974,18 @@ class _WelfarePage extends State { ), ], ), - SizedBox(height: 12.h,), + SizedBox( + height: 12.h, + ), ListView.builder( padding: EdgeInsets.zero, - itemCount:6, + itemCount: 6, scrollDirection: Axis.vertical, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemBuilder: (context, position) { return GestureDetector( - onTap: () { - }, + onTap: () {}, child: taskItem(), ); }, @@ -978,72 +997,76 @@ class _WelfarePage extends State { Widget taskItem() { return Container( - width:double.infinity, - height:95.h, + width: double.infinity, + height: 95.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(6), color: Colors.white, boxShadow: [ - BoxShadow( - color: Color(0x08213303).withAlpha(12), - offset: Offset(0, 2), - blurRadius: 3, - spreadRadius: 0, - ), - ], + BoxShadow( + color: Color(0x08213303).withAlpha(12), + offset: Offset(0, 2), + blurRadius: 3, + spreadRadius: 0, + ), + ], ), - padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 12.h), + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 12.h), margin: EdgeInsets.only(bottom: 10.h), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.end, children: [ - Expanded(child:Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "海峡姐妹茶新品尝鲜(0/3)", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.bold, - color: Color(0xFF353535), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "海峡姐妹茶新品尝鲜(0/3)", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.bold, + color: Color(0xFF353535), + ), ), - ), - Text( - "可获得¥10代金券", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF4D4D4D), + Text( + "可获得¥10代金券", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF4D4D4D), + ), ), - ), Text( - "购买任意3杯新品", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFB3B3B3), + Text( + "购买任意3杯新品", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFFB3B3B3), + ), ), - ), - ], - ),), + ], + ), + ), Container( width: 55.w, height: 21.h, decoration: BoxDecoration( gradient: new LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - colors: [ - Color(0xFFFF2700), - Color(0xFFFF4F00), - ],), + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [ + Color(0xFFFF2700), + Color(0xFFFF4F00), + ], + ), // border: Border.all(color: Colors.white,width: 0.5), shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(3), ), alignment: Alignment.center, - child:Text( + child: Text( "领取", style: TextStyle( fontSize: 12.sp, @@ -1056,5 +1079,4 @@ class _WelfarePage extends State { ), ); } - } diff --git a/lib/integral/integral_page.dart b/lib/integral/integral_page.dart index 04f8b83f..771ec56e 100644 --- a/lib/integral/integral_page.dart +++ b/lib/integral/integral_page.dart @@ -19,10 +19,10 @@ import 'package:huixiang/view_widget/sign_in_widget.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../utils/flutter_utils.dart'; import 'intergra_view/integral_task.dart'; class IntegralPage extends StatefulWidget { - @override State createState() { return _IntegralPage(); @@ -51,13 +51,17 @@ class _IntegralPage extends State { ); userInfo = UserInfo.fromJson(jsonDecode(value.getString("user"))); - BaseData> rankData = await apiService.rankList() - .catchError((onError) {}); + BaseData> rankData = + await apiService.rankList().catchError((onError) { + SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type), + alignment: Alignment.center); + refreshController.refreshFailed(); + }); if (rankData != null && rankData.isSuccess) { ranks.clear(); ranks.addAll(rankData.data); refreshController.refreshCompleted(); - }else { + } else { refreshController.refreshFailed(); } @@ -112,7 +116,9 @@ class _IntegralPage extends State { Scaffold( backgroundColor: Colors.transparent, appBar: MyAppBar( - exit: (){Navigator.of(context).pop(signInfo.todayHasSignin ?? false);}, + exit: () { + Navigator.of(context).pop(signInfo?.todayHasSignin ?? false); + }, background: Colors.transparent, leadingColor: Colors.white, title: "", @@ -124,7 +130,9 @@ class _IntegralPage extends State { margin: EdgeInsets.only(right: 16.w), child: GestureDetector( onTap: () { - Navigator.of(context).pushNamed('/router/integral_detailed_page',arguments:{"titleType":2}); + Navigator.of(context).pushNamed( + '/router/integral_detailed_page', + arguments: {"titleType": 2}); }, child: Text( S.of(context).mingxi, @@ -137,17 +145,17 @@ class _IntegralPage extends State { ), ), ), - body:SmartRefresher( + body: SmartRefresher( controller: refreshController, enablePullDown: true, enablePullUp: false, - header: MyHeader(), + header: MyHeader(color: Colors.white,), footer: CustomFooter( builder: (context, mode) { return MyFooter(mode); }, ), - onRefresh:(){ + onRefresh: () { setState(() { querySignInfo(); }); @@ -163,9 +171,19 @@ class _IntegralPage extends State { return Column( children: [ /// 上面的积分和VIP等级显示 - IntegralVip(rankLevel, signInfo, userInfo,"${ (signInfo?.signInList?.length ) ?? "0"}", - ((signInfo?.rewardList != null && signInfo.rewardList.length > (signInfo?.signInList?.length ?? 0)) ? - signInfo.rewardList[signInfo?.signInList?.length ?? 0]:0).toString()), + IntegralVip( + rankLevel, + signInfo, + userInfo, + "${(signInfo?.signInList?.length) ?? "0"}", + ((signInfo?.rewardList != null && + signInfo.rewardList.length > + (signInfo?.signInList?.length ?? + 0)) + ? signInfo.rewardList[ + signInfo?.signInList?.length ?? 0] + : 0) + .toString()), ///立即签到 InForPoints(signInfo, _signIn), @@ -191,7 +209,9 @@ class _IntegralPage extends State { SmartDialog.showToast("今日已签到了", alignment: Alignment.center); return; } - EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); + EasyLoading.show( + status: S.of(context).zhengzaijiazai, + maskType: EasyLoadingMaskType.black); BaseData baseData = await apiService.signIn().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { setState(() {}); diff --git a/lib/integral/intergra_view/integral_task.dart b/lib/integral/intergra_view/integral_task.dart index 408d8694..e9bb165a 100644 --- a/lib/integral/intergra_view/integral_task.dart +++ b/lib/integral/intergra_view/integral_task.dart @@ -6,6 +6,8 @@ import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/round_button.dart'; +import '../../view_widget/no_data_view.dart'; + class IntegralTask extends StatefulWidget { final SignInfo signInfo; @@ -57,28 +59,38 @@ class _IntegralTask extends State { ), Expanded( child: Container( - child: ListView.builder( - padding: EdgeInsets.only(left: 10.w, top: 20.h), - physics: BouncingScrollPhysics(), - // loop: false, - // pagination: SwiperPagination( - // alignment: Alignment.bottomCenter, - // builder: DotSwiperPaginationBuilder( - // size: 8, - // activeSize: 8, - // space: 5, - // activeColor: Colors.black, - // color: Colors.black.withAlpha(76), - // ), - // ), - itemBuilder: (context, position) { - return taskItem(widget.signInfo.taskList[position]); - }, - itemCount: (widget.signInfo != null && - widget.signInfo.taskList != null && - widget.signInfo.taskList.length > 0) - ? widget.signInfo.taskList.length - : 0), + child: (widget.signInfo != null && + widget.signInfo.taskList != null && + widget.signInfo.taskList.length > 0) + ? ListView.builder( + padding: EdgeInsets.only(left: 10.w, top: 20.h), + physics: BouncingScrollPhysics(), + // loop: false, + // pagination: SwiperPagination( + // alignment: Alignment.bottomCenter, + // builder: DotSwiperPaginationBuilder( + // size: 8, + // activeSize: 8, + // space: 5, + // activeColor: Colors.black, + // color: Colors.black.withAlpha(76), + // ), + // ), + itemBuilder: (context, position) { + return taskItem(widget.signInfo.taskList[position]); + }, + itemCount: (widget.signInfo != null && + widget.signInfo.taskList != null && + widget.signInfo.taskList.length > 0) + ? widget.signInfo.taskList.length + : 0) + : NoDataView( + src: "assets/image/xiao_fei.webp", + isShowBtn: false, + text: "暂无任务可做~", + fontSize: 16.sp, + margin: EdgeInsets.only(left: 60.w, right: 60.w), + ), ), flex: 1, ) diff --git a/lib/mine/mine_shop_page.dart b/lib/mine/mine_shop_page.dart index 8b1ae39b..9fc90c7d 100644 --- a/lib/mine/mine_shop_page.dart +++ b/lib/mine/mine_shop_page.dart @@ -2,6 +2,7 @@ import 'dart:convert'; 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/page.dart'; @@ -85,19 +86,25 @@ class _MineShopPage extends State with WidgetsBindingObserver{ super.dispose(); } - queryVipCard() async { - BaseData> baseData = - await apiService.vipList({}).catchError((error) { - refreshController.refreshFailed(); - }); - if (baseData != null && baseData.isSuccess) { - coupons.clear(); - coupons.addAll(baseData.data); - setState(() { - refreshController.refreshCompleted(); + queryVipCard({bool showLoading = true}) async { + try{ + if(showLoading)EasyLoading.show(status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); + BaseData> baseData = + await apiService.vipList({ + "keywords":editingController.text, + }).catchError((error) { + refreshController.refreshFailed(); }); - } else { - refreshController.refreshFailed(); + if (baseData != null && baseData.isSuccess) { + coupons.clear(); + coupons.addAll(baseData.data); + refreshController.refreshCompleted(); + } else { + refreshController.refreshFailed(); + } + }finally{ + EasyLoading.dismiss(); + setState(() {}); } } @@ -109,6 +116,7 @@ class _MineShopPage extends State with WidgetsBindingObserver{ FocusScope.of(context).requestFocus(FocusNode()); }, child: Scaffold( + resizeToAvoidBottomInset: false, appBar: MyAppBar( title: "店铺充值", titleColor: Colors.black, @@ -142,7 +150,13 @@ class _MineShopPage extends State with WidgetsBindingObserver{ onTap: () { Navigator.of(context).pushNamed( '/router/mine_shop_recharge', - arguments: {"id": coupons[position].id}); + arguments: { + "id": coupons[position].id, + "tenantCode":coupons[position].tenantCode, + "storeId":coupons[position].storeList[0].id + }).then((value) { + queryVipCard(showLoading: false); + }); }, child: shopItem(coupons[position]), ); @@ -184,6 +198,7 @@ class _MineShopPage extends State with WidgetsBindingObserver{ textInputAction: TextInputAction.search, onEditingComplete: () { FocusScope.of(context).requestFocus(FocusNode()); + queryVipCard(); }, controller: editingController, cursorHeight: 25.h, diff --git a/lib/mine/mine_shop_recharge.dart b/lib/mine/mine_shop_recharge.dart index f2d93a53..cdf8e95e 100644 --- a/lib/mine/mine_shop_recharge.dart +++ b/lib/mine/mine_shop_recharge.dart @@ -1,31 +1,34 @@ -import 'package:barcode_widget/barcode_widget.dart'; +import 'dart:io'; + import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_bmflocation/flutter_bmflocation.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_html/flutter_html.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:fluwx/fluwx.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; -import 'package:huixiang/retrofit/data/page.dart'; -import 'package:huixiang/retrofit/data/product.dart'; -import 'package:huixiang/retrofit/data/user_bill.dart'; import 'package:huixiang/retrofit/data/vip_card.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/store/scan.dart'; import 'package:huixiang/utils/font_weight.dart'; -import 'package:huixiang/utils/location.dart'; -import 'package:huixiang/utils/painter_bg.dart'; -import 'package:huixiang/view_widget/classic_header.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:flutter_screenutil/flutter_screenutil.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import '../retrofit/data/member_recharge_list.dart'; import '../retrofit/data/rechargeActLists.dart'; +import '../retrofit/data/wx_pay.dart'; +import '../retrofit/min_api.dart'; import '../utils/flutter_utils.dart'; +import '../utils/min.dart'; +import '../view_widget/classic_header.dart'; +import '../view_widget/my_footer.dart'; import '../view_widget/no_data_view.dart'; import '../view_widget/recharge_details_dialog.dart'; +import 'package:tobias/tobias.dart' as tobias; class MineShopRecharge extends StatefulWidget { final Map arguments; @@ -40,203 +43,358 @@ class MineShopRecharge extends StatefulWidget { class _MineShopRecharge extends State { ApiService apiService; + MinApiService minService; VipCard vipCard; - RechargeActLists rechargeActLists; + List memberRechargeList = []; int selectIndex = 0; double discount = 100; var checkIndex = 2; + dynamic payListen; + int _loadCount = 0; + String tenant; + String storeId; + String minToken; final RefreshController refreshController = RefreshController(); @override void dispose() { super.dispose(); refreshController.dispose(); + if (payListen != null) payListen.cancel(); } @override void initState() { super.initState(); - vipDetail("", ""); + storeId = widget.arguments["storeId"]; + tenant = widget.arguments["tenantCode"]; + _onRefresh(); + payListen = weChatResponseEventHandler.listen((event) async { + print("payCallback: ${event.errCode}"); + if (event.errCode == 0) { + SmartDialog.showToast("充值成功", alignment: Alignment.center); + } else { + SmartDialog.showToast("充值失败", alignment: Alignment.center); + } + vipDetail(); + }); } ///会员卡详情 - vipDetail(latitude, longitude) async { - SharedPreferences value = await SharedPreferences.getInstance(); - if (apiService == null) - apiService = - ApiService(Dio(), context: context, token: value.getString("token")); - BaseData baseData = await apiService.vipDetail({ - "id": widget.arguments["id"], - "latitude": "$latitude", - "longitude": "$longitude", - }).catchError((onError) {}); + vipDetail({bool isSingle = true}) async { + try { + BaseData baseData = await apiService.vipDetail({ + "id": widget.arguments["id"], + "latitude": "", + "longitude": "", + }).catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + vipCard = baseData.data; + } + } finally { + if(isSingle) + setState((){}); + else + addLoadCount(); + } + } + + ///小程序登录 + minLogin() async { + try { + var baseData = await apiService.minLogin(storeId).catchError((onError) { + debugPrint(onError.toString()); + }); + if (baseData != null && baseData.isSuccess) { + minToken = baseData.data["token"]; + SharedPreferences.getInstance().then( + (value) => { + value.setString('minToken', minToken), + value.setString('tenant', tenant), + value.setString('storeId', storeId), + }, + ); + minService = MinApiService( + Dio(), + context: context, + token: minToken, + tenant: tenant, + storeId: storeId, + ); + } + } finally {} + } + + ///充值列表 + queryRechargeActList() async { + try { + BaseData> baseData = + await minService.memberRechargeList().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + memberRechargeList = baseData.data; + } + } finally { + addLoadCount(); + } + } + + ///门店充值 + shopRecharge() async { + if (minService == null) await minLogin(); + BaseData baseData = await minService.memberRecharge({ + "money": 0, + "rechargeId": memberRechargeList[selectIndex].id, + "type": checkIndex == 2 ? "wechat" : "alipay", + }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { - vipCard = baseData.data; - refreshController.loadComplete(); + if (checkIndex == 2) { + if (Platform.isAndroid) { + if (!(await Min.isInitialize())) { + // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, + // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, + // 故而在此初始化一下 + await Min.initialize(); + } + } + WxPay wxPay = WxPay.fromJson(baseData.data); + await registerWxApi( + appId: wxPay.appId, + doOnAndroid: true, + universalLink: "https://hx.lotus-wallet.com/app/", + ); + payWithWeChat( + appId: wxPay.appId, + partnerId: wxPay.partnerId, + prepayId: wxPay.prepayId, + packageValue: wxPay.packageValue, + nonceStr: wxPay.nonceStr, + timeStamp: int.tryParse(wxPay.timeStamp), + sign: wxPay.sign, + ); + } else { + tobias.isAliPayInstalled().then((value) => { + // 判断是否安装了支付宝 + if (!value) + {SmartDialog.showToast("请安装支付宝", alignment: Alignment.center)} + else + { + tobias.aliPay(baseData.data["body"]).then((payRes) { + if (payRes['resultStatus'] == 9000 || + payRes['resultStatus'] == '9000') { + SmartDialog.showToast("充值成功", + alignment: Alignment.center); + } else { + SmartDialog.showToast(payRes['memo'], + alignment: Alignment.center); + } + vipDetail(); + }) + } + }); + } } else { - refreshController.loadFailed(); + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + + _onRefresh() async { + EasyLoading.show( + status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = + ApiService(Dio(), context: context, token: value.getString("token")); + } + if (minService == null) await minLogin(); + vipDetail(isSingle: false); + queryRechargeActList(); + } + + addLoadCount() { + _loadCount += 1; + if (_loadCount == 2) { + _loadCount = 0; + EasyLoading.dismiss(); + if (refreshController.isRefresh) refreshController.refreshCompleted(); + if (mounted) setState(() {}); } - print("object:object"); - setState(() {}); } @override Widget build(BuildContext context) { return Scaffold( - appBar: MyAppBar( - title: "店铺充值", - titleColor: Colors.black, - background: Colors.white, - brightness: Brightness.dark, - leadingColor: Colors.black, - ), - body: - Column( - children: [ - shopRechargeCard(), - // NoDataView( - // src: "assets/image/xiao_fei.webp", - // isShowBtn: false, - // text: "当前店铺暂无充值套餐~", - // fontSize: 16.sp, - // margin: EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w), - // ), - Expanded(child:ListView.builder( - padding: EdgeInsets.zero, - itemCount: 6, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - setState(() { - selectIndex = position; - }); - }, - child: rechargeItem(position)); - }, - )), - Container( - width: double.infinity, - margin: EdgeInsets.only(left: 16, right: 16), - padding: EdgeInsets.only( - top: 20.h, - bottom: 24.h, - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(bottom: 16.h), - child: Text( - S.of(context).zhifufangshi, - style: TextStyle( - fontSize: 16.sp, - color: Colors.black, - fontWeight: FontWeight.bold, - ), + appBar: MyAppBar( + title: "店铺充值", + titleColor: Colors.black, + background: Colors.white, + brightness: Brightness.dark, + leadingColor: Colors.black, + ), + body: SmartRefresher( + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + controller: refreshController, + onRefresh: _onRefresh, + physics: BouncingScrollPhysics(), + child: Column( + children: [ + shopRechargeCard(), + (memberRechargeList != null && + (memberRechargeList?.length ?? 0) > 0) + ? Expanded( + child: ListView.builder( + padding: EdgeInsets.zero, + itemCount: (memberRechargeList != null && + (memberRechargeList?.length ?? 0) > 0) + ? memberRechargeList.length + : 0, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + setState(() { + selectIndex = position; + }); + }, + child: rechargeItem( + memberRechargeList[position], position)); + }, + )) + : NoDataView( + src: "assets/image/xiao_fei.webp", + isShowBtn: false, + text: "当前店铺暂无充值套餐~", + fontSize: 16.sp, + margin: + EdgeInsets.only(top: 90.h, left: 60.w, right: 60.w), ), + if (memberRechargeList != null && + (memberRechargeList?.length ?? 0) > 0) + Container( + width: double.infinity, + margin: EdgeInsets.only(left: 16, right: 16), + padding: EdgeInsets.only( + top: 20.h, + bottom: 24.h, ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - checkIndex = 2; - }); - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Image.asset( - "assets/image/icon_we_chat.webp"), - Expanded( - flex: 1, - child: Padding( - padding: EdgeInsets.only(left: 8.w), - child: Text( - S.of(context).weixinzhifu, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 16.h), + child: Text( + S.of(context).zhifufangshi, + style: TextStyle( + fontSize: 16.sp, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + checkIndex = 2; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset("assets/image/icon_we_chat.webp"), + Expanded( + flex: 1, + child: Padding( + padding: EdgeInsets.only(left: 8.w), + child: Text( + S.of(context).weixinzhifu, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + ), + ), ), ), - ), + checkView(2), + ], ), - checkView(2), - ], - ), + ), + SizedBox(height: 10.h), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + checkIndex = 3; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset("assets/image/icon_alipay.webp"), + Expanded( + flex: 1, + child: Padding( + padding: EdgeInsets.only(left: 8.w), + child: Text( + S.of(context).zhifubao, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + ), + ), + ), + ), + checkView(3), + ], + ), + ), + ], ), - SizedBox(height: 10.h), - GestureDetector( + ), + if (memberRechargeList != null && + (memberRechargeList?.length ?? 0) > 0) + Align( + alignment: Alignment.bottomCenter, + child: GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - setState(() { - checkIndex = 3; - }); + shopRecharge(); }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Image.asset( - "assets/image/icon_alipay.webp"), - Expanded( - flex: 1, - child: Padding( - padding: EdgeInsets.only(left: 8.w), - child: Text( - S.of(context).zhifubao, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - ), - ), - ), + child: Container( + height: 56.h, + width: double.infinity, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(27), + ), + margin: EdgeInsets.only( + top: 12.h, left: 16.w, right: 16.w, bottom: 21.h), + child: Text( + S.of(context).querenchongzhi, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, ), - checkView(3), - ], - ), - ), - ], - ), - ), - Align( - alignment: Alignment.bottomCenter, - child: GestureDetector( - onTap: () { - }, - child: Container( - height: 56.h, - width: double.infinity, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(27), - ), - margin: EdgeInsets.only( - top: 12.h, left: 16.w, right: 16.w, bottom: 21.h), - child: Text( - S.of(context).querenchongzhi, - style: TextStyle( - fontSize: 16.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, + ), ), ), - ), - ), - ) - ], - ), - ); + ) + ], + ), + )); } ///卡片背景底色 @@ -256,15 +414,15 @@ class _MineShopRecharge extends State { Widget shopRechargeCard() { return GestureDetector( behavior: HitTestBehavior.opaque, - onTap: (){ - Navigator.of(context).pushNamed( - '/router/mine_shop_details', + onTap: () { + Navigator.of(context).pushNamed('/router/mine_shop_details', arguments: {"id": widget.arguments["id"]}); }, child: Container( width: double.infinity, // height:140.h, - margin: EdgeInsets.only(bottom: 24.h, top: 14.h, left: 14.w, right: 14.w), + margin: + EdgeInsets.only(bottom: 24.h, top: 14.h, left: 14.w, right: 14.w), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -350,14 +508,15 @@ class _MineShopRecharge extends State { children: [ Expanded( child: Text( - "¥ ${vipCard != null ? vipCard.balance : ""}", - style: TextStyle( - color: Color(0xFF262626), - fontSize: 24.sp, - fontFamily: 'JDZhengHT', - fontWeight: MyFontWeight.medium, + "¥ ${vipCard != null ? vipCard.balance : ""}", + style: TextStyle( + color: Color(0xFF262626), + fontSize: 24.sp, + fontFamily: 'JDZhengHT', + fontWeight: MyFontWeight.medium, + ), ), - ),), + ), Text( "适用门店", style: TextStyle( @@ -366,7 +525,9 @@ class _MineShopRecharge extends State { fontWeight: MyFontWeight.regular, ), ), - SizedBox(width: 2,), + SizedBox( + width: 2, + ), Image.asset( "assets/image/icon_right_z.webp", width: 16, @@ -385,7 +546,7 @@ class _MineShopRecharge extends State { } ///充值item - Widget rechargeItem(index) { + Widget rechargeItem(MemberRechargeList memberRechargeList, index) { return Container( width: double.infinity, height: 69.h, @@ -393,12 +554,11 @@ class _MineShopRecharge extends State { borderRadius: BorderRadius.circular(4), border: Border.all( color: - selectIndex == index ? Color(0xFF32A060) : Color(0xFFFAFAFA), + selectIndex == index ? Color(0xFF32A060) : Color(0xFFFAFAFA), width: selectIndex == index ? 1 : 0, ), - color: - selectIndex == index ? Color(0XFFF0FAF4) : Colors.white), - margin: EdgeInsets.only(bottom: 14.h,left: 14.w,right: 14.w), + color: selectIndex == index ? Color(0XFFF0FAF4) : Colors.white), + margin: EdgeInsets.only(bottom: 14.h, left: 14.w, right: 14.w), padding: EdgeInsets.only(left: 16), child: Flex( direction: Axis.horizontal, @@ -419,7 +579,7 @@ class _MineShopRecharge extends State { ), TextSpan( text: - "555元", + "${AppUtils.calculateDouble(double.tryParse(memberRechargeList.rechargeMoney) ?? 0)}元", style: TextStyle( fontSize: 18.sp, fontFamily: 'JDZhengHT', @@ -435,7 +595,7 @@ class _MineShopRecharge extends State { width: 1.w, height: 37.h, color: - selectIndex == index ? Color(0xFF32A060) : Color(0xFF979797), + selectIndex == index ? Color(0xFF32A060) : Color(0xFF979797), margin: EdgeInsets.only(right: 16.w, left: 12), ), Expanded( @@ -457,7 +617,7 @@ class _MineShopRecharge extends State { ), TextSpan( text: - "526元", + "${AppUtils.calculateDouble((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) + (double.tryParse(memberRechargeList.giftdMoney) ?? 0) + ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) - ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) * (discount / 100))))}元", style: TextStyle( fontSize: 18.sp, fontFamily: 'JDZhengHT', @@ -474,7 +634,8 @@ class _MineShopRecharge extends State { GestureDetector( onTap: () { setState(() { - if (selectIndex == index) showRecharge(index); + if (selectIndex == index) + showRecharge(memberRechargeList, index); }); }, child: Row( @@ -521,12 +682,93 @@ class _MineShopRecharge extends State { } ///充值说明底部弹窗 - showRecharge(index) { + showRecharge(MemberRechargeList memberRechargeList, index) { showModalBottomSheet( context: context, backgroundColor: Colors.transparent, builder: (context) { - return RechargeWidget(rechargeActLists.preferentialList[index]); + return Container( + padding: EdgeInsets.only(top: 12), + decoration: new BoxDecoration( + color: Colors.white, + borderRadius: new BorderRadius.only( + topLeft: const Radius.circular(25.0), + topRight: const Radius.circular(25.0))), + child: Container( + height: 355, + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Container( + margin: EdgeInsets.symmetric(vertical: 12.h), + alignment: Alignment.center, + child: Text( + "充值说明", + style: TextStyle( + fontWeight: MyFontWeight.bold, + fontSize: 15.sp, + color: Color(0xFF353535), + ), + ), + )), + GestureDetector( + onTap: () { + setState(() { + Navigator.of(context).pop(); + }); + }, + child: Icon( + Icons.clear, + color: Colors.black, + size: 18, + ), + ), + SizedBox(width: 14), + ], + ), + SizedBox( + height: 12.h, + ), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF2F2F2), + margin: EdgeInsets.only(bottom: 13.h), + ), + Padding( + padding: EdgeInsets.only(left: 14), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Expanded( + child: Container( + color: Colors.white, + child: Html( + data: memberRechargeList?.remark ?? "", + customImageRenders: { + networkSourceMatcher(): + networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, + ), + ), + ) + ], + ), + ) + ], + ), + ))); }); } diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index cd64533f..e2ecbdf2 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -224,7 +224,7 @@ class _MineItem extends State { ], ), SizedBox(height: 12.h,), - if(isShowMore) + // if(isShowMore) Row( children: [ ///我的砍价 @@ -314,9 +314,9 @@ class _MineItem extends State { // ),), ], ), - if(isShowMore) + // if(isShowMore) SizedBox(height: 12.h,), - if(isShowMore) + // if(isShowMore) Row( children: [ ////发票管理 @@ -345,38 +345,39 @@ class _MineItem extends State { Expanded(child:Container(),), ], ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - isShowMore = !isShowMore; - }); - }, - child: Container( - margin: EdgeInsets.symmetric(vertical: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - Text( - (isShowMore != null && !isShowMore)?S.of(context).zhankai: S.of(context).shouqi, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF32A060), - ), - ), - Icon( - (isShowMore != null && !isShowMore) - ? Icons.keyboard_arrow_down - : Icons.keyboard_arrow_up, - color: Color(0xFF32A060), - size: 18, - ), - ], - ),), - ) + ///收起展开 + // GestureDetector( + // behavior: HitTestBehavior.opaque, + // onTap: () { + // setState(() { + // isShowMore = !isShowMore; + // }); + // }, + // child: Container( + // margin: EdgeInsets.symmetric(vertical: 10), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // mainAxisSize: MainAxisSize.max, + // children: [ + // Text( + // (isShowMore != null && !isShowMore)?S.of(context).zhankai: S.of(context).shouqi, + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFF32A060), + // ), + // ), + // Icon( + // (isShowMore != null && !isShowMore) + // ? Icons.keyboard_arrow_down + // : Icons.keyboard_arrow_up, + // color: Color(0xFF32A060), + // size: 18, + // ), + // ], + // ),), + // ) ], ), ); diff --git a/lib/mine/mine_vip/mine_attainment_page.dart b/lib/mine/mine_vip/mine_attainment_page.dart index 71665f2f..c7e1895c 100644 --- a/lib/mine/mine_vip/mine_attainment_page.dart +++ b/lib/mine/mine_vip/mine_attainment_page.dart @@ -20,6 +20,8 @@ import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import '../../view_widget/no_data_view.dart'; + class MineAttainmentPage extends StatefulWidget { final Map arguments; @@ -41,7 +43,6 @@ class _MineAttainmentPage extends State { SocialInfo infoNumber; final RefreshController refreshController = RefreshController(); - @override void dispose() { super.dispose(); @@ -115,7 +116,7 @@ class _MineAttainmentPage extends State { ); BaseData baseData = - await apiService.socialInfo().catchError((onError) {}); + await apiService.socialInfo().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { setState(() { infoNumber = baseData.data; @@ -125,7 +126,7 @@ class _MineAttainmentPage extends State { EasyLoading.dismiss(); } - _onRefresh(){ + _onRefresh() { queryAttainmentBadges(); querySocialInfo(); } @@ -140,151 +141,162 @@ class _MineAttainmentPage extends State { ), ), child: Scaffold( - backgroundColor: Colors.transparent, - appBar: MyAppBar( - title:S.of(context).wodechengjiu, - titleColor: Colors.black, - titleSize: 18.sp, - background: Colors.transparent, - leadingColor: Colors.black, - ), - body: SmartRefresher( - controller: refreshController, - enablePullDown: true, - enablePullUp: false, - header: MyHeader(), - footer: CustomFooter( - builder: (context, mode) { - return MyFooter(mode); - }, - ), - onRefresh:(){ - setState(() { - _onRefresh(); - }); + backgroundColor: Colors.transparent, + appBar: MyAppBar( + title: S.of(context).wodechengjiu, + titleColor: Colors.black, + titleSize: 18.sp, + background: Colors.transparent, + leadingColor: Colors.black, + ), + body: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); }, - physics: BouncingScrollPhysics(), - child: Container( - child: - SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - SizedBox(height: 24), - MImage( - userInfo?.headimg ?? "", - isCircle: true, - width: 58, - height: 58, - fit: BoxFit.cover, - errorSrc: "assets/image/default_user.webp", - fadeSrc: "assets/image/default_user.webp", + ), + onRefresh: () { + setState(() { + _onRefresh(); + }); + }, + physics: BouncingScrollPhysics(), + child: Container( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + SizedBox(height: 24), + MImage( + userInfo?.headimg ?? "", + isCircle: true, + width: 58, + height: 58, + fit: BoxFit.cover, + errorSrc: "assets/image/default_user.webp", + fadeSrc: "assets/image/default_user.webp", + ), + SizedBox(height: 8), + Text( + userInfo?.nickname ?? S.of(context).denglu, + style: TextStyle( + fontSize: 16.sp, + fontWeight: FontWeight.bold, + color: Color(0xFF353535), ), - SizedBox(height: 8), - Text( - userInfo?.nickname ?? S.of(context).denglu, - style: TextStyle( - fontSize: 16.sp, - fontWeight: FontWeight.bold, - color: Color(0xFF353535), - ), + ), + SizedBox(height: 28), + Container( + margin: EdgeInsets.only( + left: 16, right: 16, top: 26, bottom: 8), + padding: EdgeInsets.all(20), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + borderRadius: BorderRadius.all(Radius.circular(8)), ), - SizedBox(height: 28), - Container( - margin: - EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), - padding: EdgeInsets.all(20), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ], - borderRadius: BorderRadius.all(Radius.circular(8)), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - S.of(context).chengjiuhuizhang, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 14.sp, - color: Color(0xFF353535)), - ), - SizedBox(width: 4), - Text( - "(", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 14, - color: Color(0xFF353535)), - ), - Text( - infoNumber != null ? infoNumber.achievementNumber.toString() :"0", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 14, - color: Color(0xFF32A060)), - ), - Text( - "/${vipBadgesList.length})", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 14, - color: Color(0xFF353535)), - ), - ], - ), - SizedBox(height: 12), - attainmentBadge(), - ], - ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + S.of(context).chengjiuhuizhang, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Color(0xFF353535)), + ), + SizedBox(width: 4), + Text( + "(", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14, + color: Color(0xFF353535)), + ), + Text( + infoNumber != null + ? infoNumber.achievementNumber.toString() + : "0", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14, + color: Color(0xFF32A060)), + ), + Text( + "/${vipBadgesList.length})", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14, + color: Color(0xFF353535)), + ), + ], + ), + SizedBox(height: 12), + attainmentBadge(), + ], ), - ], - ), + ), + ], ), ), - ),), + ), + ), + ), ); } ///成就徽章列表 Widget attainmentBadge() { - return GridView.builder( - itemCount: vipBadgesList == null ? 0 : vipBadgesList.length, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - //一行的Widget数量 - crossAxisCount: 3, - //水平子Widget之间间距 - crossAxisSpacing: 13, - //垂直子Widget之间间距 - mainAxisSpacing: 12, - //子Widget宽高比例 - childAspectRatio: AppUtils.textScale(context) > 1 - ? (1 - ((AppUtils.textScale(context) - 1))) - : 0.85, - ), - itemBuilder: (context, index) { - return GestureDetector( - onTap: () { - setState(() { - queryAchievementDetail(index); - }); - }, - child: badgeItem(vipBadgesList[index]), - ); - }, - ); + return (vipBadgesList != null && (vipBadgesList?.length ?? 0) > 0) + ? GridView.builder( + itemCount: vipBadgesList == null ? 0 : vipBadgesList.length, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + //一行的Widget数量 + crossAxisCount: 3, + //水平子Widget之间间距 + crossAxisSpacing: 13, + //垂直子Widget之间间距 + mainAxisSpacing: 12, + //子Widget宽高比例 + childAspectRatio: AppUtils.textScale(context) > 1 + ? (1 - ((AppUtils.textScale(context) - 1))) + : 0.85, + ), + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + setState(() { + queryAchievementDetail(index); + }); + }, + child: badgeItem(vipBadgesList[index]), + ); + }, + ) + : NoDataView( + src: "assets/image/xiao_fei.webp", + isShowBtn: false, + text: "当前暂无成就徽章~", + fontSize: 16.sp, + margin: EdgeInsets.only(left: 60.w, right: 60.w), + ); + ; } Widget badgeItem(VipBadgesList vipBadgesList) { @@ -358,7 +370,7 @@ class _MineAttainmentPage extends State { ), SizedBox(height: 10), Text( - "${vipBadgesList.length >index ?vipBadgesList[index].name :""}${achievementDetail.length > checkPosition ?achievementDetail[checkPosition].name:""}徽章", + "${vipBadgesList.length > index ? vipBadgesList[index].name : ""}${achievementDetail.length > checkPosition ? achievementDetail[checkPosition].name : ""}徽章", style: TextStyle( fontSize: 16.sp, fontWeight: MyFontWeight.semi_bold, @@ -369,7 +381,7 @@ class _MineAttainmentPage extends State { height: 6.h, ), Text( - "再${vipBadgesList.length >index ? vipBadgesList[index].name :""} ${AppUtils.calculateDouble(double.tryParse(achievementDetail.length > checkPosition ?achievementDetail[checkPosition].lessScore :"") ?? 0)} 即可升级", + "再${vipBadgesList.length > index ? vipBadgesList[index].name : ""} ${AppUtils.calculateDouble(double.tryParse(achievementDetail.length > checkPosition ? achievementDetail[checkPosition].lessScore : "") ?? 0)} 即可升级", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.regular, @@ -392,27 +404,29 @@ class _MineAttainmentPage extends State { ), SizedBox(width: 8), Column( - crossAxisAlignment:CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: - achievementDetail[checkPosition].rewardList != null - ? achievementDetail[checkPosition].rewardList.map((e) { - return Text( - rewardStr(e), - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - color: Color(0xFF515151)), - ); - }).toList() - : [], + achievementDetail[checkPosition].rewardList != null + ? achievementDetail[checkPosition] + .rewardList + .map((e) { + return Text( + rewardStr(e), + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + color: Color(0xFF515151)), + ); + }).toList() + : [], ), ], ), Expanded( child: Container( height: double.maxFinite, - margin: EdgeInsets.only(top:14), + margin: EdgeInsets.only(top: 14), child: ListView.builder( shrinkWrap: true, scrollDirection: Axis.horizontal, @@ -443,12 +457,12 @@ class _MineAttainmentPage extends State { ); } - String rewardStr(RewardList rewardList){ - if(rewardList.rewardType == 1) + String rewardStr(RewardList rewardList) { + if (rewardList.rewardType == 1) return "积分:${rewardList.refId}"; - else if(rewardList.rewardType == 2) + else if (rewardList.rewardType == 2) return "平台余额:${rewardList.refId}"; - else if(rewardList.rewardType == 3) + else if (rewardList.rewardType == 3) return "平台兑换券:${rewardList.couponName}"; return ""; } diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart index abd7ef2f..5f946c78 100644 --- a/lib/mine/recharge_page.dart +++ b/lib/mine/recharge_page.dart @@ -19,9 +19,14 @@ import 'package:huixiang/utils/min.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/recharge_details_dialog.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:tobias/tobias.dart' as tobias; +import '../view_widget/classic_header.dart'; +import '../view_widget/my_footer.dart'; +import '../view_widget/no_data_view.dart'; + class RechargePage extends StatefulWidget { @override State createState() { @@ -43,19 +48,13 @@ class _RechargePage extends State { RechargeActLists rechargeActLists; int selectStoreIndex = 0; String recommendName; + final RefreshController refreshController = RefreshController(); + int _loadCount = 0; @override void initState() { super.initState(); - - SharedPreferences.getInstance().then((value) { - apiService = ApiService(Dio(), - context: context, token: value.getString("token"), pay: true); - queryBenefitList(); - queryRuleDetails(); - queryRechargeActList(); - queryUserBalance(); - }); + _onRefresh(); payListen = weChatResponseEventHandler.listen((event) async { print("payCallback: ${event.errCode}"); if (event.errCode == 0) { @@ -77,10 +76,10 @@ class _RechargePage extends State { ///会员权益列表 queryBenefitList() async { - BaseData> baseData = - await apiService.benefitList().catchError((onError) {}); - if (baseData != null && baseData.isSuccess) { - setState(() { + try { + BaseData> baseData = + await apiService.benefitList().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { vipBenefitList.clear(); vipBenefitList.addAll(baseData.data); vipBenefitList.forEach((element) { @@ -90,51 +89,77 @@ class _RechargePage extends State { discount = double.parse(element.config); } }); - }); + } + } finally { + addLoadCount(); } - EasyLoading.dismiss(); } queryUserBalance() async { - BaseData baseData = - await apiService.queryInfo().catchError((onError) {}); - if (baseData != null && baseData.isSuccess) { - userInfo = baseData.data; - mBalance = userInfo?.money ?? "0"; - if (mounted) setState(() {}); + try { + BaseData baseData = + await apiService.queryInfo().catchError((onError) { + SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type), + alignment: Alignment.center); + refreshController.refreshFailed(); + refreshController.loadFailed(); + }); + if (baseData != null && baseData.isSuccess) { + userInfo = baseData.data; + mBalance = userInfo?.money ?? "0"; + } + } finally { + addLoadCount(); } } ///会员权益介绍/规则/说明/储值说明 queryRuleDetails() async { - BaseData baseData = - await apiService.vipBenefit().catchError((onError) {}); - if (baseData != null && baseData.isSuccess) { - setState(() { + try { + BaseData baseData = + await apiService.vipBenefit().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { vipRuleDetails = baseData.data; - }); + } + } finally { + addLoadCount(); } - EasyLoading.dismiss(); } ///充值列表 queryRechargeActList() async { - if (apiService == null) { - SharedPreferences value = await SharedPreferences.getInstance(); - apiService = ApiService( - Dio(), - context: context, - token: value.getString("token"), - ); - } - BaseData baseData = - await apiService.rechargeActList().catchError((onError) {}); - if (baseData != null && baseData.isSuccess) { - setState(() { + try { + BaseData baseData = + await apiService.rechargeActList("admin").catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { rechargeActLists = baseData.data; - }); + } + } finally { + addLoadCount(); + } + } + + _onRefresh() async { + EasyLoading.show( + status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); + SharedPreferences value = await SharedPreferences.getInstance(); + if (apiService == null) + apiService = ApiService(Dio(), + context: context, token: value.getString("token"), pay: true); + queryBenefitList(); + queryRuleDetails(); + queryRechargeActList(); + queryUserBalance(); + } + + addLoadCount() { + _loadCount += 1; + if (_loadCount == 4) { + _loadCount = 0; + EasyLoading.dismiss(); + if (refreshController.isRefresh) refreshController.refreshCompleted(); + if (mounted) setState(() {}); } - EasyLoading.dismiss(); } @override @@ -148,403 +173,423 @@ class _RechargePage extends State { leadingColor: Colors.black, ), body: Container( - color: Color(0xFFFFFFFF), - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - child: Column( - children: [ - Container( - margin: EdgeInsets.only(left: 16, right: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - // ItemInputWidget( - // S.of(context).qingshuruchongzhijine, - // hintText: "", - // controller: controller, - // padding: EdgeInsets.all(20), - // errorText: S.of(context).chongzhizuixiaojine(100), - // titleColor: Color(0xFF727272), - // errorTextColor: Color(0xFF32A060), - // radius: 8, - // discount: discount / 10, - // style: TextStyle( - // fontWeight: FontWeight.bold, - // fontSize: 27.sp, - // color: color, - // ), - // inputLimit: 6, - // textInputType: TextInputType.number, - // textInputFormatter: - // FilteringTextInputFormatter.digitsOnly, - // onChanged: (value) { - // if (value != null && - // value != "" && - // double.tryParse(value) < 100) { - // color = Colors.red; - // } else { - // color = Colors.black; - // } - // setState(() {}); - // }, - // ), - SizedBox( - height: 20, - ), - Row( + color: Color(0xFFFFFFFF), + child: SmartRefresher( + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + controller: refreshController, + onRefresh: _onRefresh, + physics: BouncingScrollPhysics(), + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + child: Column( + children: [ + Container( + margin: EdgeInsets.only(left: 16, right: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - Expanded( - child: Text( + // ItemInputWidget( + // S.of(context).qingshuruchongzhijine, + // hintText: "", + // controller: controller, + // padding: EdgeInsets.all(20), + // errorText: S.of(context).chongzhizuixiaojine(100), + // titleColor: Color(0xFF727272), + // errorTextColor: Color(0xFF32A060), + // radius: 8, + // discount: discount / 10, + // style: TextStyle( + // fontWeight: FontWeight.bold, + // fontSize: 27.sp, + // color: color, + // ), + // inputLimit: 6, + // textInputType: TextInputType.number, + // textInputFormatter: + // FilteringTextInputFormatter.digitsOnly, + // onChanged: (value) { + // if (value != null && + // value != "" && + // double.tryParse(value) < 100) { + // color = Colors.red; + // } else { + // color = Colors.black; + // } + // setState(() {}); + // }, + // ), + SizedBox( + height: 20, + ), + Row( + children: [ + Expanded( + child: Text( S.of(context).zhanghuyue, style: TextStyle( fontSize: 15.sp, color: Color(0xFF181818), fontFamily: 'JDZhengHT', - fontWeight: - MyFontWeight.semi_bold), + fontWeight: MyFontWeight.semi_bold), )), - Text.rich( - TextSpan(children: [ - TextSpan( - text: "$mBalance", - style: TextStyle( - fontSize: 26.sp, - fontFamily: 'JDZhengHT', - color: Color(0xFF181818), - fontWeight: - MyFontWeight.semi_bold), - ), - TextSpan( - text: "元", - style: TextStyle( - fontSize: 15.sp, - color: Color(0xFF181818), - fontWeight: - MyFontWeight.semi_bold), + Text.rich( + TextSpan(children: [ + TextSpan( + text: "$mBalance", + style: TextStyle( + fontSize: 26.sp, + fontFamily: 'JDZhengHT', + color: Color(0xFF181818), + fontWeight: MyFontWeight.semi_bold), + ), + TextSpan( + text: "元", + style: TextStyle( + fontSize: 15.sp, + color: Color(0xFF181818), + fontWeight: MyFontWeight.semi_bold), + ), + ]), ), - ]), + ], ), + SizedBox(height: 28), + rechargeList(), + // Row( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisAlignment: MainAxisAlignment.spaceAround, + // children: [ + // if (vipRuleDetails?.recharge != null && + // vipRuleDetails.recharge != "") + // Expanded( + // child: Container( + // color: Colors.white, + // child: Html( + // data: "注意:${vipRuleDetails?.recharge ?? ""}", + // customImageRenders: { + // networkSourceMatcher(): networkImageRender( + // loadingWidget: () { + // return Container(); + // }, + // ), + // }, + // ), + // ), + // ) + // ], + // ), ], + )), + if (rechargeActLists != null && + (rechargeActLists?.preferentialList?.length ?? 0) > 0) + Container( + width: double.infinity, + margin: EdgeInsets.only(left: 16, right: 16), + padding: EdgeInsets.only( + top: 20.h, + bottom: 24.h, ), - SizedBox(height: 28), - rechargeList(), - // Row( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.spaceAround, - // children: [ - // if (vipRuleDetails?.recharge != null && - // vipRuleDetails.recharge != "") - // Expanded( - // child: Container( - // color: Colors.white, - // child: Html( - // data: "注意:${vipRuleDetails?.recharge ?? ""}", - // customImageRenders: { - // networkSourceMatcher(): networkImageRender( - // loadingWidget: () { - // return Container(); - // }, - // ), - // }, - // ), - // ), - // ) - // ], + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.circular(4), // ), - ], - )), - Container( - width: double.infinity, - margin: EdgeInsets.only(left: 16, right: 16), - padding: EdgeInsets.only( - top: 20.h, - bottom: 24.h, - ), - // decoration: BoxDecoration( - // color: Colors.white, - // borderRadius: BorderRadius.circular(4), - // ), - child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(bottom: 16.h), - child: Text( - S.of(context).zhifufangshi, - style: TextStyle( - fontSize: 16.sp, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - checkIndex = 2; - }); - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset( - "assets/image/icon_we_chat.webp"), - Expanded( - flex: 1, - child: Padding( - padding: EdgeInsets.only(left: 8.w), - child: Text( - S.of(context).weixinzhifu, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - ), + Padding( + padding: EdgeInsets.only(bottom: 16.h), + child: Text( + S.of(context).zhifufangshi, + style: TextStyle( + fontSize: 16.sp, + color: Colors.black, + fontWeight: FontWeight.bold, ), ), ), - checkView(2), - ], - ), - ), - SizedBox(height: 10.h), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - checkIndex = 3; - }); - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Image.asset( - "assets/image/icon_alipay.webp"), - Expanded( - flex: 1, - child: Padding( - padding: EdgeInsets.only(left: 8.w), - child: Text( - S.of(context).zhifubao, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + checkIndex = 2; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset("assets/image/icon_we_chat.webp"), + Expanded( + flex: 1, + child: Padding( + padding: EdgeInsets.only(left: 8.w), + child: Text( + S.of(context).weixinzhifu, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + ), + ), + ), ), - ), + checkView(2), + ], + ), + ), + SizedBox(height: 10.h), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + checkIndex = 3; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset("assets/image/icon_alipay.webp"), + Expanded( + flex: 1, + child: Padding( + padding: EdgeInsets.only(left: 8.w), + child: Text( + S.of(context).zhifubao, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + ), + ), + ), + ), + checkView(3), + ], ), ), - checkView(3), ], ), ), - ], - ), - ), - if((rechargeActLists?.isOpen ?? false) == true) - GestureDetector( - onTap: () { - showRecommendStore(); - }, - child: Container( - padding: EdgeInsets.only( - left: 14.w, - right: 16.w, - top: 14.h, - bottom: 14.h), - margin: EdgeInsets.only( - bottom: 22.h, left: 14.w, right: 14.w), - decoration: BoxDecoration( - color: Color(0xFFFAFAFA), - borderRadius: BorderRadius.circular(4), - ), - child: Row( - children: [ - Image.asset( - "assets/image/recharge_z.webp", - width: 16.w, - height: 17.h, - fit: BoxFit.fill, + if ((rechargeActLists?.isOpen ?? false) == true) + GestureDetector( + onTap: () { + showRecommendStore(); + }, + child: Container( + padding: EdgeInsets.only( + left: 14.w, + right: 16.w, + top: 14.h, + bottom: 14.h), + margin: EdgeInsets.only( + bottom: 22.h, left: 14.w, right: 14.w), + decoration: BoxDecoration( + color: Color(0xFFFAFAFA), + borderRadius: BorderRadius.circular(4), ), - SizedBox(width: 8.w), - Expanded( - child: Text( - recommendName ??"为喜爱门店打call!(可选)", + child: Row( + children: [ + Image.asset( + "assets/image/recharge_z.webp", + width: 16.w, + height: 17.h, + fit: BoxFit.fill, + ), + SizedBox(width: 8.w), + Expanded( + child: Text( + recommendName ?? "为喜爱门店打call!(可选)", style: TextStyle( fontWeight: MyFontWeight.regular, fontSize: 12.sp, - color: (recommendName != null) ?Color(0xFF32A060):Color(0xFF868686), + color: (recommendName != null) + ? Color(0xFF32A060) + : Color(0xFF868686), ), )), - Icon( - Icons.arrow_forward_ios, - size: 16, - ), - ], - )), - ), - Align( - alignment: Alignment.bottomCenter, - child: GestureDetector( - onTap: () { - recharge(); - }, - child: Container( - height: 56.h, - width: double.infinity, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(27), + Icon( + Icons.arrow_forward_ios, + size: 16, + ), + ], + )), ), - margin: EdgeInsets.only( - left: 16, right: 16, bottom: 21), - child: Text( - S.of(context).querenchongzhi, - style: TextStyle( - fontSize: 16.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, + if (rechargeActLists != null && + (rechargeActLists?.preferentialList?.length ?? 0) > 0) + Align( + alignment: Alignment.bottomCenter, + child: GestureDetector( + onTap: () { + recharge(); + }, + child: Container( + height: 56.h, + width: double.infinity, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(27), + ), + margin: EdgeInsets.only( + left: 16, right: 16, bottom: 21), + child: Text( + S.of(context).querenchongzhi, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), ), - ), - ), - ), - - // Container( - // height: 56.h, - // color: Colors.white, - // child: Row( - // children: [ - // Expanded(child:Container( - // padding:EdgeInsets.only(top: 7.h,left:16), - // child:Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Row( - // children: [ - // Text( - // S.of(context).heji, - // style: TextStyle( - // fontSize: 14.sp, - // fontWeight: MyFontWeight.regular, - // color: Colors.black, - // ), - // ), - // Text( - // controller.text, - // style: TextStyle( - // fontSize: 16.sp, - // fontWeight: MyFontWeight.medium, - // color: Color(0xFF32A060), - // ), - // ), - // ], - // ), - // if(controller.text != "") - // Text.rich( - // TextSpan( - // children: [ - // TextSpan( - // text: "充值", - // style: TextStyle( - // fontSize:12.sp, - // fontWeight: MyFontWeight.regular, - // color: Color(0xFFADADAD), - // ), - // ), - // TextSpan( - // text:"¥${controller.text}", - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.regular, - // color:Color(0xff3541C9), - // ), - // ), - // TextSpan( - // text: "赠送", - // style: TextStyle( - // fontSize:12.sp, - // fontWeight: MyFontWeight.regular, - // color: Color(0xFFADADAD), - // ), - // ), - // TextSpan( - // text:"¥${((double.tryParse(controller.text)??0) - ((double.tryParse(controller.text)??0) * (discount/100))).toStringAsFixed(2)}", - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.regular, - // color: Color(0xff3541C9), - // ), - // ),TextSpan( - // text: "元", - // style: TextStyle( - // fontSize:12.sp, - // fontWeight: MyFontWeight.regular, - // color: Color(0xFFADADAD), - // ), - // ), - // ], - // ), - // ), - // ], - // )) - // ), - // GestureDetector( - // onTap: () { - // recharge(); - // }, - // child: RoundButton( - // width: 103.w, - // height: 54.h, - // text: S.of(context).chongzhi, - // textColor: Colors.white, - // fontWeight: MyFontWeight.regular, - // backgroup: Color(0xFF32A060), - // radius: 0, - // fontSize: 16.sp, - // padding: EdgeInsets.symmetric(vertical: 5.h), - // ), - // ), - // ], - // ), - // ) - ) - ], + // Container( + // height: 56.h, + // color: Colors.white, + // child: Row( + // children: [ + // Expanded(child:Container( + // padding:EdgeInsets.only(top: 7.h,left:16), + // child:Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // children: [ + // Text( + // S.of(context).heji, + // style: TextStyle( + // fontSize: 14.sp, + // fontWeight: MyFontWeight.regular, + // color: Colors.black, + // ), + // ), + // Text( + // controller.text, + // style: TextStyle( + // fontSize: 16.sp, + // fontWeight: MyFontWeight.medium, + // color: Color(0xFF32A060), + // ), + // ), + // ], + // ), + // if(controller.text != "") + // Text.rich( + // TextSpan( + // children: [ + // TextSpan( + // text: "充值", + // style: TextStyle( + // fontSize:12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFFADADAD), + // ), + // ), + // TextSpan( + // text:"¥${controller.text}", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color:Color(0xff3541C9), + // ), + // ), + // TextSpan( + // text: "赠送", + // style: TextStyle( + // fontSize:12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFFADADAD), + // ), + // ), + // TextSpan( + // text:"¥${((double.tryParse(controller.text)??0) - ((double.tryParse(controller.text)??0) * (discount/100))).toStringAsFixed(2)}", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xff3541C9), + // ), + // ),TextSpan( + // text: "元", + // style: TextStyle( + // fontSize:12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFFADADAD), + // ), + // ), + // ], + // ), + // ), + // ], + // )) + // ), + // GestureDetector( + // onTap: () { + // recharge(); + // }, + // child: RoundButton( + // width: 103.w, + // height: 54.h, + // text: S.of(context).chongzhi, + // textColor: Colors.white, + // fontWeight: MyFontWeight.regular, + // backgroup: Color(0xFF32A060), + // radius: 0, + // fontSize: 16.sp, + // padding: EdgeInsets.symmetric(vertical: 5.h), + // ), + // ), + // ], + // ), + // ) + ) + ], + ), + ), ), - ), - ), - ), + )), ); } var checkIndex = 2; Widget rechargeList() { - return ListView.builder( - padding: EdgeInsets.zero, - itemCount: (rechargeActLists != null && (rechargeActLists?.preferentialList?.length ?? 0) > 0) ? rechargeActLists.preferentialList.length : 0, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - setState(() { - selectIndex = position; - }); + return (rechargeActLists != null && + (rechargeActLists?.preferentialList?.length ?? 0) > 0) + ? ListView.builder( + padding: EdgeInsets.zero, + itemCount: (rechargeActLists != null && + (rechargeActLists?.preferentialList?.length ?? 0) > 0) + ? rechargeActLists.preferentialList.length + : 0, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + setState(() { + selectIndex = position; + }); + }, + child: rechargeItem( + rechargeActLists.preferentialList[position], position)); }, - child: rechargeItem(rechargeActLists.preferentialList[position], position)); - }, - ); + ) + : NoDataView( + src: "assets/image/xiao_fei.webp", + isShowBtn: false, + text: "暂无充值套餐~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 90.h, left: 60.w, right: 60.w), + ); } Widget rechargeItem(PreferentialList preferentialList, index) { @@ -695,13 +740,13 @@ class _RechargePage extends State { ///选择推荐门店 showRecommendStore() { showModalBottomSheet( - context: context, - backgroundColor: Colors.transparent, + context: context, + backgroundColor: Colors.transparent, builder: (BuildContext context) { return StatefulBuilder(builder: ( - context, - state, - ) { + context, + state, + ) { return Container( height: 355.h, decoration: BoxDecoration( @@ -719,17 +764,17 @@ class _RechargePage extends State { children: [ Expanded( child: Container( - alignment: Alignment.center, - margin: EdgeInsets.symmetric(vertical: 12), - child: Text( - S.of(context).xuanzetuijianmendian, - style: TextStyle( - fontWeight: MyFontWeight.bold, - fontSize: 15.sp, - color: Color(0xFF353535), - ), - ), - )), + alignment: Alignment.center, + margin: EdgeInsets.symmetric(vertical: 12), + child: Text( + S.of(context).xuanzetuijianmendian, + style: TextStyle( + fontWeight: MyFontWeight.bold, + fontSize: 15.sp, + color: Color(0xFF353535), + ), + ), + )), GestureDetector( onTap: () { setState(() { @@ -752,24 +797,24 @@ class _RechargePage extends State { ), Expanded( child: ListView.builder( - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - state(() { - selectStoreIndex = position; - }); - }, - child: recommendStoreItem(position), - ); + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + state(() { + selectStoreIndex = position; + }); }, - itemCount: rechargeActLists.channels.length ?? 0, - )), + child: recommendStoreItem(position), + ); + }, + itemCount: rechargeActLists.channels.length ?? 0, + )), GestureDetector( onTap: () { setState(() { recommendName = - rechargeActLists.channels[selectStoreIndex]; + rechargeActLists.channels[selectStoreIndex]; Navigator.of(context).pop(); }); }, @@ -797,7 +842,8 @@ class _RechargePage extends State { ), ); }); - },); + }, + ); } Widget recommendStoreItem(index) { diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index 8e37518e..f6011da1 100644 --- a/lib/order/order_history_page.dart +++ b/lib/order/order_history_page.dart @@ -1,5 +1,6 @@ import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/order/order_utils.dart'; @@ -133,57 +134,29 @@ class OrderHistoryList extends StatefulWidget { class _OrderHistoryList extends State with AutomaticKeepAliveClientMixin { final RefreshController refreshController = RefreshController(); - - @override - Widget build(BuildContext context) { - super.build(context); - return SmartRefresher( - controller: refreshController, - enablePullDown: true, - enablePullUp: true, - physics: BouncingScrollPhysics(), - header: MyHeader(), - footer: CustomFooter( - builder: (context, mode) { - return MyFooter(mode); - }, - ), - onRefresh: _onRefresh, - onLoading: queryOrder, - child: (orderInfos != null && orderInfos.length > 0) - ? ListView.builder( - itemCount: orderInfos != null ? orderInfos.length : 0, - itemBuilder: (context, position) { - return InkWell( - onTap: () { - Navigator.of(context).pushNamed('/router/order_details', - arguments: {"id": orderInfos[position].id,"jumpState":2}); - }, - child: orderItem(orderInfos[position]), - ); - }) - : NoDataView( - src: "assets/image/ding_dan.webp", - isShowBtn: false, - text: "目前暂无订单,快去下一单吧~", - fontSize: 16.sp, - margin: EdgeInsets.only(top: 120), - ), - ); - } - bool isRemake = true; - ApiService apiService; int current = 1; + List orderInfos = []; + UserInfo userInfo; + @override + void initState() { + super.initState(); + SharedPreferences.getInstance().then((value) => { + apiService = ApiService(Dio(), + showLoading: true, + context: context, + token: value.getString("token")), + queryOrder(), + queryUserBalance(), + }); + } _onRefresh() { current = 1; queryOrder(); } - List orderInfos = []; - queryOrder() async { BaseData> baseData = await apiService.orderList({ "current": current, @@ -214,24 +187,173 @@ class _OrderHistoryList extends State } setState(() {}); } else { - SmartDialog.showToast(baseData?.msg ?? "",alignment: Alignment.center); + if((baseData?.msg ?? "") != "") + SmartDialog.showToast(baseData.msg,alignment: Alignment.center); refreshController.refreshFailed(); refreshController.loadFailed(); } } - @override - void initState() { - super.initState(); - - SharedPreferences.getInstance().then((value) => { - apiService = ApiService(Dio(), - showLoading: true, + minLogin(OrderInfo orderInfo) { + apiService.minLogin(orderInfo.storeId).catchError((onError) { + debugPrint(onError); + }).then((baseData) { + if (baseData != null && baseData.isSuccess) { + Map minStoreInfo = baseData.data; + String minToken = minStoreInfo["token"]; + String tenant = orderInfo.tenantCode; + String storeId = orderInfo.storeId; + SharedPreferences.getInstance().then( + (value) => { + value.setString('minToken', minToken), + value.setString('tenant', tenant), + value.setString('storeId', storeId), + }, + ); + paySelected( + orderInfo, + MinApiService( + Dio(), context: context, - token: value.getString("token")), - queryOrder(), - queryUserBalance(), - }); + token: minToken, + tenant: tenant, + storeId: storeId, + )); + } + }); + } + + queryDetails(id) 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(id).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + return baseData.data; + } + } + + queryUserBalance() async { + BaseData baseData = + await apiService.queryInfo().catchError((onError) { + + }); + if (baseData != null && baseData.isSuccess) { + userInfo = baseData.data; + if (mounted) setState(() {}); + }else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + + paySelected(OrderInfo orderInfo, MinApiService minService) async { + var payChannel = await showModalBottomSheet( + context: context, + backgroundColor: Colors.transparent, + builder: (context) { + return OrderPaySelected(userInfo); + }, + ); + if (payChannel != null && payChannel > 0) { + orderInfo = await queryDetails(orderInfo.id); + OrderUtils.carryOnPay( + payChannel, + minService, + orderInfo, + (BaseData baseData) { + SmartDialog.showToast( + baseData?.msg == "ok" ? "订单支付成功" : baseData?.msg, + alignment: Alignment.center); + Future.delayed(Duration(seconds: 3), () { + _onRefresh(); + }); + }, + ); + } + } + + payResult(BaseData baseData) {} + + orderCancel(String orderId) async { + BaseData baseData = + await apiService.orderCancel(orderId).catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + SmartDialog.showToast("订单取消成功"); + _onRefresh(); + }else{ + if(baseData.msg != null) + SmartDialog.showToast(baseData.msg,alignment: Alignment.center); + } + } + + aginOrder(OrderInfo orderInfo) { + // Navigator.of(context).pushNamed( + // '/router/union_detail_page', + // arguments: {"id": storeId}, + // ); + // String storeId = (orderInfo != null && + // orderInfo.storeVO != null) + // ? (orderInfo.storeVO.id ?? "") + // : ""; + + if (orderInfo.storeVO.posType.code == "NORMALSTORE") { + Scan.toScan( + context, + orderInfo.storeVO.id, + orderInfo.tenantCode, + orderInfo.storeVO.storeName, + ); + } else { + Navigator.of(context).pushNamed( + '/router/store_order', + arguments: { + "id": orderInfo.storeVO.id, + "tenant": orderInfo.tenantCode, + "storeName": orderInfo.storeVO.storeName + }, + ); + } + } + + @override + Widget build(BuildContext context) { + super.build(context); + return SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: true, + physics: BouncingScrollPhysics(), + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: _onRefresh, + onLoading: queryOrder, + child: (orderInfos != null && orderInfos.length > 0) + ? ListView.builder( + itemCount: orderInfos != null ? orderInfos.length : 0, + itemBuilder: (context, position) { + return InkWell( + onTap: () { + Navigator.of(context).pushNamed('/router/order_details', + arguments: {"id": orderInfos[position].id,"jumpState":2}); + }, + child: orderItem(orderInfos[position]), + ); + }) + : NoDataView( + src: "assets/image/ding_dan.webp", + isShowBtn: false, + text: "目前暂无订单,快去下一单吧~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120), + ), + ); } String orderAllGoods(OrderInfo orderInfo) { @@ -536,130 +658,6 @@ class _OrderHistoryList extends State ); } - minLogin(OrderInfo orderInfo) { - apiService.minLogin(orderInfo.storeId).catchError((onError) { - debugPrint(onError); - }).then((baseData) { - if (baseData != null && baseData.isSuccess) { - Map minStoreInfo = baseData.data; - String minToken = minStoreInfo["token"]; - String tenant = orderInfo.tenantCode; - String storeId = orderInfo.storeId; - SharedPreferences.getInstance().then( - (value) => { - value.setString('minToken', minToken), - value.setString('tenant', tenant), - value.setString('storeId', storeId), - }, - ); - paySelected( - orderInfo, - MinApiService( - Dio(), - context: context, - token: minToken, - tenant: tenant, - storeId: storeId, - )); - } - }); - } - - queryDetails(id) 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(id).catchError((error) {}); - if (baseData != null && baseData.isSuccess) { - return baseData.data; - } - } - - UserInfo userInfo; - - queryUserBalance() async { - BaseData baseData = - await apiService.queryInfo().catchError((onError) {}); - if (baseData != null && baseData.isSuccess) { - userInfo = baseData.data; - if (mounted) setState(() {}); - }else { - SmartDialog.showToast(baseData.msg, alignment: Alignment.center); - } - } - - paySelected(OrderInfo orderInfo, MinApiService minService) async { - var payChannel = await showModalBottomSheet( - context: context, - backgroundColor: Colors.transparent, - builder: (context) { - return OrderPaySelected(userInfo); - }, - ); - if (payChannel != null && payChannel > 0) { - orderInfo = await queryDetails(orderInfo.id); - OrderUtils.carryOnPay( - payChannel, - minService, - orderInfo, - (BaseData baseData) { - SmartDialog.showToast( - baseData?.msg == "ok" ? "订单支付成功" : baseData?.msg, - alignment: Alignment.center); - Future.delayed(Duration(seconds: 3), () { - _onRefresh(); - }); - }, - ); - } - } - - payResult(BaseData baseData) {} - - orderCancel(String orderId) async { - BaseData baseData = - await apiService.orderCancel(orderId).catchError((onError) {}); - if (baseData != null && baseData.isSuccess) { - SmartDialog.showToast("订单取消成功"); - _onRefresh(); - }else{ - if(baseData.msg != null) - SmartDialog.showToast(baseData.msg,alignment: Alignment.center); - } - } - - aginOrder(OrderInfo orderInfo) { - // Navigator.of(context).pushNamed( - // '/router/union_detail_page', - // arguments: {"id": storeId}, - // ); - // String storeId = (orderInfo != null && - // orderInfo.storeVO != null) - // ? (orderInfo.storeVO.id ?? "") - // : ""; - - if (orderInfo.storeVO.posType.code == "NORMALSTORE") { - Scan.toScan( - context, - orderInfo.storeVO.id, - orderInfo.tenantCode, - orderInfo.storeVO.storeName, - ); - } else { - Navigator.of(context).pushNamed( - '/router/store_order', - arguments: { - "id": orderInfo.storeVO.id, - "tenant": orderInfo.tenantCode, - "storeName": orderInfo.storeVO.storeName - }, - ); - } - } - String totalPrice(orderInfo) { if (orderInfo == null) return ""; double totalPrice = (double.tryParse(orderInfo.orderSum) + diff --git a/lib/retrofit/data/member_recharge_list.dart b/lib/retrofit/data/member_recharge_list.dart new file mode 100644 index 00000000..30c207d0 --- /dev/null +++ b/lib/retrofit/data/member_recharge_list.dart @@ -0,0 +1,159 @@ +/// id : "1681490552371019776" +/// rechargeMoney : "100.00" +/// giftdMoney : "10.00" +/// limitNum : 0 +/// gitfdCouponId : null +/// startDate : null +/// endDate : null +/// startTime : null +/// endTime : null +/// tenantCode : "1175" +/// createTime : "2023-07-21 09:22:53" +/// isDeleted : 0 +/// rechargeType : 0 +/// remark : "充值100.00 赠送10.00" +/// sortValue : 0 +/// useNum : 0 + +class MemberRechargeList { + MemberRechargeList({ + String id, + String rechargeMoney, + String giftdMoney, + num limitNum, + dynamic gitfdCouponId, + dynamic startDate, + dynamic endDate, + dynamic startTime, + dynamic endTime, + String tenantCode, + String createTime, + num isDeleted, + num rechargeType, + String remark, + num sortValue, + num useNum,}){ + _id = id; + _rechargeMoney = rechargeMoney; + _giftdMoney = giftdMoney; + _limitNum = limitNum; + _gitfdCouponId = gitfdCouponId; + _startDate = startDate; + _endDate = endDate; + _startTime = startTime; + _endTime = endTime; + _tenantCode = tenantCode; + _createTime = createTime; + _isDeleted = isDeleted; + _rechargeType = rechargeType; + _remark = remark; + _sortValue = sortValue; + _useNum = useNum; +} + + MemberRechargeList.fromJson(dynamic json) { + _id = json['id']; + _rechargeMoney = json['rechargeMoney']; + _giftdMoney = json['giftdMoney']; + _limitNum = json['limitNum']; + _gitfdCouponId = json['gitfdCouponId']; + _startDate = json['startDate']; + _endDate = json['endDate']; + _startTime = json['startTime']; + _endTime = json['endTime']; + _tenantCode = json['tenantCode']; + _createTime = json['createTime']; + _isDeleted = json['isDeleted']; + _rechargeType = json['rechargeType']; + _remark = json['remark']; + _sortValue = json['sortValue']; + _useNum = json['useNum']; + } + String _id; + String _rechargeMoney; + String _giftdMoney; + num _limitNum; + dynamic _gitfdCouponId; + dynamic _startDate; + dynamic _endDate; + dynamic _startTime; + dynamic _endTime; + String _tenantCode; + String _createTime; + num _isDeleted; + num _rechargeType; + String _remark; + num _sortValue; + num _useNum; +MemberRechargeList copyWith({ String id, + String rechargeMoney, + String giftdMoney, + num limitNum, + dynamic gitfdCouponId, + dynamic startDate, + dynamic endDate, + dynamic startTime, + dynamic endTime, + String tenantCode, + String createTime, + num isDeleted, + num rechargeType, + String remark, + num sortValue, + num useNum, +}) => MemberRechargeList( id: id ?? _id, + rechargeMoney: rechargeMoney ?? _rechargeMoney, + giftdMoney: giftdMoney ?? _giftdMoney, + limitNum: limitNum ?? _limitNum, + gitfdCouponId: gitfdCouponId ?? _gitfdCouponId, + startDate: startDate ?? _startDate, + endDate: endDate ?? _endDate, + startTime: startTime ?? _startTime, + endTime: endTime ?? _endTime, + tenantCode: tenantCode ?? _tenantCode, + createTime: createTime ?? _createTime, + isDeleted: isDeleted ?? _isDeleted, + rechargeType: rechargeType ?? _rechargeType, + remark: remark ?? _remark, + sortValue: sortValue ?? _sortValue, + useNum: useNum ?? _useNum, +); + String get id => _id; + String get rechargeMoney => _rechargeMoney; + String get giftdMoney => _giftdMoney; + num get limitNum => _limitNum; + dynamic get gitfdCouponId => _gitfdCouponId; + dynamic get startDate => _startDate; + dynamic get endDate => _endDate; + dynamic get startTime => _startTime; + dynamic get endTime => _endTime; + String get tenantCode => _tenantCode; + String get createTime => _createTime; + num get isDeleted => _isDeleted; + num get rechargeType => _rechargeType; + String get remark => _remark; + num get sortValue => _sortValue; + num get useNum => _useNum; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['rechargeMoney'] = _rechargeMoney; + map['giftdMoney'] = _giftdMoney; + map['limitNum'] = _limitNum; + map['gitfdCouponId'] = _gitfdCouponId; + map['startDate'] = _startDate; + map['endDate'] = _endDate; + map['startTime'] = _startTime; + map['endTime'] = _endTime; + map['tenantCode'] = _tenantCode; + map['createTime'] = _createTime; + map['isDeleted'] = _isDeleted; + map['rechargeType'] = _rechargeType; + map['remark'] = _remark; + map['sortValue'] = _sortValue; + map['useNum'] = _useNum; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 6415e490..c8cf737b 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -19,6 +19,7 @@ import 'data/activity_order_list.dart'; import 'data/findMiNiGroupList.dart'; import 'data/home_recommend_list.dart'; import 'data/launch_join_act.dart'; +import 'data/member_recharge_list.dart'; import 'data/miNiDetail.dart'; import 'data/settleOrderInfo.dart'; import 'data/shoppingCart.dart'; @@ -243,4 +244,13 @@ abstract class MinApiService { @POST("promotion/useMemberCoupon") Future useMemberCoupon(@Body() Map param); + ///商户充值 + @POST("/member/recharge") + Future> memberRecharge(@Body() Map param); + + ///充值列表 + @GET("/store/getRechargePreferential") + Future>> memberRechargeList(); + + } diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index a1aac3c6..215825a0 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -651,4 +651,49 @@ class _MinApiService implements MinApiService { ); return value; } + + @override + Future> memberRecharge(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('//member/recharge', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } + + @override + Future>> memberRechargeList() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/store/getRechargePreferential', + 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) => MemberRechargeList.fromJson(i as Map)) + .toList()); + return value; + } } diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 4a602f8e..53dc79e9 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -6,7 +6,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/activity.dart'; import 'package:huixiang/retrofit/data/article.dart'; @@ -14,12 +13,10 @@ import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/comunity_comment.dart'; import 'package:huixiang/retrofit/data/coupon.dart'; import 'package:huixiang/retrofit/data/farmers_list.dart'; -import 'package:huixiang/retrofit/data/login_info.dart'; import 'package:huixiang/retrofit/data/order_info.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:retrofit/retrofit.dart'; -import '../utils/flutter_utils.dart'; import 'data/achievement_detail_list.dart'; import 'data/activity_pos.dart'; import 'data/address.dart'; @@ -50,7 +47,6 @@ import 'data/msg_stats.dart'; import 'data/page.dart'; import 'data/rank.dart'; import 'data/rechargeActLists.dart'; -import 'data/recharge_list.dart'; import 'data/second_card_list.dart'; import 'data/sign_info.dart'; import 'data/social_info.dart'; @@ -89,6 +85,8 @@ abstract class ApiService { if (pay) { headers["Environment"] = "app"; } + if (kReleaseMode) + baseUrl = serviceBaseUrl; if (isIp) baseUrl = ipBaseUrl; dio.options = BaseOptions( connectTimeout: 60000, @@ -150,10 +148,6 @@ abstract class ApiService { debugPrint("\n"); }), ); - - if (kReleaseMode) { - baseUrl = serviceBaseUrl; - } return _ApiService(dio, baseUrl: baseUrl); } @@ -230,8 +224,8 @@ abstract class ApiService { Future> recharge(@Body() Map param); ///充值活动列表 - @GET("/wallet/rechargeActList") - Future> rechargeActList(); + @GET("/wallet/rechargeActList?tenantCode={tenantCode}") + Future> rechargeActList(@Path("tenantCode") String tenantCode); ///领取优惠券 @GET("/coupon/receive?couponId={couponId}") diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 4e59be99..86f7f0ee 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -322,12 +322,12 @@ class _ApiService implements ApiService { } @override - Future> rechargeActList() async { + Future> rechargeActList(tenantCode) async { const _extra = {}; final queryParameters = {}; final _data = {}; final _result = await _dio.request>( - '/wallet/rechargeActList', + '/wallet/rechargeActList?tenantCode=$tenantCode', queryParameters: queryParameters, options: RequestOptions( method: 'GET', diff --git a/lib/store/store_view/shop_goods.dart b/lib/store/store_view/shop_goods.dart index 3baaa943..3c0fede4 100644 --- a/lib/store/store_view/shop_goods.dart +++ b/lib/store/store_view/shop_goods.dart @@ -359,7 +359,7 @@ class _ShopGoods extends State { // SmartDialog.showToast("库存不足", // alignment: Alignment.center); // } else - if (_jumpType == -1) + if (_jumpType == -1) queryMiNiDetail(widget.productListBean.id); else if (_jumpType == 0) widget.add(widget.shoppingCartSkuItemListBean); @@ -497,6 +497,7 @@ class _ShopGoods extends State { SizedBox( height: 4.h, ), + ///VIP价格(暂时弃用) // if (widget.productListBean.vipPrice != null) // Row( @@ -645,9 +646,12 @@ class _ShopGoods extends State { // 新版桌子码跳转 // http://miniscan.lotus-wallet.com/placeorder?tenant_code=1194&table_id=1669609340031467520&store_id=1637659387134738432 Uri uri = Uri.parse(result); - String tableId = uri.queryParameters["tableId"] ?? uri.queryParameters["table_id"]; - String tenantCode = uri.queryParameters["tenantCode"] ?? uri.queryParameters["tenant_code"]; - String shopId = uri.queryParameters["shopId"] ?? uri.queryParameters["store_id"]; + String tableId = + uri.queryParameters["tableId"] ?? uri.queryParameters["table_id"]; + String tenantCode = uri.queryParameters["tenantCode"] ?? + uri.queryParameters["tenant_code"]; + String shopId = + uri.queryParameters["shopId"] ?? uri.queryParameters["store_id"]; if (tableId != null && tableId != "" && tenantCode != null && diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index 439610b0..cc753553 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -75,11 +75,14 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { }).catchError((error) { SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), alignment: Alignment.center); + _refreshController.refreshFailed(); }); if (baseData != null && baseData.isSuccess) { storeList = baseData.data; + _refreshController.refreshCompleted(); + } else { + _refreshController.refreshFailed(); } - _refreshController.refreshCompleted(); EasyLoading.dismiss(); setState(() {}); } @@ -299,25 +302,28 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { children: []..addAll( itemServer(store != null ? store.businessService : "")), ), - SizedBox(height: store.businessService == ""?40.h:23.h), - if(storeList[position].productShow != null) - Container( - height: 100.h, - child: ListView.builder( - padding: EdgeInsets.zero, - itemCount: (storeList[position].productShow?.length ??0) > 3 ?3:storeList[position].productShow?.length ?? 0, - scrollDirection: Axis.horizontal, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, index) { - return GestureDetector( - onTap: () {}, - child: unionGoodsItem( - storeList[position].productShow[index]), - ); - }, + SizedBox(height: store.businessService == "" ? 40.h : 23.h), + if (storeList[position].productShow != null) + Container( + height: 100.h, + child: ListView.builder( + padding: EdgeInsets.zero, + itemCount: + (storeList[position].productShow?.length ?? 0) > 3 + ? 3 + : storeList[position].productShow?.length ?? 0, + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, index) { + return GestureDetector( + onTap: () {}, + child: unionGoodsItem( + storeList[position].productShow[index]), + ); + }, + ), ), - ), ], )) ], @@ -352,7 +358,6 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { .toList(); } - /// Widget unionGoodsItem(ProductShow productShow) { return Container( width: 74.w, @@ -369,16 +374,18 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { errorSrc: "assets/image/default_1.webp", fadeSrc: "assets/image/default_1.webp", ), - Padding(padding:EdgeInsets.only(top: 8.h), - child: Text( - productShow?.productName ?? "", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFFA29E9E), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, + Padding( + padding: EdgeInsets.only(top: 8.h), + child: Text( + productShow?.productName ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFFA29E9E), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), ), - ),), + ), ], ), ); diff --git a/lib/view_widget/my_appbar.dart b/lib/view_widget/my_appbar.dart index 7a3ce7c5..52760e27 100644 --- a/lib/view_widget/my_appbar.dart +++ b/lib/view_widget/my_appbar.dart @@ -70,8 +70,7 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget { }, child: Container( alignment: Alignment.centerRight, - margin: EdgeInsets.only(left: 12,), - padding: EdgeInsets.all(6), + padding: EdgeInsets.only(top: 6.h,bottom: 6.h,left:20.w,right:6.w), child: Icon( Icons.arrow_back_ios, color: leadingColor, diff --git a/lib/view_widget/recharge_details_dialog.dart b/lib/view_widget/recharge_details_dialog.dart index 5d180df4..aa93077e 100644 --- a/lib/view_widget/recharge_details_dialog.dart +++ b/lib/view_widget/recharge_details_dialog.dart @@ -1,15 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_html/flutter_html.dart'; -import 'package:huixiang/generated/l10n.dart'; -import 'package:huixiang/retrofit/data/coupon.dart'; -import 'package:huixiang/retrofit/data/recharge_list.dart'; -import 'package:huixiang/retrofit/data/store.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:huixiang/store/scan.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/round_button.dart'; import '../retrofit/data/rechargeActLists.dart'; From b351eded42823c37e48d208ee367938b4972a360 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Sat, 26 Aug 2023 18:19:12 +0800 Subject: [PATCH 14/35] =?UTF-8?q?=E9=97=A8=E5=BA=97=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=80=82=E9=85=8D=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/union/union_list.dart | 8 +++++--- lib/union/union_page.dart | 16 +++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index cc753553..ab65ef7d 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -275,6 +275,7 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { ), ), SizedBox(width: 22.w), + if (store.distance != null) Image.asset( "assets/image/icon_union_location_black.webp", fit: BoxFit.fill, @@ -282,6 +283,7 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { width: 12, ), SizedBox(width: 4.w), + if (store.distance != null) Text( (store.distance ?? 0) > 1000 ? S.of(context).gongli( @@ -305,7 +307,7 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { SizedBox(height: store.businessService == "" ? 40.h : 23.h), if (storeList[position].productShow != null) Container( - height: 100.h, + height: 120.h, child: ListView.builder( padding: EdgeInsets.zero, itemCount: @@ -367,8 +369,8 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { children: [ MImage( productShow?.imgs[0] ?? "", - width: 74, - height: 74, + width: 74.h, + height: 74.h, fit: BoxFit.cover, radius: BorderRadius.circular(4), errorSrc: "assets/image/default_1.webp", diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index edb2ae17..9620592b 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -314,7 +314,8 @@ class UnionPageState extends State Widget buildSearchItem() { return Container( height: 36.h, - margin: EdgeInsets.fromLTRB(6.w, 0, 14.w, 0), + margin: EdgeInsets.fromLTRB(14.w, 0, 14.w, 0), + padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), decoration: BoxDecoration( color: Color(0xFFF5FAF7), borderRadius: BorderRadius.circular(4), @@ -337,20 +338,17 @@ class UnionPageState extends State cursorHeight: 25.h, decoration: InputDecoration( contentPadding: EdgeInsets.symmetric( - vertical: 14.h, + vertical: 12.h, ), hintText: "搜索联盟会员店", hintStyle: TextStyle( fontSize: 12.sp, color: Color(0xFFB3B3B3), ), - prefixIcon: GestureDetector( - onTap: loadFinish, - child: Image.asset( - "assets/image/icon_search.webp", - width: 16, - height: 16, - ), + prefixIcon:Image.asset( + "assets/image/icon_search.webp", + width: 16, + height: 16, ), border: InputBorder.none, ), From 53a60fa4088600eedee4eef585b2fa9cc95a8d14 Mon Sep 17 00:00:00 2001 From: fmk Date: Sat, 26 Aug 2023 18:19:58 +0800 Subject: [PATCH 15/35] ios --- ios/Podfile.lock | 334 +++++++++++++-------------- ios/Runner.xcodeproj/project.pbxproj | 12 +- pubspec.lock | 270 +++++++++++----------- 3 files changed, 307 insertions(+), 309 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 251568b2..8a485102 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,5 +1,4 @@ PODS: - - AEINFoundation (3.2.40) - AFNetworking (4.0.1): - AFNetworking/NSURLSession (= 4.0.1) - AFNetworking/Reachability (= 4.0.1) @@ -46,126 +45,126 @@ PODS: - Flutter - fluwx (0.0.1): - Flutter - - WechatOpenSDK-XCFramework (~> 2.0.2) + - "OpenWeChatSDK (~> 1.9.2+1)" - image_pickers (0.0.1): - AFNetworking - Flutter - - ZLPhotoBrowser-objc (= 1.0.4) - - mob_sharesdk_spec2 (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK (= 0.0.1) - - mob_sharesdk_spec2/ShareSDK (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDKExtension (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/DingTalk (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Douyin (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Dropbox (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Evernote (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Facebook (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Flickr (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/GooglePlus (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Instagram (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Instapaper (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Kakao (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/KuaiShou (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Line (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/LinkedIn (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Messenger (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/MingDao (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Oasis (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Pinterest (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Pocket (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/QQ (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Reddit (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/SinaWeibo (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/SMS (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/SnapChat (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Telegram (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/TikTok (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Twitter (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/VKontakte (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/WatermelonVideo (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/WeChat_Lite (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/WeWork (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/WhatsApp (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/Yixin (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKPlatforms/YouDaoNote (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK - - mob_sharesdk_spec2/ShareSDKRestoreScene (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDKExtension - - mob_sharesdk_spec2/ShareSDKUI (0.0.1): - - AEINFoundation - - mob_sharesdk_spec2/ShareSDK + - SDWebImage + - ZLPhotoBrowser (~> 4.3.9) + - mob_sharesdk (4.4.15): + - mob_sharesdk/ShareSDK (= 4.4.15) + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDK (4.4.15): + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKExtension (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/DingTalk (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Douyin (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Dropbox (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Evernote (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Facebook (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Flickr (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/GooglePlus (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Instagram (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Instapaper (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Kakao (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/KuaiShou (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Line (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/LinkedIn (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Messenger (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/MingDao (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Oasis (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Pinterest (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Pocket (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/QQ (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Reddit (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/SinaWeibo (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/SMS (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/SnapChat (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Telegram (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/TikTok (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Twitter (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/VKontakte (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/WatermelonVideo (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/WeChat_Lite (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/WeWork (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/WhatsApp (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/Yixin (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/YouDaoNote (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKUI (4.4.15): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) + - MOBFoundation (3.2.49) - number_precision (0.0.1): - Flutter + - OpenWeChatSDK (1.9.9) - package_info (0.0.1): - Flutter - path_provider (0.0.1): @@ -180,45 +179,44 @@ PODS: - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS - - sharesdk_plugin (1.1.4): + - sharesdk_plugin (1.1.7): - Flutter - - mob_sharesdk_spec2 - - mob_sharesdk_spec2/ShareSDKExtension - - mob_sharesdk_spec2/ShareSDKPlatforms/DingTalk - - mob_sharesdk_spec2/ShareSDKPlatforms/Douyin - - mob_sharesdk_spec2/ShareSDKPlatforms/Dropbox - - mob_sharesdk_spec2/ShareSDKPlatforms/Evernote - - mob_sharesdk_spec2/ShareSDKPlatforms/Facebook - - mob_sharesdk_spec2/ShareSDKPlatforms/Flickr - - mob_sharesdk_spec2/ShareSDKPlatforms/GooglePlus - - mob_sharesdk_spec2/ShareSDKPlatforms/Instagram - - mob_sharesdk_spec2/ShareSDKPlatforms/Instapaper - - mob_sharesdk_spec2/ShareSDKPlatforms/Kakao - - mob_sharesdk_spec2/ShareSDKPlatforms/KuaiShou - - mob_sharesdk_spec2/ShareSDKPlatforms/Line - - mob_sharesdk_spec2/ShareSDKPlatforms/LinkedIn - - mob_sharesdk_spec2/ShareSDKPlatforms/Messenger - - mob_sharesdk_spec2/ShareSDKPlatforms/MingDao - - mob_sharesdk_spec2/ShareSDKPlatforms/Oasis - - mob_sharesdk_spec2/ShareSDKPlatforms/Pinterest - - mob_sharesdk_spec2/ShareSDKPlatforms/Pocket - - mob_sharesdk_spec2/ShareSDKPlatforms/QQ - - mob_sharesdk_spec2/ShareSDKPlatforms/Reddit - - mob_sharesdk_spec2/ShareSDKPlatforms/SinaWeibo - - mob_sharesdk_spec2/ShareSDKPlatforms/SMS - - mob_sharesdk_spec2/ShareSDKPlatforms/SnapChat - - mob_sharesdk_spec2/ShareSDKPlatforms/Telegram - - mob_sharesdk_spec2/ShareSDKPlatforms/TikTok - - mob_sharesdk_spec2/ShareSDKPlatforms/Twitter - - mob_sharesdk_spec2/ShareSDKPlatforms/VKontakte - - mob_sharesdk_spec2/ShareSDKPlatforms/WatermelonVideo - - mob_sharesdk_spec2/ShareSDKPlatforms/WeChat_Lite - - mob_sharesdk_spec2/ShareSDKPlatforms/WeWork - - mob_sharesdk_spec2/ShareSDKPlatforms/WhatsApp - - mob_sharesdk_spec2/ShareSDKPlatforms/Yixin - - mob_sharesdk_spec2/ShareSDKPlatforms/YouDaoNote - - mob_sharesdk_spec2/ShareSDKRestoreScene - - mob_sharesdk_spec2/ShareSDKUI + - mob_sharesdk + - mob_sharesdk/ShareSDKExtension + - mob_sharesdk/ShareSDKPlatforms/DingTalk + - mob_sharesdk/ShareSDKPlatforms/Douyin + - mob_sharesdk/ShareSDKPlatforms/Dropbox + - mob_sharesdk/ShareSDKPlatforms/Evernote + - mob_sharesdk/ShareSDKPlatforms/Facebook + - mob_sharesdk/ShareSDKPlatforms/Flickr + - mob_sharesdk/ShareSDKPlatforms/GooglePlus + - mob_sharesdk/ShareSDKPlatforms/Instagram + - mob_sharesdk/ShareSDKPlatforms/Instapaper + - mob_sharesdk/ShareSDKPlatforms/Kakao + - mob_sharesdk/ShareSDKPlatforms/KuaiShou + - mob_sharesdk/ShareSDKPlatforms/Line + - mob_sharesdk/ShareSDKPlatforms/LinkedIn + - mob_sharesdk/ShareSDKPlatforms/Messenger + - mob_sharesdk/ShareSDKPlatforms/MingDao + - mob_sharesdk/ShareSDKPlatforms/Oasis + - mob_sharesdk/ShareSDKPlatforms/Pinterest + - mob_sharesdk/ShareSDKPlatforms/Pocket + - mob_sharesdk/ShareSDKPlatforms/QQ + - mob_sharesdk/ShareSDKPlatforms/Reddit + - mob_sharesdk/ShareSDKPlatforms/SinaWeibo + - mob_sharesdk/ShareSDKPlatforms/SMS + - mob_sharesdk/ShareSDKPlatforms/SnapChat + - mob_sharesdk/ShareSDKPlatforms/Telegram + - mob_sharesdk/ShareSDKPlatforms/TikTok + - mob_sharesdk/ShareSDKPlatforms/Twitter + - mob_sharesdk/ShareSDKPlatforms/VKontakte + - mob_sharesdk/ShareSDKPlatforms/WatermelonVideo + - mob_sharesdk/ShareSDKPlatforms/WeChat_Lite + - mob_sharesdk/ShareSDKPlatforms/WeWork + - mob_sharesdk/ShareSDKPlatforms/WhatsApp + - mob_sharesdk/ShareSDKPlatforms/Yixin + - mob_sharesdk/ShareSDKPlatforms/YouDaoNote + - mob_sharesdk/ShareSDKUI - SSZipArchive (2.4.3) - thumbnails (0.0.1): - Flutter @@ -243,9 +241,9 @@ PODS: - Flutter - webview_flutter (0.0.1): - Flutter - - WechatOpenSDK-XCFramework (2.0.2) - - ZLPhotoBrowser-objc (1.0.4): - - SDWebImage + - ZLPhotoBrowser (4.3.9): + - ZLPhotoBrowser/Core (= 4.3.9) + - ZLPhotoBrowser/Core (4.3.9) DEPENDENCIES: - emoji_picker_flutter (from `.symlinks/plugins/emoji_picker_flutter/ios`) @@ -276,18 +274,18 @@ DEPENDENCIES: SPEC REPOS: https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git: - - AEINFoundation - AFNetworking - BaiduMapKit - BMKLocationKit - - mob_sharesdk_spec2 + - mob_sharesdk + - MOBFoundation + - OpenWeChatSDK - SDWebImage - SSZipArchive - TPNS-iOS - UMCommon - UMDevice - - WechatOpenSDK-XCFramework - - ZLPhotoBrowser-objc + - ZLPhotoBrowser EXTERNAL SOURCES: emoji_picker_flutter: @@ -340,7 +338,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/webview_flutter/ios" SPEC CHECKSUMS: - AEINFoundation: e046b5fbe75aaf120a54fdc530b1d62d4ce88dfe AFNetworking: 3bd23d814e976cd148d7d44c3ab78017b744cd58 BaiduMapKit: f227cfb43581e91466fb4f1344f655eab5788777 BMKLocationKit: 688d8e1194980b96fc9a6585c0eb42e62fbaf780 @@ -351,17 +348,19 @@ SPEC CHECKSUMS: flutter_baidu_mapapi_search: 13a360334e91abea0bcf820546b2ef4548e42e08 flutter_baidu_mapapi_utils: f6a5d23da26b0e58f1ae9908da7ba87fd48384b1 flutter_bmflocation: 1bd73181196567fe1529f765aa4f8e2615a8a3cf - fluwx: e9e728cfdb80e82dac5f4ff974b1901a7939dcd0 - image_pickers: 25c8916d358bc9d2707cb470ba3d57497f105773 - mob_sharesdk_spec2: efa0cb438a29b37ab99d015a272dff69177e30a2 + fluwx: 79c66b6d795ab8208262ada215d9e60388cfe492 + image_pickers: 4406949954a5eb4fac5ada5f13810e6419ef4467 + mob_sharesdk: 0698d60b3c1549a5b0bcfdec6f407439dd2960c0 + MOBFoundation: 6df2684b4db4f0f5bd71b0623f82e11271bf7ac8 number_precision: 26fa2be2212f9d1429f92d667d6b0aa4df0058d8 + OpenWeChatSDK: b2df736e1204ef0d24d459fa57e2513e91dd3a46 package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 path_provider: f96fff6166a8867510d2c25fdcc346327cc4b259 permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 scan: aea35bb4aa59ccc8839c576a18cd57c7d492cc86 SDWebImage: e5cc87bf736e60f49592f307bdf9e157189298a3 shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472 - sharesdk_plugin: d9c8e928116aba323b21da64b4437ed766ee843e + sharesdk_plugin: 7e8abfa7c4aa4c20d94e0a162406ba79a971f2ca SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef thumbnails: bb4f4e9bb4b51c8ae4e6ad9a2fa81373f9b634ad tobias: 2aded9b83e3663b907360a800d8e3c13284f25c5 @@ -374,8 +373,7 @@ SPEC CHECKSUMS: video_player_avfoundation: 6d971a232d72e6ee25368378d48a079dea01f1cf wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f webview_flutter: 5fb4def2bbd4339889ee14d045b605cefc5bc232 - WechatOpenSDK-XCFramework: acdeeda129efbef9532bca8a10c24e1b4b8c7d69 - ZLPhotoBrowser-objc: c7657d3bc85ae231884e058d0e3638f619164736 + ZLPhotoBrowser: 02b3569b8f702d2e153e8fdb1f6b32fef3a2867c PODFILE CHECKSUM: f4ea28c741a7c9a1c417c066f9cfd7b29654dd12 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index a4e2985e..7d1b8f6d 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -617,7 +617,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -667,7 +667,7 @@ "$(PROJECT_DIR)/baidu", "$(PROJECT_DIR)/Runner/baidu", ); - MARKETING_VERSION = 3.2.18; + MARKETING_VERSION = 3.2.20; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "$(inherited)", @@ -819,7 +819,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -869,7 +869,7 @@ "$(PROJECT_DIR)/baidu", "$(PROJECT_DIR)/Runner/baidu", ); - MARKETING_VERSION = 3.2.18; + MARKETING_VERSION = 3.2.20; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "$(inherited)", @@ -912,7 +912,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -962,7 +962,7 @@ "$(PROJECT_DIR)/baidu", "$(PROJECT_DIR)/Runner/baidu", ); - MARKETING_VERSION = 3.2.18; + MARKETING_VERSION = 3.2.20; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "$(inherited)", diff --git a/pubspec.lock b/pubspec.lock index b78eaca5..b3e4736d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,161 +5,161 @@ packages: dependency: "direct main" description: name: ai_decimal_accuracy - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" android_intent_plus: dependency: "direct main" description: name: android_intent_plus - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.2" async: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.8.2" barcode: dependency: transitive description: name: barcode - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" barcode_widget: dependency: "direct main" description: name: barcode_widget - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.1" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" bubble_tab_indicator: dependency: "direct main" description: name: bubble_tab_indicator - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.1.6" characters: dependency: transitive description: name: characters - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.3.1" chewie: dependency: transitive description: name: chewie - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.3.3" chewie_audio: dependency: "direct main" description: name: chewie_audio - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.4.0" clock: dependency: transitive description: name: clock - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" collection: dependency: transitive description: name: collection - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.16.0" crypto: dependency: transitive description: name: crypto - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.2" csslib: dependency: transitive description: name: csslib - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.17.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.5" dio: dependency: "direct main" description: name: dio - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.10" emoji_picker_flutter: dependency: "direct main" description: name: emoji_picker_flutter - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.4.1" event_bus: dependency: "direct main" description: name: event_bus - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.3.0" ffi: dependency: transitive description: name: ffi - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.2" file: dependency: transitive description: name: file - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "6.1.4" flare_flutter: dependency: "direct main" description: name: flare_flutter - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.2" flutter: @@ -171,63 +171,63 @@ packages: dependency: "direct main" description: name: flutter_baidu_mapapi_base - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.2.0" flutter_baidu_mapapi_map: dependency: "direct main" description: name: flutter_baidu_mapapi_map - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.2.1" flutter_baidu_mapapi_search: dependency: "direct main" description: name: flutter_baidu_mapapi_search - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.2.0" flutter_baidu_mapapi_utils: dependency: "direct main" description: name: flutter_baidu_mapapi_utils - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.2.0" flutter_bmflocation: dependency: "direct main" description: name: flutter_bmflocation - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.2.1" flutter_datetime_picker: dependency: "direct main" description: name: flutter_datetime_picker - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.5.1" flutter_easyloading: dependency: "direct main" description: name: flutter_easyloading - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.5" flutter_html: dependency: "direct main" description: name: flutter_html - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.2.1" flutter_layout_grid: dependency: transitive description: name: flutter_layout_grid - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.6" flutter_localizations: @@ -239,70 +239,70 @@ packages: dependency: transitive description: name: flutter_math_fork - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.4.2+2" flutter_page_indicator: dependency: transitive description: name: flutter_page_indicator - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.0.3" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.14" flutter_screenutil: dependency: "direct main" description: name: flutter_screenutil - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "5.0.0+1" flutter_slidable: dependency: "direct main" description: name: flutter_slidable - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.3.2" flutter_smart_dialog: dependency: "direct main" description: name: flutter_smart_dialog - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.5.0" flutter_spinkit: dependency: "direct main" description: name: flutter_spinkit - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "5.2.0" flutter_staggered_grid_view: dependency: "direct main" description: name: flutter_staggered_grid_view - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.4.1" flutter_svg: dependency: "direct main" description: name: flutter_svg - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.22.0" flutter_swiper: dependency: "direct main" description: name: flutter_swiper - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.6" flutter_test: @@ -319,392 +319,392 @@ packages: dependency: "direct main" description: name: fluwx - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.9.0+2" font_awesome_flutter: dependency: "direct main" description: name: font_awesome_flutter - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "9.2.0" gradient_widgets: dependency: "direct main" description: name: gradient_widgets - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.6.0" graphs: dependency: transitive description: name: graphs - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.2.0" html: dependency: transitive description: name: html - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.15.3" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.1.4" image_pickers: dependency: "direct main" description: name: image_pickers - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.4+1" intl: dependency: "direct main" description: name: intl - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.17.0" js: dependency: transitive description: name: js - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.6.4" json_annotation: dependency: "direct main" description: name: json_annotation - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.1.1" keframe: dependency: "direct main" description: name: keframe - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.0" like_button: dependency: "direct main" description: name: like_button - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.5" logger: dependency: "direct main" description: name: logger - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.4.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.12.11" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.1.4" meta: dependency: transitive description: name: meta - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.7.0" mqtt_client: dependency: "direct main" description: name: mqtt_client - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "9.6.8" nested: dependency: transitive description: name: nested - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" 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" + url: "https://pub.dartlang.org" source: hosted version: "4.0.1" number_precision: dependency: "direct main" description: name: number_precision - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.2+1" numerus: dependency: transitive description: name: numerus - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.1" package_info: dependency: "direct main" description: name: package_info - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.2" path: dependency: transitive description: name: path - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.8.1" path_drawing: dependency: transitive description: name: path_drawing - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.5.1+1" path_parsing: dependency: transitive description: name: path_parsing - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.2.1" path_provider: dependency: "direct main" description: name: path_provider - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" path_provider_linux: dependency: transitive description: name: path_provider_linux - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.10" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" path_provider_windows: dependency: transitive description: name: path_provider_windows - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.6" permission_handler: dependency: "direct main" description: name: permission_handler - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "5.1.0+2" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.2" petitparser: dependency: transitive description: name: petitparser - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "5.0.0" photo_view: dependency: "direct main" description: name: photo_view - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.13.0" pin_input_text_field: dependency: "direct main" description: name: pin_input_text_field - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "4.4.1" platform: dependency: transitive description: name: platform - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.3" process: dependency: transitive description: name: process - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "4.2.4" provider: dependency: transitive description: name: provider - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "6.0.5" pull_to_refresh: dependency: "direct main" description: name: pull_to_refresh - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" qr: dependency: transitive description: name: qr - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" qr_flutter: dependency: "direct main" description: name: qr_flutter - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "4.0.0" quiver: dependency: transitive description: name: quiver - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.2.1" retrofit: dependency: "direct main" description: name: retrofit - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.3.4+1" rive: dependency: "direct main" description: name: rive - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.6.8" rxdart: dependency: "direct main" description: name: rxdart - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.26.0" scan: dependency: "direct main" description: name: scan - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.6.0" shared_preferences: dependency: "direct main" description: name: shared_preferences - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.20" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.17" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.5" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.5" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.6" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.5" sharesdk_plugin: dependency: "direct main" description: name: sharesdk_plugin - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "1.3.6" + version: "1.3.10" shimmer: dependency: "direct main" description: name: shimmer - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.0.0" simple_gesture_detector: dependency: transitive description: name: simple_gesture_detector - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.1.6" sky_engine: @@ -716,65 +716,65 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.8.2" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" table_calendar: dependency: "direct main" description: name: table_calendar - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.3.3" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.4.9" thumbnails: dependency: "direct main" description: name: thumbnails - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" tobias: dependency: "direct main" description: name: tobias - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted - version: "2.4.1" + version: "2.4.2" tpns_flutter_plugin: dependency: "direct main" description: @@ -788,175 +788,175 @@ packages: dependency: transitive description: name: transformer_page_view - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.1.6" tuple: dependency: transitive description: name: tuple - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.2" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.3.2" umeng_common_sdk: dependency: "direct main" description: name: umeng_common_sdk - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.6" url_launcher: dependency: "direct main" description: name: url_launcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "5.7.10" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.0.1+4" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.0.1+9" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.9" url_launcher_web: dependency: transitive description: name: url_launcher_web - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.1.5+3" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.0.1+3" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.2" video_player: dependency: "direct main" description: name: video_player - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.2.19" video_player_android: dependency: transitive description: name: video_player_android - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.3.4" video_player_avfoundation: dependency: transitive description: name: video_player_avfoundation - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.3.9" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "4.2.0" video_player_web: dependency: transitive description: name: video_player_web - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.15" wakelock: dependency: transitive description: name: wakelock - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.6.2" wakelock_macos: dependency: transitive description: name: wakelock_macos - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.4.0" wakelock_platform_interface: dependency: transitive description: name: wakelock_platform_interface - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.3.0" wakelock_web: dependency: transitive description: name: wakelock_web - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.4.0" wakelock_windows: dependency: transitive description: name: wakelock_windows - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.2.1" webview_flutter: dependency: transitive description: name: webview_flutter - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.14" win32: dependency: transitive description: name: win32 - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.1.4" xdg_directories: dependency: transitive description: name: xdg_directories - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" xml: dependency: transitive description: name: xml - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "5.4.1" sdks: From e483841a5c1f932539f35d24389cbfe80ca7aa28 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Sat, 26 Aug 2023 18:57:48 +0800 Subject: [PATCH 16/35] =?UTF-8?q?=E4=BC=9A=E5=91=98=E5=8D=A1=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E6=96=B0=E5=A2=9E=E5=88=A4=E6=96=AD=EF=BC=8C=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E8=B7=9D=E7=A6=BB=E4=B8=BA0=E5=B0=B1=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mine/mine_shop_details.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/mine/mine_shop_details.dart b/lib/mine/mine_shop_details.dart index 244ca00c..ffbfbf16 100644 --- a/lib/mine/mine_shop_details.dart +++ b/lib/mine/mine_shop_details.dart @@ -511,6 +511,12 @@ class _MineShopDetails extends State { ), ), ), + if(((store.distance ?? 0) > 1000 + ? S.of(context).gongli( + ((store.distance ?? 0) / 1000 * 100).toInt() / 100.0) + : S + .of(context) + .mi(((store.distance ?? 0) * 100).toInt() / 100.0)) != "0.0米") Text( (store.distance ?? 0) > 1000 ? S.of(context).gongli( From 742d5af096fc597d43b3da90733ada540871d1c6 Mon Sep 17 00:00:00 2001 From: fmk Date: Sat, 26 Aug 2023 22:13:55 +0800 Subject: [PATCH 17/35] =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86=E9=80=82?= =?UTF-8?q?=E9=85=8D=E6=9B=B4=E6=94=B9=EF=BC=9B=20ip=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9B=20=E4=BC=9A=E5=91=98=E5=8D=A1?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=9C=B0=E5=9D=80=E6=98=BE=E7=A4=BA=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Podfile.lock | 4 +- ios/Runner.xcodeproj/project.pbxproj | 6 +-- lib/mine/mine_shop_details.dart | 6 +++ lib/mine/mine_shop_page.dart | 22 ++++---- lib/retrofit/data/ip_data.dart | 81 ++++++++-------------------- lib/retrofit/min_api.dart | 2 +- lib/retrofit/retrofit_api.dart | 6 +-- lib/retrofit/retrofit_api.g.dart | 2 +- lib/union/union_list.dart | 6 +-- lib/union/union_page.dart | 26 ++++----- lib/union/union_select_city.dart | 31 +++++------ 11 files changed, 80 insertions(+), 112 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 8a485102..d5042f22 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -164,7 +164,7 @@ PODS: - MOBFoundation (3.2.49) - number_precision (0.0.1): - Flutter - - OpenWeChatSDK (1.9.9) + - "OpenWeChatSDK (1.9.9+1)" - package_info (0.0.1): - Flutter - path_provider (0.0.1): @@ -353,7 +353,7 @@ SPEC CHECKSUMS: mob_sharesdk: 0698d60b3c1549a5b0bcfdec6f407439dd2960c0 MOBFoundation: 6df2684b4db4f0f5bd71b0623f82e11271bf7ac8 number_precision: 26fa2be2212f9d1429f92d667d6b0aa4df0058d8 - OpenWeChatSDK: b2df736e1204ef0d24d459fa57e2513e91dd3a46 + OpenWeChatSDK: ea48e9db20645f78128db9091893910280b8e4b1 package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 path_provider: f96fff6166a8867510d2c25fdcc346327cc4b259 permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 7d1b8f6d..a8a9508a 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -617,7 +617,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -819,7 +819,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -912,7 +912,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/lib/mine/mine_shop_details.dart b/lib/mine/mine_shop_details.dart index 244ca00c..ffbfbf16 100644 --- a/lib/mine/mine_shop_details.dart +++ b/lib/mine/mine_shop_details.dart @@ -511,6 +511,12 @@ class _MineShopDetails extends State { ), ), ), + if(((store.distance ?? 0) > 1000 + ? S.of(context).gongli( + ((store.distance ?? 0) / 1000 * 100).toInt() / 100.0) + : S + .of(context) + .mi(((store.distance ?? 0) * 100).toInt() / 100.0)) != "0.0米") Text( (store.distance ?? 0) > 1000 ? S.of(context).gongli( diff --git a/lib/mine/mine_shop_page.dart b/lib/mine/mine_shop_page.dart index 9fc90c7d..60fcc8e2 100644 --- a/lib/mine/mine_shop_page.dart +++ b/lib/mine/mine_shop_page.dart @@ -179,9 +179,8 @@ class _MineShopPage extends State with WidgetsBindingObserver{ Widget searchShopItem() { return Container( - height: 36.h, margin: EdgeInsets.fromLTRB(14.w, 0, 14.w, 0), - padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), + padding: EdgeInsets.symmetric(vertical: 6.h), decoration: BoxDecoration( color: Color(0xFFF5FAF7), borderRadius: BorderRadius.circular(4), @@ -201,21 +200,22 @@ class _MineShopPage extends State with WidgetsBindingObserver{ queryVipCard(); }, controller: editingController, - cursorHeight: 25.h, + style: TextStyle( + fontSize: 14.sp, + ), decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric( - vertical: 12.h, - ), hintText: "搜索联盟会员店", hintStyle: TextStyle( fontSize: 12.sp, color: Color(0xFFB3B3B3), ), - prefixIcon:Image.asset( - "assets/image/icon_search.webp", - width: 16, - height: 16, - ), + isCollapsed: true, + prefixIcon:Padding(padding: EdgeInsets.only(left: 5.w,right: 5.w),child: Image.asset( + "assets/image/icon_search.webp", + width: 16.h, + height: 16.h, + ),), + prefixIconConstraints: BoxConstraints(), border: InputBorder.none, ), ), diff --git a/lib/retrofit/data/ip_data.dart b/lib/retrofit/data/ip_data.dart index c0ff1f3c..6c35e6ee 100644 --- a/lib/retrofit/data/ip_data.dart +++ b/lib/retrofit/data/ip_data.dart @@ -1,77 +1,42 @@ -/// code : 200 -/// msg : "success" -/// ip : "27.17.85.129" -/// country : "中国" -/// province : "湖北" -/// city : "武汉市" -/// isp : "电信" +/// id : 1887 +/// ip : "27.18.151.119" +/// dz : "中国 湖北省 武汉市" +/// wl : "电信" class IpData { IpData({ - num code, - String msg, + int id, String ip, - String country, - String province, - String city, - String isp,}){ - _code = code; - _msg = msg; + String dz, + String wl,}){ + _id = id; _ip = ip; - _country = country; - _province = province; - _city = city; - _isp = isp; + _dz = dz; + _wl = wl; } IpData.fromJson(dynamic json) { - _code = json['code']; - _msg = json['msg']; + _id = json['id']; _ip = json['ip']; - _country = json['country']; - _province = json['province']; - _city = json['city']; - _isp = json['isp']; + _dz = json['dz']; + _wl = json['wl']; } - num _code; - String _msg; + int _id; String _ip; - String _country; - String _province; - String _city; - String _isp; -IpData copyWith({ num code, - String msg, - String ip, - String country, - String province, - String city, - String isp, -}) => IpData( code: code ?? _code, - msg: msg ?? _msg, - ip: ip ?? _ip, - country: country ?? _country, - province: province ?? _province, - city: city ?? _city, - isp: isp ?? _isp, -); - num get code => _code; - String get msg => _msg; + String _dz; + String _wl; + + int get id => _id; String get ip => _ip; - String get country => _country; - String get province => _province; - String get city => _city; - String get isp => _isp; + String get dz => _dz; + String get wl => _wl; Map toJson() { final map = {}; - map['code'] = _code; - map['msg'] = _msg; + map['id'] = _id; map['ip'] = _ip; - map['country'] = _country; - map['province'] = _province; - map['city'] = _city; - map['isp'] = _isp; + map['dz'] = _dz; + map['wl'] = _wl; return map; } diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index c8cf737b..f780186c 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -29,7 +29,7 @@ part 'min_api.g.dart'; const localBaseUrl = "http://app-api.test.yixinhuixiang.com/app/";///本地 // const localBaseUrl = "http://pos-test.api.lotus-wallet.com/app/";///测试 -const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线上 +const serviceBaseUrl = "http://app-api.test.yixinhuixiang.com/app/";///线上 ///调用小程序的接口 diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 53dc79e9..03864b03 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -65,9 +65,9 @@ part 'retrofit_api.g.dart'; const localBaseUrl = "http://platform-api.test.yixinhuixiang.com/app/";///本地 // const localBaseUrl = "http://platform.test.api.lotus-wallet.com/app/";///测试 -const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线上 +const serviceBaseUrl = "http://platform-api.test.yixinhuixiang.com/app/";///线上 -const ipBaseUrl = "https://api.ooomn.com";///ip +const ipBaseUrl = "https://api.asilu.com";///ip @RestApi(baseUrl: localBaseUrl) abstract class ApiService { @@ -584,6 +584,6 @@ abstract class ApiService { @Path("creditGoodsId") String creditGoodsId); ///获取APP门店推广渠道 - @GET("/api/ip") + @GET("/ip/") Future getIpInfo(); } diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 86f7f0ee..6a8f5b98 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -2115,7 +2115,7 @@ class _ApiService implements ApiService { final queryParameters = {}; final _data = {}; final _result = await _dio.request>( - '/api/ip', + '/ip/', queryParameters: queryParameters, options: RequestOptions( method: 'GET', diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index ab65ef7d..d0a4448f 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -216,8 +216,8 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { children: [ MImage( store.facade, - width: 74, - height: 74, + width: 74.h, + height: 74.h, fit: BoxFit.cover, radius: BorderRadius.circular(6), errorSrc: "assets/image/default_1.webp", @@ -362,7 +362,7 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { Widget unionGoodsItem(ProductShow productShow) { return Container( - width: 74.w, + width: 74.h, margin: EdgeInsets.only(right: 8.w), child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 9620592b..bf3a0217 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -162,8 +162,8 @@ class UnionPageState extends State EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); ApiService apiIpService = ApiService(Dio(), context: context, isIp: true); IpData baseData = await apiIpService.getIpInfo().catchError((onError) {}); - if (baseData != null) { - areaName = baseData.city.replaceAll("市", ""); + if (baseData?.dz != null) { + areaName = baseData.dz.substring(baseData.dz.lastIndexOf(" ") +1).replaceAll("市", ""); } startLocation(); } @@ -313,9 +313,8 @@ class UnionPageState extends State Widget buildSearchItem() { return Container( - height: 36.h, - margin: EdgeInsets.fromLTRB(14.w, 0, 14.w, 0), - padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), + margin: EdgeInsets.fromLTRB(6.w, 0, 14.w, 0), + padding: EdgeInsets.symmetric(vertical: 6.h), decoration: BoxDecoration( color: Color(0xFFF5FAF7), borderRadius: BorderRadius.circular(4), @@ -335,21 +334,22 @@ class UnionPageState extends State loadFinish(); }, controller: editingController, - cursorHeight: 25.h, + style: TextStyle( + fontSize: 14.sp, + ), decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric( - vertical: 12.h, - ), hintText: "搜索联盟会员店", hintStyle: TextStyle( fontSize: 12.sp, color: Color(0xFFB3B3B3), ), - prefixIcon:Image.asset( + isCollapsed: true, + prefixIcon:Padding(padding: EdgeInsets.only(left: 5.w,right: 5.w),child: Image.asset( "assets/image/icon_search.webp", - width: 16, - height: 16, - ), + width: 16.h, + height: 16.h, + ),), + prefixIconConstraints: BoxConstraints(), border: InputBorder.none, ), ), diff --git a/lib/union/union_select_city.dart b/lib/union/union_select_city.dart index 710e6bf4..e0d6d4bb 100644 --- a/lib/union/union_select_city.dart +++ b/lib/union/union_select_city.dart @@ -67,8 +67,8 @@ class _UnionSelectCity extends State { isIp: true ); IpData baseData = await apiIpService.getIpInfo().catchError((onError) {}); - if (baseData != null) { - ipName = baseData.city.replaceAll("市", ""); + if (baseData?.dz != null) { + ipName = baseData.dz.substring(baseData.dz.lastIndexOf(" ")+1).replaceAll("市", ""); if(ipName != widget.arguments["cityName"] ){ ipState=2; setState((){}); @@ -227,9 +227,8 @@ class _UnionSelectCity extends State { Widget searchCityItem() { return Container( - height: 36.h, margin: EdgeInsets.fromLTRB(6.w, 0, 14.w, 0), - // padding: EdgeInsets.fromLTRB(0, 6.h, 0, 0), + padding: EdgeInsets.symmetric(vertical: 6.h), decoration: BoxDecoration( color: Color(0xFFF1F1F1), borderRadius: BorderRadius.circular(6), @@ -250,24 +249,22 @@ class _UnionSelectCity extends State { onChanged: (txt) { areaCode(searchTxt: txt); }, - cursorHeight: 25.h, + style: TextStyle( + fontSize: 14.sp, + ), decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric( - vertical: 14.h, - ), - hintText: "输入城市名进行搜索", + hintText: "搜索联盟会员店", hintStyle: TextStyle( fontSize: 12.sp, color: Color(0xFFB3B3B3), ), - prefixIcon: InkWell( - onTap: () {}, - child: Image.asset( - "assets/image/icon_search.webp", - width: 16, - height: 16, - ), - ), + isCollapsed: true, + prefixIcon:Padding(padding: EdgeInsets.only(left: 5.w,right: 5.w),child: Image.asset( + "assets/image/icon_search.webp", + width: 16.h, + height: 16.h, + ),), + prefixIconConstraints: BoxConstraints(), border: InputBorder.none, ), ), From a47fd28cbe4f04d4bb49c81bbad3e7daa8e85e67 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Mon, 28 Aug 2023 11:56:38 +0800 Subject: [PATCH 18/35] =?UTF-8?q?=E6=88=91=E7=9A=84=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E6=8E=A8=E5=B9=BFbanner=E6=9B=B4=E6=94=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/home/home_page.dart | 28 +--------- lib/mine/mine_page.dart | 110 ++++++++++++++++++++++++++++++++-------- 2 files changed, 90 insertions(+), 48 deletions(-) diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index c6bf0ad8..b18eeb24 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -656,7 +656,7 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { width: double.infinity, // margin: EdgeInsets.symmetric(horizontal:14.w), height: 85.h, - child: bannerData != null && bannerData.isNotEmpty + child: activityBannerData != null && activityBannerData.isNotEmpty ? Swiper( pagination: SwiperPagination( alignment: Alignment.bottomCenter, @@ -688,27 +688,6 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { ), ), ); - // GestureDetector( - // onTap: () { - // if (position == 0) { - // Navigator.of(context).pushNamed('/router/invite_friends'); - // } else if (position == 1) { - // Navigator.of(context).pushNamed('/router/trading_card_page'); - // } - // }, - // child: Container( - // margin: EdgeInsets.symmetric(horizontal: 14.w), - // child: ClipRRect( - // child: Image.asset( - // spreadItem[position], - // width: double.infinity, - // fit: BoxFit.fill, - // height: double.infinity, - // ), - // borderRadius: BorderRadius.circular(6.w), - // ), - // ), - // ); }, itemCount: activityBannerData.length, ) @@ -766,11 +745,6 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { } } - final List spreadItem = [ - "assets/image/welfare_spread.webp", - "assets/image/welfare_yz.webp", - ]; - ///扫码 toScan() async { if (await Permission.camera.isPermanentlyDenied) { diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index 98a91778..b6a7bf09 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -26,9 +26,11 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'package:dio/dio.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../retrofit/data/banner.dart'; import '../retrofit/data/coupon.dart'; import '../retrofit/data/page.dart'; import '../utils/flutter_utils.dart'; +import '../view_widget/custom_image.dart'; import 'mine_view/mine_item.dart'; import 'mine_view/mine_view.dart'; @@ -49,6 +51,7 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { final RefreshController _refreshController = RefreshController(); int totalMsg = 0; String couponNum; + List activityBannerData = []; _toUserInfo() async { SharedPreferences shared = await SharedPreferences.getInstance(); @@ -78,6 +81,7 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { querySocialInfo(); queryMsgStats(); queryCoupon(); + queryActivityBanner(); // queryCard(); eventBus.on().listen((event) { @@ -136,6 +140,23 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { // EasyLoading.dismiss(); } + ///宣传banner + queryActivityBanner() async { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + showLoading: false, + ); + BaseData> baseData = await apiService.queryBanner({ + "model": {"type": "HOME_STORE_PAGE"}, + }).catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + activityBannerData = baseData.data.records; + } + } + queryCoupon() async { SharedPreferences value = await SharedPreferences.getInstance(); apiService = ApiService( @@ -166,6 +187,7 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { queryCoupon(); querySocialInfo(); queryMsgStats(); + queryActivityBanner(); } ///个人社交信息(粉丝/关注数量/成就数量) @@ -427,10 +449,11 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { ///推广图 Widget spreadImage() { return Container( - margin: EdgeInsets.only(bottom: 30.h,), width: double.infinity, + // margin: EdgeInsets.symmetric(horizontal:14.w), height: 85.h, - child: Swiper( + child: activityBannerData != null && activityBannerData.isNotEmpty + ? Swiper( pagination: SwiperPagination( alignment: Alignment.bottomCenter, margin: EdgeInsets.only(top: 5.h), @@ -442,37 +465,82 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { color: Colors.white.withAlpha(76), ), ), - autoplay:true, + autoplay: true, duration: 1000, autoplayDelay: 2000, itemBuilder: (context, position) { - return GestureDetector( - onTap: (){ - if(position == 0){ - Navigator.of(context).pushNamed('/router/invite_friends'); - }else if(position == 1){ - Navigator.of(context).pushNamed('/router/trading_card_page'); - } + return InkWell( + onTap: () { + spreadBannerClick(activityBannerData[position]); }, - child:Container( - margin: EdgeInsets.symmetric(horizontal:14.w), - child: ClipRRect( - child:Image.asset( - spreadItem[position], - width:double.infinity, - fit: BoxFit.fill, - height:double.infinity, - ), - borderRadius: BorderRadius.circular(6.w), + child: Container( + margin: EdgeInsets.symmetric(horizontal: 14.w), + child: MImage( + activityBannerData[position].imgUrl, + fit: BoxFit.cover, + radius: BorderRadius.circular(6), + errorSrc: "assets/image/default_2_1.webp", + fadeSrc: "assets/image/default_2_1.webp", ), ), ); }, - itemCount:2, + itemCount: activityBannerData.length, + ) + : Image.asset( + "assets/image/default_2_1.webp", + fit: BoxFit.cover, ), ); } + /// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程,7:门店跳转) + spreadBannerClick(BannerData activityBannerData) async { + switch (activityBannerData.contentType) { + case 1: + Navigator.of(context).pushNamed('/router/integral_store_page', + arguments: {"goodsId": activityBannerData.content}); + break; + case 2: + Navigator.of(context).pushNamed('/router/web_page', arguments: { + "activityId": activityBannerData.content, + }); + break; + case 3: + Navigator.of(context).pushNamed('/router/web_page', arguments: { + "articleId": activityBannerData.content, + }); + break; + case 4: + String router = activityBannerData.content; + // String router = "/router/store_order?{\"id\":\"1512378184161558528\",\"tenant\":\"1188\",\"storeName\":\"农场煮意\"}"; + if (router.contains("?")) { + String params = router.substring(router.indexOf("?") + 1); + Map map = jsonDecode(params); + Navigator.of(context).pushNamed( + router.substring(0, router.indexOf("?")), + arguments: map); + } else { + Navigator.of(context).pushNamed(router); + } + break; + case 5: + Navigator.of(context).pushNamed('/router/class_details', arguments: { + "id": activityBannerData.content, + }); + break; + case 7: + String params = activityBannerData.content + .substring(activityBannerData.content.indexOf("?") + 1); + Map map = jsonDecode(params); + Navigator.of(context).pushNamed( + activityBannerData.content + .substring(0, activityBannerData.content.indexOf("?")), + arguments: map); + break; + } + } + final List spreadItem = [ "assets/image/welfare_spread.webp", "assets/image/welfare_yz.webp", From 3457326fbb22bbe57500266043a822ce132bf068 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Thu, 31 Aug 2023 23:10:23 +0800 Subject: [PATCH 19/35] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9B=20=E5=9C=B0=E5=9B=BE=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E6=97=8B=E8=BD=AC=EF=BC=9B=20=E6=96=B0=E4=BA=BA?= =?UTF-8?q?=E5=BC=B9=E7=AA=97ui=E6=9B=B4=E6=94=B9=EF=BC=9B=20=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E7=A7=AF=E5=88=86=E7=AD=BE=E5=88=B0=E6=9D=BF=E5=9D=97?= =?UTF-8?q?=EF=BC=9B=20=E6=9B=B4=E6=94=B9=E8=8E=B7=E5=8F=96ip=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E6=8E=A5=E5=8F=A3=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/image/2x/icon_by_bike.webp | Bin 0 -> 812 bytes assets/image/2x/icon_drive.webp | Bin 0 -> 736 bytes assets/image/2x/icon_transit.webp | Bin 0 -> 840 bytes assets/image/2x/icon_walk.webp | Bin 0 -> 824 bytes assets/image/2x/position_sort.webp | Bin 0 -> 596 bytes assets/image/3x/icon_by_bike.webp | Bin 0 -> 1386 bytes assets/image/3x/icon_drive.webp | Bin 0 -> 1016 bytes assets/image/3x/icon_transit.webp | Bin 0 -> 1142 bytes assets/image/3x/icon_walk.webp | Bin 0 -> 1234 bytes assets/image/3x/position_sort.webp | Bin 0 -> 666 bytes assets/image/icon_by_bike.webp | Bin 0 -> 672 bytes assets/image/icon_drive.webp | Bin 0 -> 622 bytes assets/image/icon_end.png | Bin 0 -> 4121 bytes assets/image/icon_start.png | Bin 0 -> 4021 bytes assets/image/icon_transit.webp | Bin 0 -> 624 bytes assets/image/icon_walk.webp | Bin 0 -> 666 bytes assets/image/position_sort.webp | Bin 0 -> 574 bytes assets/image/traffic_texture_smooth.png | Bin 0 -> 980 bytes assets/image/traffic_texture_unknown.png | Bin 0 -> 888 bytes lib/address/address_map_page.dart | 11 +- lib/home/home_page.dart | 1 + lib/main.dart | 1 + lib/mine/mine_page.dart | 2 +- lib/mine/mine_view/mine_navbar.dart | 16 +- lib/mine/mine_view/mine_view.dart | 99 ++- lib/retrofit/data/ip_data.dart | 106 ++- lib/retrofit/min_api.dart | 6 +- lib/retrofit/retrofit_api.dart | 34 +- lib/retrofit/retrofit_api.g.dart | 103 ++- lib/store/store_order.dart | 3 +- lib/store/store_view/store_header.dart | 2 +- lib/store/store_view/store_info.dart | 35 +- lib/union/location_map_page.dart | 1030 +++++++++++++++++++++- lib/union/union_page.dart | 177 ++-- lib/union/union_select_city.dart | 4 +- lib/utils/flutter_utils.dart | 5 +- lib/view_widget/new_people_reward.dart | 20 +- pubspec.lock | 328 ++++--- pubspec.yaml | 20 +- 39 files changed, 1504 insertions(+), 499 deletions(-) create mode 100644 assets/image/2x/icon_by_bike.webp create mode 100644 assets/image/2x/icon_drive.webp create mode 100644 assets/image/2x/icon_transit.webp create mode 100644 assets/image/2x/icon_walk.webp create mode 100644 assets/image/2x/position_sort.webp create mode 100644 assets/image/3x/icon_by_bike.webp create mode 100644 assets/image/3x/icon_drive.webp create mode 100644 assets/image/3x/icon_transit.webp create mode 100644 assets/image/3x/icon_walk.webp create mode 100644 assets/image/3x/position_sort.webp create mode 100644 assets/image/icon_by_bike.webp create mode 100644 assets/image/icon_drive.webp create mode 100644 assets/image/icon_end.png create mode 100644 assets/image/icon_start.png create mode 100644 assets/image/icon_transit.webp create mode 100644 assets/image/icon_walk.webp create mode 100644 assets/image/position_sort.webp create mode 100644 assets/image/traffic_texture_smooth.png create mode 100644 assets/image/traffic_texture_unknown.png diff --git a/assets/image/2x/icon_by_bike.webp b/assets/image/2x/icon_by_bike.webp new file mode 100644 index 0000000000000000000000000000000000000000..50ccc0eda812d89d2687832ead0dbfcf0f6e130d GIT binary patch literal 812 zcmWIYbaPW-W?%?+bqWXzu!!JdU|=u+VsS9?baoCn!3g9sFrEOBEI_H;ypp0IcPE92 z$S4K&2Mmlr2nLDC#RU)+RuZV{+ck*V%eq)q;1}dfNi9wWD)|7!Dn&rcfo>83vPIG% zYz+`Q3BtAkvCB&eN`PttK=2?(*InG6iuTNxN6ZXv`}7BDdI zw=ghlJC6`Ugh@eSQ6ktl79h!#md3#FX*mM}ZzKbQ@C612u4u3vkig+K1)!7+&|UdJ zn9h*HkjkLI;K`83kj$V5WElY?)sVpq7{fkhj0_C=;s;m-)DLP*TH&w39Q0< zzG+DF+%lUq<-ChMCM_v>%e!h~7gyX7k;B_2iah75`EW)+De?aChg-}E#odSbNG31S)+Mc$BY0zCHoVO%8e-ulV0*E zSoGvXXY#Ep^e@Q!Z=3Yqc%{Ok|2%iLxY_6zuNHQ-buAzp6y#XJ0DBzGo2Tc zb^ZQ_-9PR*8}&pSbMHQM+J$(bU=hK^z`$St#NuG&>FgYEf)U7NU_1dLS%6Zxc_l?b?oJ93 zkx>fl4;UDM5DXHNiwhtutRzs?w`&l!mvynKz%R&|l3JV$RPq6cRf>R?1KlJ7WQ(Lj z*cu>q5`=97VwaZ`lmOKPfY?PLLC!#S3XrXlj>JwvVkZ|AfzZ zZ((5Ab{-*y2$O=uqC~K9EI^VeEscTU({cs|-be-p;R_55T+v`TAc4be3P33tpu6&c zFr6WXA(cUa!IL46A(=rB$T9*(sv(0JFou0z0Tt?tA7B;Ozd&G;O1l2v-@!S4-jf?!Ud}8%|Dsf`IQO91_kHHybF!HIZhpP_G(83vPIG% zYz+`Q3BtAkvCB&eN`PttK=2?(*InG6iuTNxN6ZXv`}7BDdI zw=ghlJC6`Ugh@eSQ6ktl79h!#md3#FX*mM}ZzKbQ@C612u4u3vkig+K1)!7+&|UdJ zn9h*HkjkLI;K`83kj$V5WElY?)sVpq7{fk+j0_C=;s;m-{0}aesN!l{e*S&@`RGbv zpWJ50+a7&;-WJH#Yn)$Tf7or(Egj1c-<2T~H~Qz^HY+mP`M7rOY3_j2d0}^JLT*d_ z>RM-W>&v{)nU^Xb2Os`9kKg&~@n4VFnd&&5Tl%v-B-)-lZ|D$bn5>|X_=9@~=i&H6 z6Iv2I>YSO{C+4m`$@@<3eDj_kZ}&U>U<(nrSkIbwTjQo-UmVbNaM18GX>;T`=5+Dv zi{v~e$-H{BtKgNF=dwbX?y~XF&ZrPf@J@4lR%hD$cve-ANM_<=fow;khTFS#$1(Ls;mo|60na9=a PH2b`>*zCWqE+Yc~Xlv?I literal 0 HcmV?d00001 diff --git a/assets/image/2x/icon_walk.webp b/assets/image/2x/icon_walk.webp new file mode 100644 index 0000000000000000000000000000000000000000..38e49db155985df02c29bdcb1bff2f6e66a1a7d0 GIT binary patch literal 824 zcmWIYbaOLcW?%?+bqWXzu!!JdU|=u+VsS9?baoCn!3g9sFrEOBEI_H;ypp0IcPE92 z$S4K&2Mmlr2nLDC#RU)+RuZV{+ck*V%eq)q;1}dfNi9wWD)|7!Dn&rcfo>83vPIG% zYz+`Q3BtAkvCB&eN`PttK=2?(*InG6iuTNxN6ZXv`}7BDdI zw=ghlJC6`Ugh@eSQ6ktl79h!#md3#FX*mM}ZzKbQ@C612u4u3vkig+K1)!7+&|UdJ zn9h*HkjkLI;K`83kj$V5WElY?)sVpq7{fk}j0_C=;s;m-<{w-zQN{Ic`T6(p=c6ly zeUhCWZ@c*w*%#Q>YxpNlbyW83s^Xg$vj0l>!3$isx8*i_dM~JE5jY*SHs{&i8_(9| zH?PjiHMRV9-GA$^cgv${{&lg=|My$_$a;?b6aFeYE$66T@wI(Qhf$8Nw~WJ8g)a)6 z3z%)YE~qw{2zj!2vM44haR?~iG|N4^`Rw}i-+NEm@9HkDV-x%v{$N}0q=$z4m|#9$ zV48V6^7q@_qDNik9-VrBUvl^49iLuQ%|DW|bm}XEoV(qezZZnAvkUqqn)LXeyKUW_ zZ{9!6zpc={`q4mgp8I2q2P?`}*2vG>*~;|hYSFo^Ps?`vTIGImjcm=AB#X7DrR}$N zn12jTeQc8PbThX^1y5w*^MxEocQ0g*tMEPh^LhRQLH?Qj7e0n@i0qol`{vov`hT7b F3;={s<(L2f literal 0 HcmV?d00001 diff --git a/assets/image/2x/position_sort.webp b/assets/image/2x/position_sort.webp new file mode 100644 index 0000000000000000000000000000000000000000..afb9000ecf59b31a591a178fe2919547d4602b12 GIT binary patch literal 596 zcmWIYbaV4zVqge&bqWXzu!!JdU|=u+Vrd2jc?JegXXk(uj6f~};|UPS0+h$ zTO=LA)&Q}SAZ!~DyS${J1gIte#4ZX6at5+ffNYI)Bz6)KJGr0;q`n8J#wItX6l50& zfPBZ3nim=jq&a|ChM|}th{2t~3FLnu9|-anF)&zsWnf^QfDlWX$-uC^m4QLx7D7yA z0Rsbn3j@Qp^9V6Sm=q)yC4!A(0g_Bm$qafxmJu*g4H?XUG3*lyRH!d~fL%abLB&I{td&Lc$hrv% ztv5skL~PTm4#b<@II>OlX)3$cs}-FhK+N*(tg7*L7YCRBN7Xu$OFEyJ@=vPLU^cn+ evhkDC;<<9ae&z3-YUFAZursAAB|)f1hyehJ9B&B# literal 0 HcmV?d00001 diff --git a/assets/image/3x/icon_by_bike.webp b/assets/image/3x/icon_by_bike.webp new file mode 100644 index 0000000000000000000000000000000000000000..de4e78ae848d07ad7c568d48ae8de9414b66ecac GIT binary patch literal 1386 zcmWIYbaP8$Wnc(*bqWXzu!!JdU|=u+Vr4M$baoCn!3g9sFrEOBEI_H;ypp0IcPE92 z$S4K&2Mmlr2nLDC#RU)+RuZV{+ck*V%eq)q;1}dfNi9wWD)|7!Dn&rcfo>83vPIG% zYz+`Q3BtAkvCB&eN`PttK=2?(*InG6iuTNxN6ZXv`}7BDdI zw=ghlJC6`Ugh@eSQ6ktl79h!#md3#FX*mM}ZzKbQ@C612u4u3vkig+K1)!7+&|UdJ zn9h*HkjkLI;K`83kj$V5WElY?)sVpq7{flr%nS_r$_F?E#90+5<%VCJ=L{83mb~Eh>gk8K zbzixct^S1oS-~T!PPM_HSx7ST9g}iqGkSLO5{Uwv78b_##;I?=$OkmXBav>r#kI#O`b z`&H=4c0F&kM-g))U4>Trh-$_kGj={6_4JA5zl)9s&o6vn6SVJ8jN@vbexELbQw}W7 z?V?RV$9g0bCHiVE&ScV)i!6DfF2~FvD`JomwD|!uqd*fQqnjo(BZFa23yUH%Ly96} zmmiZt3WLh6ZMkpGcIDpo%R0I(_v*H@H_X1x-gf`5@xJ;mtV+MmAIMd9wS4yGfGra& z-XQe%Ic?W!%F{J}>?{7T_(0@6k4werGdD#PPfHhj|Hl5cP~fd{pF3Bs?zeoe z#ief*E_KPyeSeQX+CSIBs!rzJkq@z#_j_)7b~5AllKua7=bvNO*RQ@2qqJ}4>2t-N zpM|HtnY%mp-o}ehV}C!7xU}9#n&pqd_uWh%b`+$C2W_9rRF$gJdvBVH$Gs1S;@`;3 zi=OaB+3A8eyeDj{Pf|pA8}UyCS-cGSTL2_>-U!cG4zuKL`(uH3$6oq6S@+=n+ezFScA%aG~A zE^S@D)K-ywwpT*hJa0|myD#RZ#;fa9zE`n6>h#lV>5uMtHLKZPx@~cKX-#CY_`P$?&x!ziN#H;-8I_E`p%XV6XxPA&}pL(^* zzh~#8&zBBfeD>yUhw<;H@6LR?`0vznFMs#RE3$Lvnm*rqPQyU^?a$J=x<~!CsG`O= N1H*y;zvnVB008&%2ju_& literal 0 HcmV?d00001 diff --git a/assets/image/3x/icon_drive.webp b/assets/image/3x/icon_drive.webp new file mode 100644 index 0000000000000000000000000000000000000000..098241c2765643930fc0c4284b5e034f78d2df01 GIT binary patch literal 1016 zcmWIYbaVT_%)k)t>J$(bU=hK^z`$St#L8gg>FgYEf)U7NU_1dLS%6Zxc_l?b?oJ93 zkx>fl4;UDM5DXHNiwhtutRzs?w`&l!mvynKz%R&|l3JV$RPq6cRf>R?1KlJ7WQ(Lj z*cu>q5`=97VwaZ`lmOKPfY?PLLC!#S3XrXlj>JwvVkZ|AfzZ zZ((5Ab{-*y2$O=uqC~K9EI^VeEscTU({cs|-be-p;R_55T+v`TAc4be3P33tpu6&c zFr6WXA(cUa!IL46A(=rB$T9*(sv(0JFou1Ym>3xJl@D+Tv_DeVmb>)U`GU2MoU0}V zWn0u(n#yd?Rq-tPF7y6m#wY*h^X|HJma3fedS*FGc;Q49%^iQOPVdN-K6%n(XWFx^ z(hfXZ%1U~EJNXO0zIa*B{ciX(Grvh|pGk;66|ean`tttoE8d%|?sxsDGR!(7@>$kv z`ue)J`x^!9>qF*myZtx0@a&J^ijMk!Ngr0uP8Yb8kUZ~CxM9@93I8XA{W&bqC)mig z)g;xKgYg+xow9d`+u|ms90w*26IbN`S00gm289U+7?_+nTnthLm_V_l;5{k#^0rSm zcWleO{cZ2!|8H-mzhC@Y{$f2_p0wtvPY*u;lQd4yz~5ZW?>R{Yi1=?a%b)sLKS$;2 z?8o&_d-h*BemdpnPo0_Tu2q{^{)ka?t1r46c=rA8CHsAPuBI%OW7boDt?E<~|8(Vg zxi-1tn~~Z_jyRY7yK?ycT^pY(Cq9(wuJ@k*>fz%*pKm|gzKAFG`cBDp=NBh$-}z#d zrMmV0SC4-e1{L4&Onb%KyE0|Jh9l4sLGvfy?sa0&E9;pvy}QKj*2W(JN3Z$2osxWd zJWNzO{)NW!W_|5YnXffJcSf9h)UR*bzO-ND*QsmHu5CGMWz3#Czn|9h^A-2fqeky0 dPv7}#Mz!a=E+w5iPq(bMtMV_}{^6dMC;)UsKQjOT literal 0 HcmV?d00001 diff --git a/assets/image/3x/icon_transit.webp b/assets/image/3x/icon_transit.webp new file mode 100644 index 0000000000000000000000000000000000000000..11283036fe7f0a5b7c5eb827562b795fb7a75fbc GIT binary patch literal 1142 zcmWIYbaTsNVPFV%bqWXzu!!JdU|=u+Vr4M$baoCn!3g9sFrEOBEI_H;ypp0IcPE92 z$S4K&2Mmlr2nLDC#RU)+RuZV{+ck*V%eq)q;1}dfNi9wWD)|7!Dn&rcfo>83vPIG% zYz+`Q3BtAkvCB&eN`PttK=2?(*InG6iuTNxN6ZXv`}7BDdI zw=ghlJC6`Ugh@eSQ6ktlU~DijrKK@2d|J-Hz#GZHAbf#=fh!s;2PAN~O#vt+19VqD z5T-NaFr+dlFnBWLF(fnS0a-@CNHt_I1IDmV0}}&-zVZPM0rkfVdR5$4%{yH_-?+{F zr;PlWrpklXO#T-uFo zxlb0TF5ml~>B;fq`u6j-oB#j4{llr}zpQQL`feAmJMl}lZ*!ql>YKSM%Xi%`v2Xjh zch~m~Ym$qy&HZ=H%!zxlWtGXC4X1BqAKrOT`1H|t3pVggQfpjs#&46U?Gg1&nhT|O zgmke8HnqOu^7+3iq1d5)0;kKykfyUUtfu6wU{sP36=R7^3z=l0IN^{~qN0YQctA&^ zhL3|llaM3OgA5@G3<@26o{SSxZ+8kyv&$E~{+i!-W~sl}mK#XFcOpDO^wO4~6{y{-U3a@2L3w%Rm2Z z5?SeO6#4dFxSj73gPjwvOc&bqegCP4zn|aTlYaaBefg&w4K07Xu-P~7j`Wk<06+AH`Tzg` literal 0 HcmV?d00001 diff --git a/assets/image/3x/icon_walk.webp b/assets/image/3x/icon_walk.webp new file mode 100644 index 0000000000000000000000000000000000000000..98d952165087e050f84dbb0f6e2f6b8da510adc8 GIT binary patch literal 1234 zcmWIYbaOk!!oU#j>J$(bU=hK^z`$St#L8gg>FgYEf)U7NU_1dLS%6Zxc_l?b?oJ93 zkx>fl4;UDM5DXHNiwhtutRzs?w`&l!mvynKz%R&|l3JV$RPq6cRf>R?1KlJ7WQ(Lj z*cu>q5`=97VwaZ`lmOKPfY?PLLC!#S3XrXlj>JwvVkZ|AfzZ zZ((5Ab{-*y2$O=uqC~K9z}R45N=sv4__UmXfj5$YLHGg#16MRy4oKi|n*vZu2I#JQ zAWUb-VMt|AVDMzfV@PJu1G0>Ok!r|b28>~!J4_4=`pO451g^6vHYmFWsUA;x;xlKP zai^MuypZ&S+isIo471)zav$69^?pOG?zijiZMSc13r(Hh?J9MVZ|Ox9(H%$h%B^#5 zn@wn5cI)0_<~19(Zrpa1|MuT|Icv&)+5h_YHcD2z`~BUVXsh@Bmy=)B?fY@{dA+=e z)qcDA>qWn9=l^}~2-EL1}2WS1qv(;9E*W*(!j&!xfV#P zcudN@6=r*TTWhaXK;<_ZnRQ!BN$@)*zCm%k{f9TSs)32Qy|NYRaJ)b?RfIaBnQeO84?#6Q28UJn{ zy0J+4(r=*`m1a9-tmJL(Y&Gt^tIfw>+^}U^>~S`qKTNU4eBr@5k6)aaBw{r?Njj&x z-dp(i<+n-S0*dbIXFhJc8Z8}L5f}N%a?y>cCWqhL_)uh0Wxe~=zioEYW(NOp+t}?H z@-Hys!k@xB6aSSmmoLpecCbG1merg`M|!qIWlRe`9=`PQNG zsQJ$(bU=hK^z`$St#F`8Y`V0)7&dvcR7=c^{#uFft1t^u9S5g$@ z?xYYA8KuDffPoPR!5}fYxB$Y!N&;1Vy9QBvSr@Ac{DPb*sl~}aB_DuTr3h#_&`lyh zwn#dJtpQ>uLD)7Rc6mub2~bS{h+PyCD76yiG=MiFvFeykZN(39n0wkHz(ij*%EoWfhjbvaDzQDl16%CdH5;)wZ0F;se zx+@I=%%aR z{DJA@Ye=-xwXY`RNO-EpJZWHF>X7TpO`kVquu!mad1ZEc`#Mia59P@fwS~Jv#rb=P?5S D@EDfz literal 0 HcmV?d00001 diff --git a/assets/image/icon_by_bike.webp b/assets/image/icon_by_bike.webp new file mode 100644 index 0000000000000000000000000000000000000000..d787109150ab2b10f688992a81276b5f2cae0367 GIT binary patch literal 672 zcmWIYbaR`*#J~{l>J$(bU=hK^z`$St#N1%y>FgYEf)U7NU_1dLS%6Zxc_l?b?oJ93 zkx>fl4;UDM5DXHNiwhtutRzs?w`&l!mvynKz%R&|l3JV$RPq6cRf>R?1KlJ7WQ(Lj z*cu>q5`=97VwaZ`lmOKPfY?PLLC!#S3XrXlj>JwvVkZ|AfzZ zZ((5Ab{-*y2$O=uqC~K9EI^VeEscTU({cs|-be-p;R_55T+v`TAc4be3P33tpu6&c zFr6WXA(cUa!IL46A(=rB$T9*(sv(0JFou0r0Tt?VA7B#L-k>(=%ALk~Uyen~eD1Y1 zZOc`8zw>bEpM^4=vode1X?}Vr+c0-^lgGA8Pt5PkWpGhoI3s;?|F?I(0lSsf$E{Mb z|F5f>$#UJPM@?!e1GmnGi|&cNLZSv4DxQJzmyLVs*RxA0{aU{vS32d)2R4QW%m$4n z(bvWQ9NGS5_QbU*lV5q9H&5k1`R=Nh`op6u!z}MjF@M3ZcEMZQhZWoZMRwM@pJ3=- G&IkYs^O)QK literal 0 HcmV?d00001 diff --git a/assets/image/icon_drive.webp b/assets/image/icon_drive.webp new file mode 100644 index 0000000000000000000000000000000000000000..67dcf34609801f8ad42142f6bff3e87960bac66d GIT binary patch literal 622 zcmWIYbaP8%Vqge&bqWXzu!!JdU|=u+Vs0?83vPIG% zYz+`Q3BtAkvCB&eN`PttK=2?(*InG6iuTNxN6ZXv`}7BDdI zw=ghlJC6`Ugh@eSQ6ktl79h!#md3#FX*mM}ZzKbQ@C612u4u3vkig+K1)!7+&|UdJ zn9h*HkjkLI;K`83kj$V5WElY?)sVpq7{fm0K!y6;2bcuH9n^RX|IU8#Jj~hgwwcd) zGlR$H^;0IBeY^Y5|GHL&%F45K`V9@`j-pNiFUsGjJ#yycPz#Y!Ec|=WSLODmOZET% zyTx+_O>pSpDiOHb@$>}?zu@2hjm!)`)cm{3ZdUl%7KN#Mew}q^)%%mL<&CfZ(qv`; E08WH{0ssI2 literal 0 HcmV?d00001 diff --git a/assets/image/icon_end.png b/assets/image/icon_end.png new file mode 100644 index 0000000000000000000000000000000000000000..2f288f4cfa474ea4efcc7ac9552a56b252b8289f GIT binary patch literal 4121 zcmaJ^c{r5q+qQ&+Bw0h#NR(w}>@#*TvWz18I%7MpuxA*t`@%25&@jUl^U&nQx*LMDKKXI4Mjd+fT9${i);xWExV98iD z8L#fmE{16V2COR322CoP~Si9~>bK!JgQ3V})rcs~yi1PX;-&vFd-s9tgshz=&*s@xumS+~IzB zU%=mm!?1tOMdgot|6tw!oQvuou^>h=po8)LuW|o2F*J0r{a3t!Z?8E^_%sFDe+&^ zT+&PfQO#ynf3&{YyH1TOdGh3PzEnBjjj;7b$W2>UVz|yVG?PmK#}-q=Asvn?-lJ@> zH@G?i$$=eNWNOr<=rpo41lOjK(%>_*ka;&o%68-Ph7^wb#j+<2K%4Cf%i*`2?&ay2 zHc71KsV<1pVc!;Wjq_Zah%Ni@GD)7G!nGSSogQCY5|;;+{Oc&&{zh8&ud0Lv&0~#$ zr!GCaZN(|b$ue4g&ay!P*~#R9d<0M0_^Il^>k{vAZ_TE2hUFo)N`|Gk#?sPY^Q!!ro^I47Nuq7UoyCB775drl|h>BXD%?h}L9ov1?tK=C}f-Z)}98XDCjh39JMS zYeTItne{g*1#K}|idO=Vk(rZ?tU<{kh@BTSP9lX#oZ7xdD@%LJ6a)R$KP(0O{_)Gv z9$SO#bIlLOQ&{_9Km2=)R$GG;0(tk}%hZMIHJ#w*A!?t75Neaf4a=?Rm6;8NaXq%n z9Fq4J30bldY;0`k^Hv>VdFr2?$1j2p>AThZmA?|Ee-Sz|(?*mYofp@h8~=`<8WJ9I zJDyg5%l}Z~c}!#zQfIj`z*s~Cy!?0Ep2|6 z!xSNcbYg35cx}JOQ+B5Bmej2xy~EWwm*g~Qt5$rOT@9!ob}Y~@fjNBRlSNj%T=$!z zcfA8DzY5>BkLYZz)MwA#A@6KCHqdX@)v=$8x~I~0jhnp@)3-r?Tl8_En>pq?wJiC_ z7>spt#!Zi_ZPMBK30=vw{pL9%BkuvY$w@&`E+HQVYeP_EkIXpFrq?NBAc%Zno8*dz?rWvwZ=v%go*Cj8R7 zQ)kV!YwaGiB2xrNv!ZG-BIu6}CUUqNU2Oy1w2X z#`H`*6YLQwTQSw5zH&n;nc74D5-K8WKU4 zKlDm1yc*|UgBo^ftLKGryS0YIZG5VdtkWw+&Glt1A1C#maqKa^y5=`q*sWITQ#Gr= zm%x+DI@|K#6{OZcHzLoYuhTWmzQyA9xwj97r@lq=OUDL}-`?KUd?!|YQk5n~coq3T zv6C5Go|;QoA(Yt+ObK$56`YVtm?~Q(j$e;c!`sd8&FNt$1E!Uy1_D+j+*v%%qrt`1 zp(gM3d3@C5M!t!L`YXnCnIs+dh36kfWK0mOPrdVLG(}lCA^FBPM-HB)rKMB0l_;ObJt|V3z7yPAx8|2VRl@@HG-{!T) z2AmXfxH0jQaM~*3;L2pv6d*93{wa7LL&1m-AT5ewlKbHbyI+;|(oRmb7%81S`8iJZ z#Af5j$tT4)=OpXAy$21bc<;OExw#r(FqqK1yIs^x`JDevIc)pJ_n3Rguer=#D?gr1 zOg;MiS43y}>!w|?3CbQvKeI=qLmWFB^WD2qQBeV~X|p2xB75_g%;uiS@BVe9EIacN zj=O!wz>CU2LQLq3Va18M5mCr+PVMVX{x3r=3%uWjA0I7TTSciLyHw;Wu&WRCx@o9< z=BrES7|$2(Q4cno17(lSn9a`daVBAm%KGZ^Vv384+4>!akGG9I^Bq@s@D6x5Y|j1O z+>Gn|50(zDiyrbh6-{o_P5!3e_D0FYJhg*;eLwllP;Fj?9{q|`y$lryy`{mjIN;1^ z%}1cX-YcfBei3&aUULX_>~EFVUXgUoDvgnm?a<$>jwI_fn=_w$UWV~kIk7+V5b=Y< zR3!Fj%`mq&Bq1_oj;G5-Ele?ixcZ=AJTF@H%vd*^Yk8a|-HzV>6|aNY8nv1Zik4*3_I zosHxCXL^3p2X({4$D?=-4{=@J(RIMt*w}E$%=OQkjZ^GRqXzr?eMCe=vJ?Bj{#Ksn zhMhNCpK@KU^(a4asBzV)IiNDs%8K&2>xK%?7}NFn*GX50HUyniZQhT)Fa&0YYa<*h zGQAE97mm&A*G79&9;JRcI%X*=ueSf>4zG!+>GBn;Bzc$OFShL#wGV-&fGx?FD2ak}C3>Y`RB~LLv5~0o%^VdA@x|*LuMh=U*LgEdTfbBJIJwZ*Tco6n8@D#349_Ps+kX|I%9XGKE6TFL!fZz`0=L_ zWI2IzKx3D$0zfi(=U8LuQn|g>K;HeWEJF!^z-zK=$}Cjdct`u^RZ+GmWNhj)nBH2p z2~xsDcHduYt6X|lzDt)*i9_!kd3=fa(XSf|i~5pR9?Z=Y~tT$SzC5 z{WUW=Ph6Q#7TSNrczC2(sKL2GZK)sQb5!MX@+KSbDYL?D?8`zO?4O2)hQzzGm)}24 zxHeXzJjV%`ep6*=QQLJ2xyL?6!`@vicn@-lV*V-Gr+?4u&-9w9`VZ6v-n|O}yoMAyQT!YZ@ zt`POe!o)`O7Awb5Gj+d(i}xIAYHFS?INw|d%Sc|CX$?(U&G1|hnNCzPm+o!mHBxU5 zUYmQB$H{;8af{!gNjasuwBxF~dtORPifjLtQ=-5Mk!yqgYfU#{YN#CJ;T+wh7P9e) zolGV(dyiHjYQ09Xk2#5J7K^417c5!m_^fs5DBL(kQM{CHkikC1c6nw#yQbFZ5pmxB zlEjmHU_G0m4sK+^efhg>r`lyQII|@}Xo>5r&ozgYwyLrD(2ie1 aNT%4!gylds#ms}Bbz?(wgDQPw)c*kgF=nj* literal 0 HcmV?d00001 diff --git a/assets/image/icon_start.png b/assets/image/icon_start.png new file mode 100644 index 0000000000000000000000000000000000000000..ffc9a673ba3b746e2a753a92825b3205f640dcc9 GIT binary patch literal 4021 zcmaJ^XH-+$)}=Qo5;_D32nq@$flxw~E+x_e0TCr6K>{Sf6bVh5D9s8InkXP3RVkt( zC1OFUG$~R;d?X`cLBLQw@*w zqMJI%?*epRadI%a5grkD|aHsG@6Xn&%Ey^G~)T|?G`U^r0GEx59 zlqbR&WJx09K)PCbni!~#0Z1RN1=WQcXu~u>+7PH77y<`FVVV%AAp~v+fr9>dlv&Zp zSbsxTE1Q2}u~sI^0aR*;As8GQ8mbklqeUX00z=_&I2fW0*4EZ!Av7srL@JuDNu=!i ztzd4z)0Vz_g*3FbjxBb!isE#BjeBDur_28 z0rXemhWLN+Vy*|*f$JGqv-IHq?&WVT_P=_8?sES<4=~FNc=ve!Q~ZLCjANhrE6 zdiRy3+zmvbVjCvz8%6a{k1h2aZ8Hll=^0!R&`B+)g?jjSOt>tKtTd#kIo_`-0BO9m zXYj2cuPG@?(KJFG;Ldwxicwy$Ha zns|#SJ>RV1qzMJiNh_A{e8SNL0vn#(*P7~N-1&8wet&?TsjJ0*@@&%gxsa6iE$8$6 z=_BsEPDp_O*F*W%1MGnW#XCHMpuK!d%MZeSQu=G58?k$<1zSxxl_re<#dPj?Hm
<%uM^PA0EB8N|Kmn?$EAGrGnh17i)tXrowr$0h2 z?vIUf(>Koz<=U~IhI8hV#>6sxNqtYcGa{~>qzDI$HxF`gw0$|T6`r|dcEd<_3|Obj zgw2i@RxI07_#<6^IqjDpG|inBe?E)l^r0f|F z`jv-zles8n^ggsK)K1yN(k7Sm!eY8~F>C8im(8tV1V8;2L>52Hn*qE#MB6Z);NQ(OG z%g}1tCLhf#ivN=!TXnBcw!8fY`9Z;(sK7V!3XLoGQ94_ubK{-&yxmX(scZ_;(wT<< zNwE-Z&boHk_ux^Z@*YDy*)$w#JbIu0{*rN zc{S>4UOW}RC;oiEqj$j=iTHwg^=eh-X$@cwno-Ps`h(2OgE_(+|GB=6_4(zr%XbZK zE4hO`BU5MliH>zc!Xs3%@ovn4=FnK&cWk^8l+$YQ|%(_7c%(e7#W^9r3zHQz3qW2ZwL z@J)=>eSoSTS8WBY&6M42&b(XDEpPbZc5%Iy_wgA-u;y2d&fcf#QXNGj+1-nhCz!_{ z4HqxKa?Z#~3Ikvjl*77f%gr4O_^fDV$T{g;Y%WjIlAWh?kc)%X(SuuJhzHY+Q$K;JKVe zlKt}K=Fka04wb09xEsyndovT@yvS~FOpOL`j8CNe^`bHgg>tOl7slDC3Vw0C;4bi6 zr+&`PHqKhTu-L;av%#xyhTx=;lSdBT7o!TWQy4+9l&DeF&T8o;TdGeJUXUsqo)oZ6gnNZW2uG;!{Y^GyMjuX*YhbhZZB{wAZGB?mI!3jScNd zLtFsMrD&Y(Kg=FjuaO0B9`k^Y`zWr%S}(Us=}hFvjjKH) z`OTbDuNs<|1KR7#Q~}cxra)hVRkF{z^DKX{dH+svY}W+CtNrWVEroV9sdvS8Pu1k|jvj>A0)*vv~|U+#Tf zjxxIycE}vSJrG%ZEK)4Fc)BSSgoBP6g+p3yxG0mfL@oCi>zx*!) zKh?zJRuGqG5`+nb>bRVU%kwicf|=`(d0cL-DbsB8y!Le=bjkt2H6Fn$>?^KuI|4E` zVZ&;Wwu!fIe?=I2%4Z9=o03Z|sLDO6PN`Rf@B{%e8<*d`J1y^h@TP?^0mKgzy^?GG zvi?Cy^Akr~tj?Pg!4eQ&O+XU)6UV6o@9JvI{P)m5XC4J=V#P*n9&hvx>0oQsJ!_f3 zP#2dzt;XJq?FP}!a*q?ngyzL9>aQTMa-)g$D|)=0Dyo=|@1NAz_YMw+^yDA9A?)^=U~6Eix=Hr<(YUZ006EefswMPV_cQUgVQ_P+r+8-)d#Ou z51W5XVDKRBJuVz-wdi`=_p^RzXo#BS_^mfLv~n`ZwwL}+r4(r&aqgLZ-$0n|N#>LR z$+?hLwk##r4J8@89$3v(!B6<|JeiE%&vjM%@%w1v>@nWDpebDg+;J=x-l_YU+&w0)9`r`G8tB3GYPSFRG?7S*2oQ}2 zYmh{iEYsMriS|X|DLq$X>nevc4oJg3E+?JP7fczROxd7!dU)m-cku@?uP_+Hrv?2b z46Kje06TmtaKBh6{iJdNg%}+elTLE0uCiWuUJBuC3sRqK(@JZeXwI_X$w#Xi5Q_4r zbK0kXTRc0Y+nyOF=zNQ4hhgTj`o$_d*z++5W%9+>DqvI1Ic<>rkD>Eg_cmAc&x2!! zw*mYfcEh*eLql52&c4Fg{f#Rt#5a3+mYzyNm!4v@xZV%e?oS^@amvffdr^fVo*Hsx z#%CN+k-}#sWF%@omAtg2pVO-IFkDY0Ej#E^3{4uMUtI0|GwIU&rV}SA*A~IAD$d`K z@Zds1Lc*$nz)(K3%ihY@S2ujw*m{z?Mm+7N_e<0Jy@B_KYieq~%j455W82;MwxRN1 z;amdD&kfV{RDqdpDvOBS*A&DE^E{avC9e!bTxeF_j74ZEX{2%cF7?U@rI($nw m^7uY?>83vPIG% zYz+`Q3BtAkvCB&eN`PttK=2?(*InG6iuTNxN6ZXv`}7BDdI zw=ghlJC6`Ugh@eSQ6ktl79h!#md3#FX*mM}ZzKbQ@C612u4u3vkig+K1)!7+&|UdJ zn9h*HkjkLI;K`83kj$V5WElY?)sVpq7{fkQK!y6;2bcun6DH&?x%b=J=9LN0lHAEv zyXrHo9k=J$(bU=hK^z`$St#N1%y>FgYEf)U7NU_1dLS%6Zxc_l?b?oJ93 zkx>fl4;UDM5DXHNiwhtutRzs?w`&l!mvynKz%R&|l3JV$RPq6cRf>R?1KlJ7WQ(Lj z*cu>q5`=97VwaZ`lmOKPfY?PLLC!#S3XrXlj>JwvVkZ|AfzZ zZ((5Ab{-*y2$O=uqC~K9EI^VeEscTU({cs|-be-p;R_55T+v`TAc4be3P33tpu6&c zFr6WXA(cUa!IL46A(=rB$T9*(sv(0JFot~=0~P9XA7BzVzd&G;%JTQk_Lo-MoM7d3 z&6W0i_owaZ2lmY@eyq8-J?=68Ss*uY_bN_?rn5JHUvXe$tSEl6yXg8lw#~vb)z<|i zEj=ncS6|7dvHyc2bNeHwwfZ76=5v}VGqvU3wzyRL{_p$8f5U6<^9cS8zp;(iD6N7S yXfwkU?+@qlLKUC;U3%xbRcYT#_S37n>r6gtmgXI=tX?kkX_DBdfT~T53=9CUev=CT literal 0 HcmV?d00001 diff --git a/assets/image/position_sort.webp b/assets/image/position_sort.webp new file mode 100644 index 0000000000000000000000000000000000000000..c0b200554382eca26d97f4aa2ff1beda3b02efa8 GIT binary patch literal 574 zcmWIYbaOLfVqge&bqWXzu!!JdU|=u+VqOLYeg+0lXXk(uj6f~};|UPS0+h$ zTO=LA)&Q}SAZ!~DyS${J1gIte#4ZX6at5+ffNYI)Bz6)KJGr0;q`n8J#wItX6l50& zfPBZ3nim=jq&a|ChM|}th{2t~3FLnu9|-anF)&zsWnf^QfDlWX$-uC^m4QLx7D7yA z0WeTo7#OylM~ET9q#&^<5o{a_kYq|rV_^8S92gIg3=F~-7#O&s!E!(Xhuai@QZhhy zeKg93vmLmopigC3A&1dLQe1~Xs``*;8q>hm6877$lZ@lY&lWzjscZh}JV z4N(CR+w`gf@um_klSI-hOcfGS71$-U83pr~9CLK}->gt2V%#NqRJ^r*&#NCzj}L5o HID-)YETdt5 literal 0 HcmV?d00001 diff --git a/assets/image/traffic_texture_smooth.png b/assets/image/traffic_texture_smooth.png new file mode 100644 index 0000000000000000000000000000000000000000..e4252dc4d5c753427a674e0fc0cca13153d648c2 GIT binary patch literal 980 zcmeAS@N?(olHy`uVBq!ia0vp^3P9Yz!3HF=(z2x(7?@{!x;TbZ%z1k)+atJ8gyF;H z_SxaW&#!Dbv+TCc)``ZPw-LERN4>ZreVe_xbj_`v1Sv54;!f+-}Xt zU{c-uAir(JNua}Ktup6fV0ack*G*ZVfq_MVfsw<3fe8<@K}dm9Y{mMHPqV#~%1%4q zJSfbayKnORZ=Ty%o_lcP+LJYrfjaz2g=^oL=6vUlu2?OyK1feRz^6}wL81KPv_9rj zr#GryI`lpL$FmD5u8W`K6bW=ovoHh*ZMH7XNc(bEc|z{o=;t4~=LpNpQJf)j=&R*q zbmdGjjW}{a}KAR zKQYPgzks0kwB66A75osiW3+!8EO(xh;lYnfb0wcYF1r7dDWr?rKCOM}x}~RTH^2H- z!z9&yKYK-9n&FH!#ZAsH-4~Z{sgRD_mDB&{$fa1xd!IyWdmq~|0?A3=I`6Fy;pI?k z-=U@FagNXX@0)qI1*d&_>h$N~RUNj;u9h*^FZ?N4Qo7gwfPtl4-J0E60m;%=0!_L2 zIUe5k)#;tW!hL03wv*DX{aOn(RC@MyxR;*aJaOAL?ONWIWy=pUyYJ+$nf*pw^y?jy z*&f|9wdCa`M62yRz1-MZW^t$;57X2$@n~XAT6OE3=h{^3@3^e@7$H=lxlpWa`xkmf@gc%o%4;8 zc04>gy~W)u*!H%}zgt^m?4CBUU$XR$yJGjQCiUMO)B8O0-#2l^I*0ZC+j)KJd)-%T z@%3xuGG>)q=rS-IkldORymw>kH8&Op1^M7IkI?VeF0Ne4sxWsmhIk0fqVD*&-?sdUAdRF=38dAWBJz&Wv6!ZObB7Mc?S} z+wBX4FHU~QFU?h*r@_9=olVwn`C_;KF>%Y*eZ7(P^2naw2WkTIb8bfD|M~p>%kSB{ lAKkYRRw9(p|AaTh|6QcI|H84!+km;1!PC{xWt~$(69960wiy5b literal 0 HcmV?d00001 diff --git a/assets/image/traffic_texture_unknown.png b/assets/image/traffic_texture_unknown.png new file mode 100644 index 0000000000000000000000000000000000000000..2e84a9cd3cff9445d964265f12dc700383e95137 GIT binary patch literal 888 zcmeAS@N?(olHy`uVBq!ia0vp^3P9Yz!3HF=(z2x(7?|xnT^vIy=DfX@>*HG}bKv9p zb+_-V`D!EFDL1Xe{e)Lw<&8z+CeE89`9B-<7)};{Cc0TPtx7O$nVQ+k8RFaCao>4& z=5kBG5+#50Ez(}%cSGX}uD-L~UahzJ=AXLv=YIY@_y7CO?{hv|{}=qzGvnuPc7|Dt zxPHtQyj;Z4uuR+9ouT6I)jTaH1}1?91{MVdMh*u&OcBOk0a0Aj19xl6PM+Vl?tW}d zpiFt3SkgQDV-6>^eC+N;$Y#4)&6^>8michlqSB~E44Z^k#FtGm@aAuvXEI;-X!9#x zpN}7pu_pvut$e@BFwA6<-IjAN_|4~}xZQ(fvCEoMt+&8qHS@;yZ_U)g!agBjAV-8V!Zc%FamJ7>b*n4q%s zq!MiRlAZIsHQM28Y}8b}YZVJ`PW4QRGrAsQdf$fsa$87H%+v0yA5X*r zQXJ}c_p&WzEr}{&pKhF*s8cRm%&k_Oe_m)=)}9L*X66Ca5A8PJVY1rAc}hPyB%57- zsu-7)?}Lw5TV6P4Zk*rE@$BluoEqku58=C>CE0H0%I&L9?Uo-44e46*6^l6Q0{gb&t`xeZy4xeXmce1JNy$N?J+Uib6&MU87 zTK(c@vYL;3&yuQL_wwI%oV%}_`BqbI?>~p?{|tXs-F$AJx9pEJHGCr@p{MnFMr`Ew s*B2hg=k?bY`)d$LjVvGH8TT { BMFMapOptions( center: latLng, zoomLevel: 15, + showZoomControl: false, + showMapScaleBar: false, + rotateEnabled: false, ), ); } @@ -339,6 +342,9 @@ class _AddressMapPage extends State { double.tryParse(value.getString("longitude")), ), zoomLevel: 15, + showZoomControl: false, + showMapScaleBar: false, + rotateEnabled: false, ), ); } @@ -362,7 +368,10 @@ class _AddressMapPage extends State { child: BMFMapWidget( mapOptions: BMFMapOptions( center: BMFCoordinate(30.553111, 114.342366), - zoomLevel: 12, + zoomLevel: 15, + showZoomControl: false, + showMapScaleBar: false, + rotateEnabled: false, ), onBMFMapCreated: onMapCreated, // onCameraMoveEnd: (cameraPosition) { diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index b18eeb24..be6f7b3e 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -484,6 +484,7 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { }), ///推广图 + if(activityBannerData.length > 0) spread(), // ///签到 diff --git a/lib/main.dart b/lib/main.dart index 0b9440db..44461e0b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -73,6 +73,7 @@ import 'package:huixiang/settlement/settlement.dart'; import 'package:huixiang/store/store_view/product_meals_sku.dart'; import 'package:huixiang/test_page.dart'; import 'package:huixiang/union/location_map_page.dart'; +import 'package:huixiang/union/location_map_pages.dart'; import 'package:huixiang/union/union_select_city.dart'; import 'package:huixiang/utils/ImgCachePath.dart'; import 'package:huixiang/vip/user_vip_service_page.dart'; diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index b6a7bf09..6bbc3dc7 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -450,7 +450,7 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { Widget spreadImage() { return Container( width: double.infinity, - // margin: EdgeInsets.symmetric(horizontal:14.w), + margin: EdgeInsets.only(bottom:24.h), height: 85.h, child: activityBannerData != null && activityBannerData.isNotEmpty ? Swiper( diff --git a/lib/mine/mine_view/mine_navbar.dart b/lib/mine/mine_view/mine_navbar.dart index 263332ca..0308eba6 100644 --- a/lib/mine/mine_view/mine_navbar.dart +++ b/lib/mine/mine_view/mine_navbar.dart @@ -175,14 +175,14 @@ class _MineNavbar extends State { Expanded( child: InkWell( onTap: () { - SharedPreferences.getInstance().then((value) { - if (value.getString("token") == null || - value.getString("token") == "") { - LoginTipsDialog().show(context); - return; - } - widget.toIntegralPage(); - }); + // SharedPreferences.getInstance().then((value) { + // if (value.getString("token") == null || + // value.getString("token") == "") { + // LoginTipsDialog().show(context); + // return; + // } + // widget.toIntegralPage(); + // }); }, child: mineBottomItem( widget?.userInfo?.points?? "0", diff --git a/lib/mine/mine_view/mine_view.dart b/lib/mine/mine_view/mine_view.dart index 2c46c8f7..92f153ac 100644 --- a/lib/mine/mine_view/mine_view.dart +++ b/lib/mine/mine_view/mine_view.dart @@ -373,55 +373,56 @@ class _MineView extends State { ), ), ), - widget.userInfo == null - ? Container( - alignment: Alignment.center, - height: 50.h, - child: Icon( - Icons.keyboard_arrow_right, - size: 20, - color: Colors.black, - ), - ) - : Container( - alignment: Alignment.bottomRight, - height: 50.h, - child: GestureDetector( - onTap: () { - widget.toIntegralPage(); - }, - child: Container( - padding: EdgeInsets.only( - top: 4.h, bottom: 4.h, right: 16.w, left: 7.w), - margin: EdgeInsets.only(right: 14.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Image.asset( - "assets/image/icon_gold_coin.webp", - width: 16, - height: 16, - ), - Text( - S.of(context).tiantianlingjifen, - style: TextStyle( - color: Color(0xFF32A060), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), - ), - // Icon( - // Icons.keyboard_arrow_right, - // size: 16, - // color: Colors.black, - // ) - ], - ), - )), - ), + ///应运营需求暂时关闭积分板块 + // widget.userInfo == null + // ? Container( + // alignment: Alignment.center, + // height: 50.h, + // child: Icon( + // Icons.keyboard_arrow_right, + // size: 20, + // color: Colors.black, + // ), + // ) + // : Container( + // alignment: Alignment.bottomRight, + // height: 50.h, + // child: GestureDetector( + // onTap: () { + // widget.toIntegralPage(); + // }, + // child: Container( + // padding: EdgeInsets.only( + // top: 4.h, bottom: 4.h, right: 16.w, left: 7.w), + // margin: EdgeInsets.only(right: 14.w), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(12), + // color: Colors.white), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // Image.asset( + // "assets/image/icon_gold_coin.webp", + // width: 16, + // height: 16, + // ), + // Text( + // S.of(context).tiantianlingjifen, + // style: TextStyle( + // color: Color(0xFF32A060), + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // ), + // ), + // // Icon( + // // Icons.keyboard_arrow_right, + // // size: 16, + // // color: Colors.black, + // // ) + // ], + // ), + // )), + // ), ], ), ); diff --git a/lib/retrofit/data/ip_data.dart b/lib/retrofit/data/ip_data.dart index 6c35e6ee..532f1804 100644 --- a/lib/retrofit/data/ip_data.dart +++ b/lib/retrofit/data/ip_data.dart @@ -1,42 +1,104 @@ -/// id : 1887 /// ip : "27.18.151.119" -/// dz : "中国 湖北省 武汉市" -/// wl : "电信" +/// pro : "湖北省" +/// proCode : "420000" +/// city : "武汉市" +/// cityCode : "420100" +/// region : "" +/// regionCode : "0" +/// addr : "湖北省武汉市 电信" +/// regionNames : "" +/// err : "" class IpData { IpData({ - int id, String ip, - String dz, - String wl,}){ - _id = id; + String pro, + String proCode, + String city, + String cityCode, + String region, + String regionCode, + String addr, + String regionNames, + String err,}){ _ip = ip; - _dz = dz; - _wl = wl; + _pro = pro; + _proCode = proCode; + _city = city; + _cityCode = cityCode; + _region = region; + _regionCode = regionCode; + _addr = addr; + _regionNames = regionNames; + _err = err; } IpData.fromJson(dynamic json) { - _id = json['id']; _ip = json['ip']; - _dz = json['dz']; - _wl = json['wl']; + _pro = json['pro']; + _proCode = json['proCode']; + _city = json['city']; + _cityCode = json['cityCode']; + _region = json['region']; + _regionCode = json['regionCode']; + _addr = json['addr']; + _regionNames = json['regionNames']; + _err = json['err']; } - int _id; String _ip; - String _dz; - String _wl; - - int get id => _id; + String _pro; + String _proCode; + String _city; + String _cityCode; + String _region; + String _regionCode; + String _addr; + String _regionNames; + String _err; +IpData copyWith({ String ip, + String pro, + String proCode, + String city, + String cityCode, + String region, + String regionCode, + String addr, + String regionNames, + String err, +}) => IpData( ip: ip ?? _ip, + pro: pro ?? _pro, + proCode: proCode ?? _proCode, + city: city ?? _city, + cityCode: cityCode ?? _cityCode, + region: region ?? _region, + regionCode: regionCode ?? _regionCode, + addr: addr ?? _addr, + regionNames: regionNames ?? _regionNames, + err: err ?? _err, +); String get ip => _ip; - String get dz => _dz; - String get wl => _wl; + String get pro => _pro; + String get proCode => _proCode; + String get city => _city; + String get cityCode => _cityCode; + String get region => _region; + String get regionCode => _regionCode; + String get addr => _addr; + String get regionNames => _regionNames; + String get err => _err; Map toJson() { final map = {}; - map['id'] = _id; map['ip'] = _ip; - map['dz'] = _dz; - map['wl'] = _wl; + map['pro'] = _pro; + map['proCode'] = _proCode; + map['city'] = _city; + map['cityCode'] = _cityCode; + map['region'] = _region; + map['regionCode'] = _regionCode; + map['addr'] = _addr; + map['regionNames'] = _regionNames; + map['err'] = _err; return map; } diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index f780186c..8a795c75 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -27,9 +27,9 @@ import 'data/shopping_home_config.dart'; part 'min_api.g.dart'; -const localBaseUrl = "http://app-api.test.yixinhuixiang.com/app/";///本地 -// const localBaseUrl = "http://pos-test.api.lotus-wallet.com/app/";///测试 -const serviceBaseUrl = "http://app-api.test.yixinhuixiang.com/app/";///线上 +// const localBaseUrl = "http://app-api.test.yixinhuixiang.com/app/";///本地 +const localBaseUrl = "http://pos-test.api.lotus-wallet.com/app/";///测试 +const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线上 ///调用小程序的接口 diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 03864b03..1ef0eab4 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:gbk2utf8/gbk2utf8.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/activity.dart'; import 'package:huixiang/retrofit/data/article.dart'; @@ -17,6 +18,7 @@ import 'package:huixiang/retrofit/data/order_info.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:retrofit/retrofit.dart'; +import '../utils/flutter_utils.dart'; import 'data/achievement_detail_list.dart'; import 'data/activity_pos.dart'; import 'data/address.dart'; @@ -63,11 +65,15 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -const localBaseUrl = "http://platform-api.test.yixinhuixiang.com/app/";///本地 -// const localBaseUrl = "http://platform.test.api.lotus-wallet.com/app/";///测试 -const serviceBaseUrl = "http://platform-api.test.yixinhuixiang.com/app/";///线上 +// const localBaseUrl = "http://platform-api.test.yixinhuixiang.com/app/";///本地 +const localBaseUrl = "http://platform.test.api.lotus-wallet.com/app/";///测试 +const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/"; -const ipBaseUrl = "https://api.asilu.com";///ip +///线上 + +const ipBaseUrl = "http://whois.pconline.com.cn"; + +///ip @RestApi(baseUrl: localBaseUrl) abstract class ApiService { @@ -85,8 +91,7 @@ abstract class ApiService { if (pay) { headers["Environment"] = "app"; } - if (kReleaseMode) - baseUrl = serviceBaseUrl; + if (kReleaseMode) baseUrl = serviceBaseUrl; if (isIp) baseUrl = ipBaseUrl; dio.options = BaseOptions( connectTimeout: 60000, @@ -96,21 +101,26 @@ abstract class ApiService { ); dio.interceptors.add( InterceptorsWrapper(onRequest: (RequestOptions options) { + try { debugPrint("\n======================= 请求数据 ======================="); debugPrint("method = ${options.method.toString()}"); debugPrint("url = ${options.uri.toString()}"); debugPrint("headers = ${options.headers}"); if (showLoading && !EasyLoading.isShow) { //是否显示loading - EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); + EasyLoading.show( + status: S.of(context).zhengzaijiazai, + maskType: EasyLoadingMaskType.black); } if (options.data is FormData) { debugPrint("params data = FormData"); } else { - debugPrint("params data = ${jsonEncode(options.data)}"); + debugPrint("params data = ${jsonEncode(options.data)}"); } debugPrint("params queryParameters = ${options.queryParameters}"); + } catch (e1) {} }, onResponse: (Response response) { + try { debugPrint("\n======================= 响应数据开始 ======================="); if (showLoading && EasyLoading.isShow) { EasyLoading.dismiss(); @@ -118,7 +128,7 @@ abstract class ApiService { debugPrint("code = ${response.statusCode}"); if (response.request.path != "/creditGoods/list") - p(jsonEncode(response.data)); + p(jsonEncode(response.data)); // debugPrint(jsonEncode(response.data), wrapWidth: response.data.toString().length * 10); @@ -136,6 +146,7 @@ abstract class ApiService { // SmartDialog.showToast(map["msg"], alignment: Alignment.center); } debugPrint("======================= 响应数据结束 =======================\n"); + } catch (e2) {} }, onError: (DioError e) { if (EasyLoading.isShow) { EasyLoading.dismiss(); @@ -225,7 +236,8 @@ abstract class ApiService { ///充值活动列表 @GET("/wallet/rechargeActList?tenantCode={tenantCode}") - Future> rechargeActList(@Path("tenantCode") String tenantCode); + Future> rechargeActList( + @Path("tenantCode") String tenantCode); ///领取优惠券 @GET("/coupon/receive?couponId={couponId}") @@ -584,6 +596,6 @@ abstract class ApiService { @Path("creditGoodsId") String creditGoodsId); ///获取APP门店推广渠道 - @GET("/ip/") + @GET("/ipJson.jsp") Future getIpInfo(); } diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 6a8f5b98..ebab27b3 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -17,21 +17,18 @@ class _ApiService implements ApiService { String baseUrl; @override - Future> upload(data, folderId,bool isVideo) async { + Future> upload(data, folderId, bool isVideo) async { ArgumentError.checkNotNull(data, 'data'); ArgumentError.checkNotNull(folderId, 'folderId'); const _extra = {}; final queryParameters = {}; final _data = FormData(); String fileName = data.path.split(Platform.pathSeparator).last; - if(!isVideo && !fileName.contains(".jpeg") && !fileName.contains(".png")) + if (!isVideo && !fileName.contains(".jpeg") && !fileName.contains(".png")) fileName += ".jpeg"; - else if(isVideo && !fileName.contains(".mp4")) - fileName += ".mp4"; + else if (isVideo && !fileName.contains(".mp4")) fileName += ".mp4"; _data.files.add(MapEntry( - 'file', - MultipartFile.fromFileSync(data.path, - filename: fileName))); + 'file', MultipartFile.fromFileSync(data.path, filename: fileName))); print("filename:$fileName"); if (folderId != null) { _data.fields.add(MapEntry('folderId', folderId.toString())); @@ -93,7 +90,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => json==null?null:json, + (json) => json == null ? null : json, ); return value; } @@ -114,13 +111,13 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => ChannelsList.fromJson(json), + (json) => ChannelsList.fromJson(json), ); return value; } @override - Future> sendVerify(areaCode,mobile) async { + Future> sendVerify(areaCode, mobile) async { ArgumentError.checkNotNull(mobile, 'mobile'); ArgumentError.checkNotNull(areaCode, 'areaCode'); const _extra = {}; @@ -337,7 +334,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => RechargeActLists.fromJson(json), + (json) => RechargeActLists.fromJson(json), ); return value; } @@ -359,7 +356,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => json == null ? null :json as dynamic, + (json) => json == null ? null : json as dynamic, ); return value; } @@ -592,9 +589,11 @@ class _ApiService implements ApiService { data: _data); final value = BaseData>.fromJson( _result.data, - (json) => ((json??"") == "")?null:(json as List) - .map((i) => Store.fromJson(i as Map)) - .toList()); + (json) => ((json ?? "") == "") + ? null + : (json as List) + .map((i) => Store.fromJson(i as Map)) + .toList()); return value; } @@ -885,10 +884,12 @@ class _ApiService implements ApiService { data: _data); final value = BaseData>.fromJson( _result.data, - (json) => ((json??"") == "")?null:PageInfo.fromJson( - json, - (json) => OrderInfo.fromJson(json), - ), + (json) => ((json ?? "") == "") + ? null + : PageInfo.fromJson( + json, + (json) => OrderInfo.fromJson(json), + ), ); return value; } @@ -1272,7 +1273,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => json==null?null:(json as String), + (json) => json == null ? null : (json as String), ); return value; } @@ -1295,7 +1296,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => (json??"")=="" ? null :(json as bool), + (json) => (json ?? "") == "" ? null : (json as bool), ); return value; } @@ -1881,7 +1882,8 @@ class _ApiService implements ApiService { const _extra = {}; final queryParameters = {}; final _data = {}; - final _result = await _dio.request>('coupon/detail/$memberCouponId', + final _result = await _dio.request>( + 'coupon/detail/$memberCouponId', queryParameters: queryParameters, options: RequestOptions( method: 'GET', @@ -2018,7 +2020,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => HomeRank.fromJson(json), + (json) => HomeRank.fromJson(json), ); return value; } @@ -2039,7 +2041,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => json as dynamic, + (json) => json as dynamic, ); return value; } @@ -2051,7 +2053,8 @@ class _ApiService implements ApiService { final queryParameters = {}; final _data = {}; _data.addAll(param ?? {}); - final _result = await _dio.request>('/member/updatePayPwd', + final _result = await _dio.request>( + '/member/updatePayPwd', queryParameters: queryParameters, options: RequestOptions( method: 'POST', @@ -2061,7 +2064,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => json as dynamic, + (json) => json as dynamic, ); return value; } @@ -2073,7 +2076,8 @@ class _ApiService implements ApiService { final queryParameters = {}; final _data = {}; _data.addAll(param ?? {}); - final _result = await _dio.request>('/member/verifyByUpdatePayPwd', + final _result = await _dio.request>( + '/member/verifyByUpdatePayPwd', queryParameters: queryParameters, options: RequestOptions( method: 'POST', @@ -2083,7 +2087,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => json as dynamic, + (json) => json as dynamic, ); return value; } @@ -2093,8 +2097,7 @@ class _ApiService implements ApiService { const _extra = {}; final queryParameters = {}; final _data = {}; - final _result = await _dio.request>( - '/vipCard/index', + final _result = await _dio.request>('/vipCard/index', queryParameters: queryParameters, options: RequestOptions( method: 'GET', @@ -2104,7 +2107,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => VipCardHome.fromJson(json), + (json) => VipCardHome.fromJson(json), ); return value; } @@ -2114,18 +2117,14 @@ class _ApiService implements ApiService { const _extra = {}; final queryParameters = {}; final _data = {}; - final _result = await _dio.request>( - '/ip/', + final _result = await _dio.request>('/ipJson.jsp', queryParameters: queryParameters, - options: RequestOptions( - method: 'GET', - headers: {}, - extra: _extra, - baseUrl: baseUrl), + options: RequestOptions(method: 'GET', extra: _extra, baseUrl: baseUrl,responseType: ResponseType.bytes), data: _data); - final value = IpData.fromJson( - _result.data, - ); + var ts = gbk.decode(_result.data); + final value = IpData.fromJson(jsonDecode(ts + .substring(ts.indexOf("{\"ip\":\"")) + .replaceAll(");}", ""))); return value; } @@ -2136,7 +2135,8 @@ class _ApiService implements ApiService { final queryParameters = {}; final _data = {}; _data.addAll(param ?? {}); - final _result = await _dio.request>('/vipCard/orderVip', + final _result = await _dio.request>( + '/vipCard/orderVip', queryParameters: queryParameters, options: RequestOptions( method: 'POST', @@ -2146,7 +2146,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => json as dynamic, + (json) => json as dynamic, ); return value; } @@ -2156,8 +2156,7 @@ class _ApiService implements ApiService { const _extra = {}; final queryParameters = {}; final _data = {}; - final _result = await _dio.request>( - '/raise/products', + final _result = await _dio.request>('/raise/products', queryParameters: queryParameters, options: RequestOptions( method: 'GET', @@ -2167,7 +2166,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData>.fromJson( _result.data, - (json) => (json as List) + (json) => (json as List) .map( (i) => FarmersList.fromJson(i as Map)) .toList()); @@ -2181,7 +2180,8 @@ class _ApiService implements ApiService { final queryParameters = {}; final _data = {}; _data.addAll(param ?? {}); - final _result = await _dio.request>('/auth/changePhone', + final _result = await _dio.request>( + '/auth/changePhone', queryParameters: queryParameters, options: RequestOptions( method: 'POST', @@ -2191,7 +2191,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => json as dynamic, + (json) => json as dynamic, ); return value; } @@ -2213,7 +2213,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => json as dynamic, + (json) => json as dynamic, ); return value; } @@ -2235,9 +2235,8 @@ class _ApiService implements ApiService { data: _data); final value = BaseData>.fromJson( _result.data, - (json) => (json as List) - .map( - (i) => Store.fromJson(i as Map)) + (json) => (json as List) + .map((i) => Store.fromJson(i as Map)) .toList()); return value; } diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 357649ce..0dae970d 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -327,7 +327,7 @@ class _StoreOrderPage extends State CrossAxisAlignment.start, children: [ ///门店信息 - StoreInfoView(storeInfo), + StoreInfoView(storeInfo,widget.arguments["distance"],), // Padding(padding:EdgeInsets.only(left: 14.w), // child: Text( // S.of(context).diandan, @@ -657,7 +657,6 @@ class _StoreOrderPage extends State "distance": widget.arguments["distance"], "vipLevelName": memberVo?.memberRankVo?.rankName ??"", "isVips": memberVo?.isVip ?? false, - "distance": widget.arguments["distance"], "subscribeParam": miNiDetail?.subscribeParam, }, ); diff --git a/lib/store/store_view/store_header.dart b/lib/store/store_view/store_header.dart index baebe3d0..79214b12 100644 --- a/lib/store/store_view/store_header.dart +++ b/lib/store/store_view/store_header.dart @@ -43,7 +43,7 @@ class StoreHeader extends SliverPersistentHeaderDelegate { child: Column( children: [ ///门店信息 - StoreInfoView(storeInfo), + StoreInfoView(storeInfo,0), ///门店对应优惠券 if (storeInfo != null && storeInfo.couponVOList != null) diff --git a/lib/store/store_view/store_info.dart b/lib/store/store_view/store_info.dart index 2f274a37..afcbc336 100644 --- a/lib/store/store_view/store_info.dart +++ b/lib/store/store_view/store_info.dart @@ -11,8 +11,9 @@ import 'package:url_launcher/url_launcher.dart'; class StoreInfoView extends StatefulWidget { final StoreInfo storeInfo; + final double distance; - StoreInfoView(this.storeInfo); + StoreInfoView(this.storeInfo,this.distance); @override State createState() { @@ -172,13 +173,14 @@ class _StoreInfoView extends State { arguments: { "lat": widget.storeInfo.latitude, "lng": widget.storeInfo.longitude, - "storeName": widget.storeInfo.storeName, + "storeInfo":widget.storeInfo, + "distance":widget.distance }, ); }, child:Container( color: Colors.transparent, - padding:EdgeInsets.only(right: 8.w) , + padding:EdgeInsets.only(right: 8.w,bottom: 16.h) , child: Image.asset( "assets/image/icon_union_location.webp", width: 20, @@ -196,34 +198,36 @@ class _StoreInfoView extends State { arguments: { "lat": widget.storeInfo.latitude, "lng": widget.storeInfo.longitude, - "storeName": widget.storeInfo.storeName, + "storeInfo":widget.storeInfo, + "distance":widget.distance }, ); }else{ return; } }, - child: Text( - "${S.of(context).dizhi}:${widget.storeInfo != null ? widget.storeInfo.address : ""}", - maxLines: 2, - textAlign: TextAlign.justify, - style: TextStyle( - color: Color(0xFF353535), - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, + child:Padding(padding: EdgeInsets.only(bottom: 16.h,), + child: Text( + "${S.of(context).dizhi}:${widget.storeInfo != null ? widget.storeInfo.address : ""}", + maxLines: 2, + textAlign: TextAlign.justify, + style: TextStyle( + color: Color(0xFF353535), + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + ), ), ), ), ), - if((widget?.storeInfo?.tel ?? "") != "") GestureDetector( - behavior: HitTestBehavior.translucent, + behavior: HitTestBehavior.opaque, onTap: () { showCallMobile(); }, child: Container( - padding:EdgeInsets.only(left: 16.w,right: 8.w) , + padding:EdgeInsets.only(left: 16.w,right: 8.w,bottom: 16.h) , child: Image.asset( "assets/image/icon_union_call.webp", width: 24, @@ -237,7 +241,6 @@ class _StoreInfoView extends State { width: double.infinity, height: 1, color: Color(0xFFF4F5F2), - margin: EdgeInsets.only(top: 16), ) ], ), diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index d63e223c..92bd5339 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -1,15 +1,27 @@ +import 'dart:convert'; import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; +import 'package:flutter_baidu_mapapi_search/flutter_baidu_mapapi_search.dart'; +import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart'; import 'package:flutter_bmflocation/flutter_bmflocation.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/utils/flutter_utils.dart'; +import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/location.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:permission_handler/permission_handler.dart'; + +import '../generated/l10n.dart'; +import '../retrofit/data/store_info.dart'; +import '../view_widget/custom_image.dart'; +import '../view_widget/round_button.dart'; class LocationMap extends StatefulWidget { - final Map arguments; + final Map arguments; LocationMap({this.arguments}); @@ -20,26 +32,67 @@ class LocationMap extends StatefulWidget { } class _LocationMap extends State { + StoreInfo storeInfo; + int navigationState = 0; + double distance; + int navigationType = 0; + bool positionSorta = false; + String myAddress; + String myCity; + String hours; + String minutes; + String polylineId; + @override void initState() { super.initState(); - - startLocation(); + storeInfo = widget.arguments["storeInfo"]; + distance = widget.arguments["distance"]; + getLocation(); } - void startLocation() { - Location.getInstance().startLocation(context, (BaiduLocation result) { - if (result != null && - result.latitude != null && - result.longitude != null) { - print("location: $result"); - myLatLng = BMFCoordinate(result.latitude, result.longitude); - AppUtils.coordConvert(myLatLng).then((value) { - this.myLatLng = value; - locationShow(); - }); + void getLocation() async { + bool powerFlag = false; + try { + Future.delayed(Duration(seconds: 5), () { + Location.getInstance().stopLocation(); + }); + powerFlag = await Location.getInstance().startLocation(context, + (BaiduLocation result) { + if (result != null && + result.latitude != null && + result.longitude != null) { + print("location: $result"); + myLatLng = BMFCoordinate(result.latitude, result.longitude); + myAddress = result.locationDetail; + myCity = result.city; + if(distance == null) + calculate(); + AppUtils.coordConvert(myLatLng).then((value) { + this.myLatLng = value; + locationShow(); + }); + Location.getInstance().stopLocation(); + } + }); + } finally { + if (!powerFlag) { + if (await Permission.locationWhenInUse.status.isGranted) { + getLocation(); + } else { + SmartDialog.showToast("您定位服务未开启,请前往系统设置中开启定位服务", + alignment: Alignment.center); + } } - }); + } + } + + calculate() async { + BMFCoordinate bmfCoordinate = BMFCoordinate( + double.tryParse(storeInfo.latitude), + double.tryParse(storeInfo.longitude), + ); + distance = double.tryParse(await AppUtils.calculateDistance(bmfCoordinate, myLatLng,isMi:true)); } locationShow() { @@ -68,31 +121,931 @@ class _LocationMap extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: MyAppBar( - background: Color(0xFFF7F7F7), - title: widget.arguments["storeName"], - titleColor: Colors.black87, - titleSize: 18.sp, - leadingColor: Colors.black, + // appBar: MyAppBar( + // background: Color(0xFFF7F7F7), + // title: widget.arguments["storeName"], + // titleColor: Colors.black87, + // titleSize: 18.sp, + // leadingColor: Colors.black, + // ), + body: Stack( + children: [ + Column( + children: [ + Expanded( + child: Container( + //BMFMapWidget 组件会自动默认沾满全屏,并且挡住所有遮盖物 ,BMFTextureMapWidget不会强制遮盖其他控件。 + child: BMFTextureMapWidget( + mapOptions: BMFMapOptions( + center: BMFCoordinate( + double.tryParse(widget.arguments["lat"]), + double.tryParse(widget.arguments["lng"]), + ), + showZoomControl: false, + showMapScaleBar: false, + rotateEnabled: false, + zoomLevel: 15, + ), + onBMFMapCreated: onMapCreated, + )), + flex: 3, + ), + navigationState == 0 + ? Container( + height: 253.h, + padding: + EdgeInsets.only(top: 16.h, left: 16.w, right: 28.w), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x08213303), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.vertical( + top: Radius.circular(8), + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Row( + children: [ + Expanded( + child: Column( + children: [ + Text( + storeInfo?.storeName ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 20.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.medium, + ), + ), + Row( + children: [ + Text( + S.of(context).ren( + storeInfo != null + ? storeInfo + .perCapitaConsumption + : "", + ), + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF4D4D4D), + ), + ), + SizedBox( + width: 20.w, + ), + ]..addAll(itemServer(storeInfo != null + ? storeInfo.businessService + : "")), + ), + Text( + S.of(context).yingyeshijian(storeInfo == + null + ? "" + : (storeInfo.openStartTime == + null && + storeInfo.openEndTime == + null) + ? S.of(context).quantian + : "${storeInfo.openStartTime.substring(0, storeInfo.openStartTime.lastIndexOf(":"))} " + "- ${storeInfo.openEndTime.substring(0, storeInfo.openEndTime.lastIndexOf(":"))}"), + style: TextStyle( + color: Color(0xFF4D4D4D), + fontWeight: MyFontWeight.medium, + fontSize: 12.sp, + ), + ), + ], + mainAxisAlignment: + MainAxisAlignment.spaceAround, + crossAxisAlignment: + CrossAxisAlignment.start, + ), + ), + MImage( + storeInfo != null ? storeInfo.logo : "", + width: 72.h, + height: 72.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 32.h), + child: Text( + "${storeInfo != null ? storeInfo.address : ""}", + maxLines: 2, + textAlign: TextAlign.justify, + style: TextStyle( + color: Color(0xFF353535), + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + ), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if (myCity == null) { + getLocation(); + } else { + navigationState = 1; + if ((distance ?? 0) < 500) + navigationType = 1; + else if ((distance ?? 0) < 1500) + navigationType = 2; + else navigationType = 4; + navigationPosition(); + } + }, + child: Container( + alignment: Alignment.center, + width: double.infinity, + padding: EdgeInsets.symmetric(vertical: 10.h), + margin: EdgeInsets.only(bottom: 30.h), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(23), + ), + child: Text( + "到这去", + style: TextStyle( + fontSize: 20.sp, + color: Colors.white, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ) + ], + ), + ) + : navigationDistance(), + ], + ), + navigationState == 0 + ? GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + height: 56.h, + margin: EdgeInsets.only( + top: MediaQuery.of(context).padding.top + 16.h, + left: 14.w, + right: 14.w), + padding: EdgeInsets.only(left: 12.w, right: 21.w), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x08213303), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.circular(6), + ), + child: Row( + children: [ + Icon( + Icons.arrow_back_ios, + color: Color(0xFF353535), + size: 24, + ), + Expanded( + child: Text( + storeInfo?.storeName ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 18.sp, + fontWeight: MyFontWeight.regular, + ), + )) + ], + ), + ), + ) + : navigationBox(), + ], + ), + ); + } + + //調取百度地圖APP + void onOpenBaiduMapRoute() async { + // 我的位置 + BMFCoordinate startCoord = BMFCoordinate( + positionSorta == false + ? myLatLng.latitude + : double.tryParse(widget.arguments["lat"]), + positionSorta == false + ? myLatLng.longitude + : double.tryParse(widget.arguments["lng"])); + String startName = ((positionSorta == false) ? "我的位置" : "终点"); + // 去的位置 + String endName = ((positionSorta == false) ? "终点" : "我的位置"); + BMFCoordinate endCoord = BMFCoordinate( + positionSorta == false + ? double.tryParse(widget.arguments["lat"]) + : myLatLng.latitude, + positionSorta == false + ? double.tryParse(widget.arguments["lng"]) + : myLatLng.longitude); + BMFOpenRouteOption routeOption = BMFOpenRouteOption( + startCoord: startCoord, + startName: startName, + endCoord: endCoord, + endName: endName, + routeType: navigationType == 1 + ? BMFOpenRouteType.WalkingRoute + : navigationType == 2 + ? BMFOpenRouteType.WalkingRoute + : navigationType == 3 + ? BMFOpenRouteType.TransitRoute + : BMFOpenRouteType.DrivingRoute, + appScheme: 'baidumapsdk_flutter://mapsdk.baidu.com', + // 指定返回自定义scheme + isSupportWeb: true); + BMFOpenErrorCode flag = + await BMFOpenMapUtils.openBaiduMapRoute(routeOption); + print('open - route - errorCode = $flag'); + } + + updateMapLine(List coordinates, int needHours, int needMinutes, + double needDistance) { + try { + //刪除之前的創建的點和綫 + _mapController.cleanAllMarkers(); + if (polylineId != null) _mapController.removeOverlay(polylineId); + + BMFCoordinate startLocation = + BMFCoordinate(coordinates.first.latitude, coordinates.first.longitude); + + BMFCoordinate endLocation = + BMFCoordinate(coordinates.last.latitude, coordinates.last.longitude); + + /// 创建polyline + BMFPolyline colorsPolyline = BMFPolyline( + // id: polylineOptions.hashCode.toString(), + coordinates: coordinates, + indexs: [0], + textures: [ + navigationType != 4 + ? 'assets/image/traffic_texture_unknown.png' + : 'assets/image/traffic_texture_smooth.png' + ], + width: 16, + lineDashType: BMFLineDashType.LineDashTypeNone, + lineCapType: BMFLineCapType.LineCapButt, + lineJoinType: BMFLineJoinType.LineJoinRound); + polylineId = colorsPolyline.id; + + /// 添加polyline + _mapController.addPolyline(colorsPolyline); + var startBmfMarker = BMFMarker.icon( + position: startLocation, + centerOffset: BMFPoint(0.5, 0.7), + enabled: false, + icon: "assets/image/icon_start.png", + draggable: false, + ); + _mapController.addMarker(startBmfMarker); + + var terminalBmfMarker = BMFMarker.icon( + position: endLocation, + centerOffset: BMFPoint(0.5, 0.7), + enabled: false, + icon: "assets/image/icon_end.png", + draggable: false, + ); + _mapController.addMarker(terminalBmfMarker); + _mapController.setVisibleMapRectWithPadding( + visibleMapBounds: BMFCoordinateBounds( + northeast: startLocation, southwest: endLocation), + animated: true, + insets: EdgeInsets.only( + top: 500, bottom: 200, left: 200, right: 200)); + + hours = needHours == 0 ? "" : "$needHours小时"; + minutes = needMinutes == 0 ? "" : "$needMinutes分钟"; + distance = needDistance; + }finally{ + setState(() {}); + EasyLoading.dismiss(); + } + } + + navigationPosition() async { + EasyLoading.show( + status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); + BMFPlanNode from = BMFPlanNode( + cityName: positionSorta == false ? myCity : (storeInfo?.city ?? ""), + name: positionSorta == false ? myAddress : storeInfo?.address ?? "", + pt: positionSorta == false + ? BMFCoordinate(myLatLng?.latitude ?? 0, myLatLng?.longitude ?? 0) + : latLng); + BMFPlanNode to = BMFPlanNode( + cityName: positionSorta == false ? (storeInfo?.city ?? "") : myCity, + name: positionSorta == false ? (storeInfo?.address ?? "") : myAddress, + pt: positionSorta == false + ? latLng + : BMFCoordinate(myLatLng?.latitude ?? 0, myLatLng?.longitude ?? 0)); + if (navigationType == 1) { + //步行 + BMFWalkingRoutePlanOption walkingRoutePlanOption = + BMFWalkingRoutePlanOption(from: from, to: to); + // 检索实例 + BMFWalkingRouteSearch walkingRouteSearch = BMFWalkingRouteSearch(); + // 检索回调 + walkingRouteSearch.onGetWalkingRouteSearchResult(callback: + (BMFWalkingRouteResult result, BMFSearchErrorCode errorCode) async { + if (errorCode == BMFSearchErrorCode.RESULT_NOT_FOUND) { + SmartDialog.showToast("该方案暂无可用的规划路线", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } else if (errorCode != BMFSearchErrorCode.NO_ERROR) { + SmartDialog.showToast("获取路线规划失败,请稍后再试", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } + print( + '`步行检索回调 errorCode = ${errorCode} \n result = ${result?.toMap()}'); + + /// 坐标点 + List coordinates = []; + result.routes.first.steps.forEach((e1) { + e1.points.forEach((e2) { + coordinates.add(BMFCoordinate(e2.latitude, e2.longitude)); + }); + }); + updateMapLine( + coordinates, + result.routes.first.duration.hours, + result.routes.first.duration.minutes, + result.routes.first.distance.toDouble()); + }); + bool flag = + await walkingRouteSearch.walkingRouteSearch(walkingRoutePlanOption); + } else if (navigationType == 2) { + //骑行 + BMFRidingRoutePlanOption ridingRoutePlanOption = + BMFRidingRoutePlanOption(from: from, to: to); + BMFRidingRouteSearch ridingRouteSearch = BMFRidingRouteSearch(); + ridingRouteSearch.onGetRidingRouteSearchResult(callback: + (BMFRidingRouteResult result, BMFSearchErrorCode errorCode) { + if (errorCode == BMFSearchErrorCode.RESULT_NOT_FOUND) { + SmartDialog.showToast("该方案暂无可用的规划路线", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } else if (errorCode != BMFSearchErrorCode.NO_ERROR) { + SmartDialog.showToast("获取路线规划失败,请稍后再试", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } + print( + '`骑行检索回调 errorCode = ${errorCode} \n result = ${result?.toMap()}'); + + /// 坐标点 + List coordinates = []; + result.routes.first.steps.forEach((e1) { + e1.points.forEach((e2) { + coordinates.add(BMFCoordinate(e2.latitude, e2.longitude)); + }); + }); + updateMapLine( + coordinates, + result.routes.first.duration.hours, + result.routes.first.duration.minutes, + result.routes.first.distance.toDouble()); + }); +// 发起检索 + bool flag = + await ridingRouteSearch.ridingRouteSearch(ridingRoutePlanOption); + } else if (navigationType == 3) { + //公交 + BMFTransitRoutePlanOption transitRoutePlanOption = + BMFTransitRoutePlanOption(from: from, to: to, city: '武汉市'); + BMFTransitRouteSearch transitRouteSearch = BMFTransitRouteSearch(); + transitRouteSearch.onGetTransitRouteSearchResult(callback: + (BMFTransitRouteResult result, BMFSearchErrorCode errorCode) { + if (errorCode == BMFSearchErrorCode.RESULT_NOT_FOUND) { + SmartDialog.showToast("该方案暂无可用的规划路线", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } else if (errorCode != BMFSearchErrorCode.NO_ERROR) { + SmartDialog.showToast("获取路线规划失败,请稍后再试", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } + print( + '`市内公交检索回调 errorCode = ${errorCode} \n result = ${result?.toMap()}'); + + /// 坐标点 + List coordinates = []; + result.routes.first.steps.forEach((e1) { + e1.points.forEach((e2) { + coordinates.add(BMFCoordinate(e2.latitude, e2.longitude)); + }); + }); + updateMapLine( + coordinates, + result.routes.first.duration.hours, + result.routes.first.duration.minutes, + result.routes.first.distance.toDouble()); + }); +// 发起检索 + bool flag = + await transitRouteSearch.transitRouteSearch(transitRoutePlanOption); + } else { + //驾车 + BMFDrivingRoutePlanOption drivingRoutePlanOption = + BMFDrivingRoutePlanOption(from: from, to: to); + BMFDrivingRouteSearch drivingRouteSearch = BMFDrivingRouteSearch(); + drivingRouteSearch.onGetDrivingRouteSearchResult(callback: + (BMFDrivingRouteResult result, BMFSearchErrorCode errorCode) { + if (errorCode == BMFSearchErrorCode.RESULT_NOT_FOUND) { + SmartDialog.showToast("该方案暂无可用的规划路线", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } else if (errorCode != BMFSearchErrorCode.NO_ERROR) { + SmartDialog.showToast("获取路线规划失败,请稍后再试", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } + print( + '驾车检索回调 errorCode = ${errorCode} \n result = ${result?.toMap()}'); + + /// 坐标点 + List coordinates = []; + result.routes.first.steps.forEach((e1) { + e1.points.forEach((e2) { + coordinates.add(BMFCoordinate(e2.latitude, e2.longitude)); + }); + }); + updateMapLine( + coordinates, + result.routes.first.duration.hours, + result.routes.first.duration.minutes, + result.routes.first.distance.toDouble()); + }); +// 发起检索 + bool flag = + await drivingRouteSearch.dringRouteSearch(drivingRoutePlanOption); + } + } + + Widget navigationBox() { + return Container( + height: 132.h, + margin: EdgeInsets.only( + top: MediaQuery.of(context).padding.top + 16.h, + left: 14.w, + right: 14.w), + padding: EdgeInsets.only(left: 12.w, right: 18.w, top: 8.h), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x08213303), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.circular(6), ), - body: Container( - //BMFMapWidget 组件会自动默认沾满全屏,并且挡住所有遮盖物 ,BMFTextureMapWidget不会强制遮盖其他控件。 - child:BMFMapWidget( - mapOptions: BMFMapOptions( - center: BMFCoordinate( - double.tryParse(widget.arguments["lat"]), - double.tryParse(widget.arguments["lng"]), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + navigationState = 0; + }); + }, + child: Padding( + padding: EdgeInsets.only(top: 10.h, right: 10.w), + child: Icon( + Icons.arrow_back_ios, + color: Color(0xFF353535), + size: 24, + ), ), - showZoomControl: false, - showMapScaleBar: false, - zoomLevel: 12, ), - onBMFMapCreated: onMapCreated, - ) + Expanded( + child: Column( + children: [ + Container( + width: double.infinity, + decoration: BoxDecoration( + color: Color(0xFFF5F5F5), + borderRadius: BorderRadius.circular(6), + ), + padding: EdgeInsets.only( + top: 12.h, + bottom: 12.h, + left: 15.w, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + bottom: 14.h, + ), + child: Row( + children: [ + Container( + width: 4.h, + height: 4.h, + margin: EdgeInsets.only(right: 20.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(6), + ), + ), + Expanded( + child: Text( + positionSorta == false + ? "我的位置" + : (storeInfo?.storeName ?? ""), + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + ), + )) + ], + ), + ), + Row( + children: [ + Container( + width: 4.h, + height: 4.h, + margin: EdgeInsets.only(right: 20.w), + decoration: BoxDecoration( + color: Color(0xFFFA5151), + borderRadius: BorderRadius.circular(6), + ), + ), + Expanded( + child: Text( + positionSorta == false + ? (storeInfo?.storeName ?? "") + : "我的位置", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + ), + )) + ], + ) + ], + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + positionSorta = !positionSorta; + navigationPosition(); + }, + child: Container( + padding: EdgeInsets.only(right: 24.w), + child: Image.asset( + "assets/image/position_sort.webp", + fit: BoxFit.fill, + height: 16.h, + width: 14.w, + ), + ), + ) + ], + ), + ), + SizedBox( + height: 12.h, + ), + Row( + children: [ + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + navigationType = 4; + navigationPosition(); + }, + child: Container( + decoration: BoxDecoration( + color: navigationType == 4 + ? Color(0xFFE8FFF2) + : Colors.transparent, + borderRadius: BorderRadius.circular(23), + ), + padding: + EdgeInsets.symmetric(vertical: 5.h, horizontal: 13.w), + child: Row( + children: [ + if (navigationType == 4) + Image.asset( + "assets/image/icon_drive.webp", + fit: BoxFit.fill, + height: 16.h, + width: 14.w, + ), + Padding( + padding: EdgeInsets.only(left: 2.w), + child: Text( + "驾车", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: navigationType == 4 + ? Color(0xFF32A060) + : Colors.black, + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ) + ], + ), + ), + )), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + navigationType = 3; + navigationPosition(); + }, + child: Container( + decoration: BoxDecoration( + color: navigationType == 3 + ? Color(0xFFE8FFF2) + : Colors.transparent, + borderRadius: BorderRadius.circular(23), + ), + padding: EdgeInsets.symmetric( + vertical: 5.h, horizontal: 13.w), + child: Row( + children: [ + if (navigationType == 3) + Image.asset( + "assets/image/icon_transit.webp", + fit: BoxFit.fill, + height: 16.h, + width: 14.w, + ), + Padding( + padding: EdgeInsets.only(left: 2.w), + child: Text( + "公交", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: navigationType == 3 + ? Color(0xFF32A060) + : Colors.black, + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ) + ], + ), + ))), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + navigationType = 2; + navigationPosition(); + }, + child: Container( + decoration: BoxDecoration( + color: navigationType == 2 + ? Color(0xFFE8FFF2) + : Colors.transparent, + borderRadius: BorderRadius.circular(23), + ), + padding: EdgeInsets.symmetric( + vertical: 5.h, horizontal: 13.w), + child: Row( + children: [ + if (navigationType == 2) + Image.asset( + "assets/image/icon_by_bike.webp", + fit: BoxFit.fill, + height: 16.h, + width: 14.w, + ), + Padding( + padding: EdgeInsets.only(left: 2.w), + child: Text( + "骑行", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: navigationType == 2 + ? Color(0xFF32A060) + : Colors.black, + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ) + ], + ), + ))), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + navigationType = 1; + navigationPosition(); + }, + child: Container( + decoration: BoxDecoration( + color: navigationType == 1 + ? Color(0xFFE8FFF2) + : Colors.transparent, + borderRadius: BorderRadius.circular(23), + ), + padding: EdgeInsets.symmetric( + vertical: 5.h, horizontal: 13.w), + child: Row( + children: [ + if (navigationType == 1) + Image.asset( + "assets/image/icon_walk.webp", + fit: BoxFit.fill, + height: 16.h, + width: 14.w, + ), + Padding( + padding: EdgeInsets.only(left: 2.w), + child: Text( + "步行", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: navigationType == 1 + ? Color(0xFF32A060) + : Colors.black, + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ) + ], + ), + ))), + ], + ) + ], + )) + ], ), ); } + Widget navigationDistance() { + return Container( + height: 173.h, + padding: EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x08213303), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.vertical( + top: Radius.circular(8), + ), + ), + child: Column( + // mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "${navigationType == 1 ? "步行" : navigationType == 2 ? "骑行" : navigationType == 3 ? "公交" : "驾车"}${(hours ?? "") + (minutes ?? "")}", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 20.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.bold, + ), + ), + Padding( + padding: EdgeInsets.only(left: 40.w), + child: Text( + (distance ?? 0) > 1000 + ? S.of(context).gongli( + ((distance ?? 0) / 1000 * 100).toInt() / 100.0) + : S + .of(context) + .mi(((distance ?? 0) * 100).toInt() / 100.0), + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 20.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.bold, + ), + ), + ), + ], + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + navigationState = 1; + onOpenBaiduMapRoute(); + }); + }, + child: Container( + alignment: Alignment.center, + width: double.infinity, + padding: EdgeInsets.symmetric(vertical: 10.h), + margin: EdgeInsets.only(bottom: 30.h), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(23), + ), + child: Text( + navigationType == 1 + ? "步行导航" + : navigationType == 2 + ? "骑行导航" + : navigationType == 3 + ? "公交导航" + : "驾车导航", + style: TextStyle( + fontSize: 20.sp, + color: Colors.white, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ) + ], + ), + ); + } + + List itemServer(String businessService) { + if (businessService == null || businessService == "") return []; + var list = businessService.split(","); + return list + .map((e) => Container( + margin: EdgeInsets.only(right: 8.w), + child: RoundButton( + height: 17.h * AppUtils.textScale(context), + text: "$e", + backgroup: Color(0xFFFF7A1A), + padding: EdgeInsets.only( + left: 2.w, + right: 2.w, + ), + fontSize: 10.sp, + textColor: Colors.white, + ), + )) + .toList(); + } + BMFMapController _mapController; BMFCoordinate latLng; BMFCoordinate myLatLng; @@ -111,7 +1064,7 @@ class _LocationMap extends State { isAccuracyCircleShow: true, locationViewImage: 'assets/image/icon_my_location.webp', locationViewHierarchy: - BMFLocationViewHierarchy.LOCATION_VIEW_HIERARCHY_BOTTOM, + BMFLocationViewHierarchy.LOCATION_VIEW_HIERARCHY_BOTTOM, ); _mapController.updateLocationViewWithParam(displayParam); addMarker(); @@ -125,7 +1078,7 @@ class _LocationMap extends State { double.tryParse(widget.arguments["lng"])); if (bmfMarker == null && _mapController != null) { - bmfMarker = BMFMarker( + bmfMarker = BMFMarker.icon( position: latLng, centerOffset: BMFPoint(0.5, 0.7), enabled: false, @@ -134,11 +1087,6 @@ class _LocationMap extends State { ); _mapController.addMarker(bmfMarker); } - _mapController.updateMapOptions( - BMFMapOptions( - center: latLng, - zoomLevel: 15, - ), - ); + _mapController.setCenterCoordinate(latLng, true); } } diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index bf3a0217..95631d64 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -55,13 +55,8 @@ class UnionPageState extends State super.dispose(); WidgetsBinding.instance.removeObserver(this); if (Location.getInstance() != null && - Location - .getInstance() - .aMapFlutterLocation != null) - Location - .getInstance() - .aMapFlutterLocation - .stopLocation(); + Location.getInstance().aMapFlutterLocation != null) + Location.getInstance().aMapFlutterLocation.stopLocation(); } @override @@ -69,14 +64,8 @@ class UnionPageState extends State super.didChangeMetrics(); WidgetsBinding.instance.addPostFrameCallback((_) { setState(() { - print("object: ${MediaQuery - .of(context) - .viewInsets - .bottom}"); - if (MediaQuery - .of(context) - .viewInsets - .bottom == 0) { + print("object: ${MediaQuery.of(context).viewInsets.bottom}"); + if (MediaQuery.of(context).viewInsets.bottom == 0) { if (isKeyBoardShow) { isKeyBoardShow = false; //关闭键盘 软键盘关闭了, 清除输入控件的焦点, 否则重新进入页面会导致软键盘再弹出问题 @@ -101,39 +90,46 @@ class UnionPageState extends State } }); queryIpInfo(); + // loadFinish(showLoading: false); } startLocation() async { bool powerFlag = false; - try { - powerFlag = await Location.getInstance().startLocation(context, - (BaiduLocation result) async { - if (result != null && - result.latitude != null && - result.longitude != null) { - print("location: $result"); - latLng = BMFCoordinate(result.latitude, result.longitude); - latLng = await BMFCalculateUtils.coordConvert( - coordinate: latLng, - fromType: BMF_COORD_TYPE.BD09LL, - toType: BMF_COORD_TYPE.COMMON); - await saveLatLng( - latLng, result.province, result.city, result.district); - print("union: Location result ${latLng.latitude} " - "${latLng.longitude}"); - Location.getInstance().stopLocation(); - } else { - await getLatLng(); - } - loadFinish(showLoading: false); - }); - } finally { - if (!powerFlag) { - if (await Permission.locationWhenInUse.status.isGranted) { - startLocation(); - } else + // bool finallyFlag = false; + try { + Future.delayed(Duration(seconds: 5), () { + // if (!finallyFlag) + Location.getInstance().stopLocation(); + }); + powerFlag = await Location.getInstance().startLocation(context, + (BaiduLocation result) async { + if (result != null && + result.latitude != null && + result.longitude != null) { + print("location: $result"); + latLng = BMFCoordinate(result.latitude, result.longitude); + latLng = await BMFCalculateUtils.coordConvert( + coordinate: latLng, + fromType: BMF_COORD_TYPE.BD09LL, + toType: BMF_COORD_TYPE.COMMON); + await saveLatLng( + latLng, result.province, result.city, result.district); + print("union: Location result ${latLng.latitude} " + "${latLng.longitude}"); + Location.getInstance().stopLocation(); + } else { + await getLatLng(); + } loadFinish(showLoading: false); - } + }); + } finally { + // finallyFlag = true; + if (!powerFlag) { + if (await Permission.locationWhenInUse.status.isGranted) { + startLocation(); + } else + loadFinish(showLoading: false); + } } } @@ -159,17 +155,24 @@ class UnionPageState extends State } queryIpInfo() async { - EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); - ApiService apiIpService = ApiService(Dio(), context: context, isIp: true); - IpData baseData = await apiIpService.getIpInfo().catchError((onError) {}); - if (baseData?.dz != null) { - areaName = baseData.dz.substring(baseData.dz.lastIndexOf(" ") +1).replaceAll("市", ""); + EasyLoading.show( + status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); + try { + ApiService apiIpService = ApiService(Dio(), context: context, isIp: true); + IpData baseData = await apiIpService.getIpInfo().catchError((onError) {}); + if (baseData?.city != null) { + areaName = baseData.city.replaceAll("市", ""); + } + } finally { + startLocation(); } - startLocation(); } loadFinish({bool showLoading = true}) { - if (showLoading) EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); + if (showLoading) + EasyLoading.show( + status: S.current.zhengzaijiazai, + maskType: EasyLoadingMaskType.black); _allKey = [GlobalKey(), GlobalKey(), GlobalKey(), GlobalKey()]; setState(() {}); } @@ -245,51 +248,40 @@ class UnionPageState extends State indicatorSize: TabBarIndicatorSize.label, //指示器与文字等宽 tabs: [ - MyTab(text: S - .of(context) - .quanbu), - MyTab(text: S - .of(context) - .chi), - MyTab(text: S - .of(context) - .he), - MyTab(text: S - .of(context) - .wan), + MyTab(text: S.of(context).quanbu), + MyTab(text: S.of(context).chi), + MyTab(text: S.of(context).he), + MyTab(text: S.of(context).wan), ], ), ), _allKey.isEmpty ? NoDataView( - src: "assets/image/di_zhi.webp", - isShowBtn: false, - text: "暂无店铺列表~", - fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h), - ) + src: "assets/image/di_zhi.webp", + isShowBtn: false, + text: "暂无店铺列表~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ) : Expanded( - child: TabBarView( - controller: tabController, - children: [ - UnionList(_allKey[0], "", latLng, - editingController.text, areaName), - UnionList(_allKey[1], "EATSTORE", latLng, - editingController.text, areaName), - UnionList(_allKey[2], "DRINKSTORE", latLng, - editingController.text, areaName), - UnionList(_allKey[3], "HAPPYSTORE", latLng, - editingController.text, areaName), - ], - ), - ) + child: TabBarView( + controller: tabController, + children: [ + UnionList(_allKey[0], "", latLng, + editingController.text, areaName), + UnionList(_allKey[1], "EATSTORE", latLng, + editingController.text, areaName), + UnionList(_allKey[2], "DRINKSTORE", latLng, + editingController.text, areaName), + UnionList(_allKey[3], "HAPPYSTORE", latLng, + editingController.text, areaName), + ], + ), + ) ], ), padding: - EdgeInsets.only(top: MediaQuery - .of(context) - .padding - .top + 17.h), + EdgeInsets.only(top: MediaQuery.of(context).padding.top + 17.h), decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, @@ -344,11 +336,14 @@ class UnionPageState extends State color: Color(0xFFB3B3B3), ), isCollapsed: true, - prefixIcon:Padding(padding: EdgeInsets.only(left: 5.w,right: 5.w),child: Image.asset( - "assets/image/icon_search.webp", - width: 16.h, - height: 16.h, - ),), + prefixIcon: Padding( + padding: EdgeInsets.only(left: 5.w, right: 5.w), + child: Image.asset( + "assets/image/icon_search.webp", + width: 16.h, + height: 16.h, + ), + ), prefixIconConstraints: BoxConstraints(), border: InputBorder.none, ), diff --git a/lib/union/union_select_city.dart b/lib/union/union_select_city.dart index e0d6d4bb..5856b5b4 100644 --- a/lib/union/union_select_city.dart +++ b/lib/union/union_select_city.dart @@ -67,8 +67,8 @@ class _UnionSelectCity extends State { isIp: true ); IpData baseData = await apiIpService.getIpInfo().catchError((onError) {}); - if (baseData?.dz != null) { - ipName = baseData.dz.substring(baseData.dz.lastIndexOf(" ")+1).replaceAll("市", ""); + if (baseData?.city != null) { + ipName = baseData.city.replaceAll("市", ""); if(ipName != widget.arguments["cityName"] ){ ipState=2; setState((){}); diff --git a/lib/utils/flutter_utils.dart b/lib/utils/flutter_utils.dart index 2811d185..4e53bdb5 100644 --- a/lib/utils/flutter_utils.dart +++ b/lib/utils/flutter_utils.dart @@ -1,3 +1,4 @@ +import 'dart:convert'; import 'dart:io'; import 'package:dio/dio.dart'; @@ -10,11 +11,11 @@ import 'package:path_provider/path_provider.dart'; class AppUtils { ///计算距离(当前位置到店位置直线距离) static Future calculateDistance( - BMFCoordinate bmfCoordinate, BMFCoordinate myLatLng) async { + BMFCoordinate bmfCoordinate, BMFCoordinate myLatLng, {bool isMi = false}) async { double mi = await BMFCalculateUtils.getLocationDistance(bmfCoordinate, myLatLng); NumberFormat numberFormat = NumberFormat("#.#"); - return "${numberFormat.format(mi / 1000)}"; + return "${numberFormat.format(mi / (isMi ? 1 :1000))}"; } diff --git a/lib/view_widget/new_people_reward.dart b/lib/view_widget/new_people_reward.dart index ad29fd59..691c7708 100644 --- a/lib/view_widget/new_people_reward.dart +++ b/lib/view_widget/new_people_reward.dart @@ -27,7 +27,7 @@ class _NewPeopleReward extends State { width: double.infinity, height: 500.h, padding: EdgeInsets.only(top: 210.h), - margin: EdgeInsets.only(top: 20.h, left: 20, right: 20), + margin: EdgeInsets.only(top: 20.h, left: 20.w, right: 20.w), decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, @@ -58,7 +58,7 @@ class _NewPeopleReward extends State { borderRadius: BorderRadius.circular(22.5), ), width: MediaQuery.of(context).size.width, - height: 40, + height: 40.h, alignment: Alignment.center, child: Text( S.of(context).lijilingqu, @@ -73,7 +73,7 @@ class _NewPeopleReward extends State { ], ), ), - SizedBox(height: 35), + SizedBox(height: 35.h), GestureDetector( onTap: () { setState(() { @@ -82,8 +82,8 @@ class _NewPeopleReward extends State { }, child: Image.asset( "assets/image/yq_qx.webp", - width: 34, - height: 34, + width: 34.h, + height: 34.h, ), ) ], @@ -117,7 +117,7 @@ class _NewPeopleReward extends State { image: AssetImage("assets/image/xin_rq.webp"), ), ), - margin: EdgeInsets.symmetric(horizontal: 60, vertical: 5), + margin: EdgeInsets.symmetric(horizontal: 50.w, vertical: 5.h), padding: EdgeInsets.only(left: 16.w, right: 25.w), child: Row( crossAxisAlignment: CrossAxisAlignment.center, @@ -150,13 +150,13 @@ class _NewPeopleReward extends State { ), ), Expanded(child:Padding( - padding: EdgeInsets.only(top: 4, bottom: 4,left:30), + padding: EdgeInsets.only(top: 4.h, bottom: 4.h,left:30.w), child: Column( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - firstLoginCouponList.storeName, + firstLoginCouponList.couponName, overflow: TextOverflow.ellipsis, maxLines: 2, style: TextStyle( @@ -166,7 +166,7 @@ class _NewPeopleReward extends State { ), ), Text( - firstLoginCouponList.couponName, + firstLoginCouponList.storeName, overflow: TextOverflow.ellipsis, maxLines: 1, style: TextStyle( diff --git a/pubspec.lock b/pubspec.lock index b3e4736d..3fa22321 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,161 +5,161 @@ packages: dependency: "direct main" description: name: ai_decimal_accuracy - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" android_intent_plus: dependency: "direct main" description: name: android_intent_plus - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.2" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.8.2" barcode: dependency: transitive description: name: barcode - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" barcode_widget: dependency: "direct main" description: name: barcode_widget - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.1" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" bubble_tab_indicator: dependency: "direct main" description: name: bubble_tab_indicator - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.6" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.1" chewie: dependency: transitive description: name: chewie - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.3" chewie_audio: dependency: "direct main" description: name: chewie_audio - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.4.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.16.0" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.2" csslib: dependency: transitive description: name: csslib - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.17.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.5" dio: dependency: "direct main" description: name: dio - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.10" emoji_picker_flutter: dependency: "direct main" description: name: emoji_picker_flutter - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.4.1" event_bus: dependency: "direct main" description: name: event_bus - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.0" ffi: dependency: transitive description: name: ffi - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.2" file: dependency: transitive description: name: file - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.1.4" flare_flutter: dependency: "direct main" description: name: flare_flutter - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.2" flutter: @@ -171,63 +171,63 @@ packages: dependency: "direct main" description: name: flutter_baidu_mapapi_base - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.0" flutter_baidu_mapapi_map: dependency: "direct main" description: name: flutter_baidu_mapapi_map - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.1" flutter_baidu_mapapi_search: dependency: "direct main" description: name: flutter_baidu_mapapi_search - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.0" flutter_baidu_mapapi_utils: dependency: "direct main" description: name: flutter_baidu_mapapi_utils - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.0" flutter_bmflocation: dependency: "direct main" description: name: flutter_bmflocation - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.1" flutter_datetime_picker: dependency: "direct main" description: name: flutter_datetime_picker - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.1" flutter_easyloading: dependency: "direct main" description: name: flutter_easyloading - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.0.5" + version: "3.0.0" flutter_html: dependency: "direct main" description: name: flutter_html - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.1" flutter_layout_grid: dependency: transitive description: name: flutter_layout_grid - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.6" flutter_localizations: @@ -239,70 +239,70 @@ packages: dependency: transitive description: name: flutter_math_fork - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.2+2" flutter_page_indicator: dependency: transitive description: name: flutter_page_indicator - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.0.3" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.14" flutter_screenutil: dependency: "direct main" description: name: flutter_screenutil - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "5.0.0+1" flutter_slidable: dependency: "direct main" description: name: flutter_slidable - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.2" + version: "1.3.0" flutter_smart_dialog: dependency: "direct main" description: name: flutter_smart_dialog - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.5.0" + version: "3.0.6" flutter_spinkit: dependency: "direct main" description: name: flutter_spinkit - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "5.2.0" + version: "5.0.0" flutter_staggered_grid_view: dependency: "direct main" description: name: flutter_staggered_grid_view - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "0.4.1" + version: "0.4.0" flutter_svg: dependency: "direct main" description: name: flutter_svg - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.22.0" flutter_swiper: dependency: "direct main" description: name: flutter_swiper - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.6" flutter_test: @@ -319,392 +319,399 @@ packages: dependency: "direct main" description: name: fluwx - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.9.0+2" font_awesome_flutter: dependency: "direct main" description: name: font_awesome_flutter - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" + source: hosted + version: "9.1.0" + gbk2utf8: + dependency: "direct main" + description: + name: gbk2utf8 + url: "https://pub.flutter-io.cn" source: hosted - version: "9.2.0" + version: "1.0.1" gradient_widgets: dependency: "direct main" description: name: gradient_widgets - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.6.0" graphs: dependency: transitive description: name: graphs - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.0" html: dependency: transitive description: name: html - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.15.3" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.4" image_pickers: dependency: "direct main" description: name: image_pickers - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.4+1" + version: "2.0.0" intl: dependency: "direct main" description: name: intl - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.17.0" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.6.4" json_annotation: dependency: "direct main" description: name: json_annotation - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.1" keframe: dependency: "direct main" description: name: keframe - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0" like_button: dependency: "direct main" description: name: like_button - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.5" + version: "2.0.2" logger: dependency: "direct main" description: name: logger - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.4.0" + version: "1.0.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.12.11" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.4" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.7.0" mqtt_client: dependency: "direct main" description: name: mqtt_client - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "9.6.8" nested: dependency: transitive description: name: nested - url: "https://pub.dartlang.org" + 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.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.0.1" number_precision: dependency: "direct main" description: name: number_precision - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.2+1" numerus: dependency: transitive description: name: numerus - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.1" package_info: dependency: "direct main" description: name: package_info - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.2" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.8.1" path_drawing: dependency: transitive description: name: path_drawing - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.5.1+1" path_parsing: dependency: transitive description: name: path_parsing - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.1" path_provider: dependency: "direct main" description: name: path_provider - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" path_provider_linux: dependency: transitive description: name: path_provider_linux - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.10" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" path_provider_windows: dependency: transitive description: name: path_provider_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.6" permission_handler: dependency: "direct main" description: name: permission_handler - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "5.1.0+2" + version: "5.0.1+1" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.2" petitparser: dependency: transitive description: name: petitparser - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "5.0.0" photo_view: dependency: "direct main" description: name: photo_view - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.13.0" pin_input_text_field: dependency: "direct main" description: name: pin_input_text_field - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "4.4.1" + version: "4.1.2" platform: dependency: transitive description: name: platform - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.3" process: dependency: transitive description: name: process - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.2.4" provider: dependency: transitive description: name: provider - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.0.5" pull_to_refresh: dependency: "direct main" description: name: pull_to_refresh - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" qr: dependency: transitive description: name: qr - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" qr_flutter: dependency: "direct main" description: name: qr_flutter - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.0.0" quiver: dependency: transitive description: name: quiver - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.1" retrofit: dependency: "direct main" description: name: retrofit - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.4+1" rive: dependency: "direct main" description: name: rive - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.6.8" rxdart: dependency: "direct main" description: name: rxdart - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.26.0" scan: dependency: "direct main" description: name: scan - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.6.0" + version: "1.5.0" shared_preferences: dependency: "direct main" description: name: shared_preferences - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.20" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.17" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.5" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.5" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.6" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.5" sharesdk_plugin: dependency: "direct main" description: name: sharesdk_plugin - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.10" + version: "1.3.4" shimmer: dependency: "direct main" description: name: shimmer - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0" simple_gesture_detector: dependency: transitive description: name: simple_gesture_detector - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.6" sky_engine: @@ -716,65 +723,65 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.8.2" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" table_calendar: dependency: "direct main" description: name: table_calendar - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.3" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.9" thumbnails: dependency: "direct main" description: name: thumbnails - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" tobias: dependency: "direct main" description: name: tobias - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.2" + version: "2.4.1" tpns_flutter_plugin: dependency: "direct main" description: @@ -788,175 +795,140 @@ packages: dependency: transitive description: name: transformer_page_view - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.6" tuple: dependency: transitive description: name: tuple - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.2" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.2" umeng_common_sdk: dependency: "direct main" description: name: umeng_common_sdk - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.6" + version: "1.2.3" url_launcher: dependency: "direct main" description: name: url_launcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "5.7.10" - url_launcher_linux: - dependency: transitive - description: - name: url_launcher_linux - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.1+4" - url_launcher_macos: - dependency: transitive - description: - name: url_launcher_macos - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.1+9" - url_launcher_platform_interface: - dependency: transitive - description: - name: url_launcher_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.9" - url_launcher_web: - dependency: transitive - description: - name: url_launcher_web - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.5+3" - url_launcher_windows: - dependency: transitive - description: - name: url_launcher_windows - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.1+3" + version: "5.0.0" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" video_player: dependency: "direct main" description: name: video_player - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.19" video_player_android: dependency: transitive description: name: video_player_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.4" video_player_avfoundation: dependency: transitive description: name: video_player_avfoundation - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.9" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "4.2.0" video_player_web: dependency: transitive description: name: video_player_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.15" wakelock: dependency: transitive description: name: wakelock - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.6.2" wakelock_macos: dependency: transitive description: name: wakelock_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.0" wakelock_platform_interface: dependency: transitive description: name: wakelock_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.0" wakelock_web: dependency: transitive description: name: wakelock_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.0" wakelock_windows: dependency: transitive description: name: wakelock_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.1" webview_flutter: dependency: transitive description: name: webview_flutter - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.14" win32: dependency: transitive description: name: win32 - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.4" xdg_directories: dependency: transitive description: name: xdg_directories - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" xml: dependency: transitive description: name: xml - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "5.4.1" sdks: diff --git a/pubspec.yaml b/pubspec.yaml index 6f52ab0b..c3ac0772 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: 3.2.16+60 +version: 3.2.20+63 environment: sdk: ">=2.7.0 <3.0.0" @@ -13,9 +13,9 @@ dependencies: sdk: flutter flutter_localizations: sdk: flutter - fluwx: ^3.9.0+2 + fluwx: 3.9.0+2 - tobias: ^2.4.1 + tobias: 2.4.1 gradient_widgets: ^0.6.0 @@ -38,11 +38,11 @@ dependencies: permission_handler: ^5.0.1+1 - flutter_bmflocation: ^3.2.1 - flutter_baidu_mapapi_base: ^3.2.0 - flutter_baidu_mapapi_map: ^3.2.1 - flutter_baidu_mapapi_search: ^3.2.0 - flutter_baidu_mapapi_utils: ^3.2.0 + flutter_bmflocation: 3.2.1 + flutter_baidu_mapapi_base: 3.2.0 + flutter_baidu_mapapi_map: 3.2.1 + flutter_baidu_mapapi_search: 3.2.0 + flutter_baidu_mapapi_utils: 3.2.0 dio: ^3.0.10 rxdart: ^0.26.0 @@ -52,9 +52,11 @@ dependencies: pin_input_text_field: ^4.1.2 android_intent_plus: ^1.0.2 - flutter_screenutil: ^5.0.0+1 + flutter_screenutil: 5.0.0+1 bubble_tab_indicator: ^0.1.6 + gbk2utf8: ^1.0.1 + event_bus: ^2.0.0 intl: ^0.17.0 shared_preferences: ^2.0.6 From b6c99666cca668f8683624eb91badfa4c0fce6ef Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Sat, 2 Sep 2023 15:28:50 +0800 Subject: [PATCH 20/35] =?UTF-8?q?=E9=80=82=E9=85=8D=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 1 - lib/union/location_map_page.dart | 1041 +++++++++++++++------------- lib/union/union_page.dart | 249 ++++--- lib/utils/location.dart | 217 ++++-- lib/view_widget/location_tips.dart | 120 ++++ 5 files changed, 965 insertions(+), 663 deletions(-) create mode 100644 lib/view_widget/location_tips.dart diff --git a/lib/main.dart b/lib/main.dart index 44461e0b..0b9440db 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -73,7 +73,6 @@ import 'package:huixiang/settlement/settlement.dart'; import 'package:huixiang/store/store_view/product_meals_sku.dart'; import 'package:huixiang/test_page.dart'; import 'package:huixiang/union/location_map_page.dart'; -import 'package:huixiang/union/location_map_pages.dart'; import 'package:huixiang/union/union_select_city.dart'; import 'package:huixiang/utils/ImgCachePath.dart'; import 'package:huixiang/vip/user_vip_service_page.dart'; diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index 92bd5339..1ae4158a 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -14,10 +14,12 @@ import 'package:huixiang/utils/location.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:permission_handler/permission_handler.dart'; +import 'package:url_launcher/url_launcher.dart'; import '../generated/l10n.dart'; import '../retrofit/data/store_info.dart'; import '../view_widget/custom_image.dart'; +import '../view_widget/location_tips.dart'; import '../view_widget/round_button.dart'; class LocationMap extends StatefulWidget { @@ -31,7 +33,7 @@ class LocationMap extends StatefulWidget { } } -class _LocationMap extends State { +class _LocationMap extends State with WidgetsBindingObserver { StoreInfo storeInfo; int navigationState = 0; double distance; @@ -42,10 +44,12 @@ class _LocationMap extends State { String hours; String minutes; String polylineId; + bool _isShowLocalTips = false; @override void initState() { super.initState(); + WidgetsBinding.instance.addObserver(this); storeInfo = widget.arguments["storeInfo"]; distance = widget.arguments["distance"]; getLocation(); @@ -58,31 +62,33 @@ class _LocationMap extends State { Location.getInstance().stopLocation(); }); powerFlag = await Location.getInstance().startLocation(context, - (BaiduLocation result) { - if (result != null && - result.latitude != null && - result.longitude != null) { - print("location: $result"); - myLatLng = BMFCoordinate(result.latitude, result.longitude); - myAddress = result.locationDetail; - myCity = result.city; - if(distance == null) - calculate(); - AppUtils.coordConvert(myLatLng).then((value) { - this.myLatLng = value; - locationShow(); - }); - Location.getInstance().stopLocation(); - } + (BaiduLocation result) { + if (result != null && + result.latitude != null && + result.longitude != null) { + print("location: $result"); + myLatLng = BMFCoordinate(result.latitude, result.longitude); + myAddress = result.locationDetail; + myCity = result.city; + if (distance == null) calculate(); + AppUtils.coordConvert(myLatLng).then((value) { + this.myLatLng = value; + locationShow(); }); + Location.getInstance().stopLocation(); + } + }); } finally { if (!powerFlag) { if (await Permission.locationWhenInUse.status.isGranted) { getLocation(); } else { - SmartDialog.showToast("您定位服务未开启,请前往系统设置中开启定位服务", - alignment: Alignment.center); + _isShowLocalTips = true; } + // else { + // SmartDialog.showToast("您定位服务未开启,请前往系统设置中开启定位服务", + // alignment: Alignment.center); + // } } } } @@ -92,7 +98,8 @@ class _LocationMap extends State { double.tryParse(storeInfo.latitude), double.tryParse(storeInfo.longitude), ); - distance = double.tryParse(await AppUtils.calculateDistance(bmfCoordinate, myLatLng,isMi:true)); + distance = double.tryParse( + await AppUtils.calculateDistance(bmfCoordinate, myLatLng, isMi: true)); } locationShow() { @@ -114,8 +121,26 @@ class _LocationMap extends State { @override void dispose() { - super.dispose(); + WidgetsBinding.instance.removeObserver(this); Location.getInstance().stopLocation(); + super.dispose(); + } + + @override + void didChangeAppLifecycleState(AppLifecycleState state) { + if (state == AppLifecycleState.resumed) { + // 处理应用程序切换回前台的逻辑 + permissionSettings(); + } else if (state == AppLifecycleState.paused) { + // 处理应用程序切换到后台的逻辑 + } + } + + void permissionSettings() async { + if (await Permission.location.isGranted) { + _isShowLocalTips = false; + getLocation(); + } } @override @@ -130,12 +155,14 @@ class _LocationMap extends State { // ), body: Stack( children: [ - Column( + Stack( children: [ - Expanded( - child: Container( - //BMFMapWidget 组件会自动默认沾满全屏,并且挡住所有遮盖物 ,BMFTextureMapWidget不会强制遮盖其他控件。 - child: BMFTextureMapWidget( + Column( + children: [ + Expanded( + child: Container( + //BMFMapWidget 组件会自动默认沾满全屏,并且挡住所有遮盖物 ,BMFTextureMapWidget不会强制遮盖其他控件。 + child: BMFTextureMapWidget( mapOptions: BMFMapOptions( center: BMFCoordinate( double.tryParse(widget.arguments["lat"]), @@ -148,208 +175,228 @@ class _LocationMap extends State { ), onBMFMapCreated: onMapCreated, )), - flex: 3, - ), - navigationState == 0 - ? Container( - height: 253.h, - padding: - EdgeInsets.only(top: 16.h, left: 16.w, right: 28.w), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Color(0x08213303), - offset: Offset(0, 2), - blurRadius: 4, - spreadRadius: 0, - ), - ], - borderRadius: BorderRadius.vertical( - top: Radius.circular(8), + flex: 3, ), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Row( - children: [ - Expanded( - child: Column( - children: [ - Text( - storeInfo?.storeName ?? "", - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 20.sp, - color: Color(0xFF0D0D0D), - fontWeight: MyFontWeight.medium, - ), - ), - Row( + navigationState == 0 + ? Container( + height: 253.h, + padding: EdgeInsets.only( + top: 16.h, left: 16.w, right: 28.w), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x08213303), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.vertical( + top: Radius.circular(8), + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Row( children: [ - Text( - S.of(context).ren( - storeInfo != null - ? storeInfo - .perCapitaConsumption - : "", - ), - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF4D4D4D), + Expanded( + child: Column( + children: [ + Text( + storeInfo?.storeName ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 20.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.medium, + ), + ), + Row( + children: [ + Text( + S.of(context).ren( + storeInfo != null + ? storeInfo + .perCapitaConsumption + : "", + ), + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + fontWeight: + MyFontWeight.regular, + color: Color(0xFF4D4D4D), + ), + ), + SizedBox( + width: 20.w, + ), + ]..addAll(itemServer( + storeInfo != null + ? storeInfo.businessService + : "")), + ), + Text( + S.of(context).yingyeshijian(storeInfo == + null + ? "" + : (storeInfo.openStartTime == + null && + storeInfo.openEndTime == + null) + ? S.of(context).quantian + : "${storeInfo.openStartTime.substring(0, storeInfo.openStartTime.lastIndexOf(":"))} " + "- ${storeInfo.openEndTime.substring(0, storeInfo.openEndTime.lastIndexOf(":"))}"), + style: TextStyle( + color: Color(0xFF4D4D4D), + fontWeight: MyFontWeight.medium, + fontSize: 12.sp, + ), + ), + ], + mainAxisAlignment: + MainAxisAlignment.spaceAround, + crossAxisAlignment: + CrossAxisAlignment.start, ), ), - SizedBox( - width: 20.w, + MImage( + storeInfo != null ? storeInfo.logo : "", + width: 72.h, + height: 72.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", ), - ]..addAll(itemServer(storeInfo != null - ? storeInfo.businessService - : "")), + ], ), - Text( - S.of(context).yingyeshijian(storeInfo == - null - ? "" - : (storeInfo.openStartTime == - null && - storeInfo.openEndTime == - null) - ? S.of(context).quantian - : "${storeInfo.openStartTime.substring(0, storeInfo.openStartTime.lastIndexOf(":"))} " - "- ${storeInfo.openEndTime.substring(0, storeInfo.openEndTime.lastIndexOf(":"))}"), + ), + Padding( + padding: EdgeInsets.only(bottom: 32.h), + child: Text( + "${storeInfo != null ? storeInfo.address : ""}", + maxLines: 2, + textAlign: TextAlign.justify, style: TextStyle( - color: Color(0xFF4D4D4D), - fontWeight: MyFontWeight.medium, + color: Color(0xFF353535), + fontWeight: MyFontWeight.regular, fontSize: 12.sp, ), ), - ], - mainAxisAlignment: - MainAxisAlignment.spaceAround, - crossAxisAlignment: - CrossAxisAlignment.start, - ), - ), - MImage( - storeInfo != null ? storeInfo.logo : "", - width: 72.h, - height: 72.h, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.webp", - fadeSrc: "assets/image/default_1.webp", + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if (myCity == null) { + // onOpenBaiduMap(); + SmartDialog.showToast("您定位服务未开启,请前往系统设置中开启定位服务", + alignment: Alignment.center); + } else { + navigationState = 1; + if ((distance ?? 0) < 500) + navigationType = 1; + else if ((distance ?? 0) < 1500) + navigationType = 2; + else + navigationType = 4; + navigationPosition(); + } + }, + child: Container( + alignment: Alignment.center, + width: double.infinity, + padding: EdgeInsets.symmetric(vertical: 10.h), + margin: EdgeInsets.only(bottom: 30.h), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(23), + ), + child: Text( + "到这去", + style: TextStyle( + fontSize: 20.sp, + color: Colors.white, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ) + ], ), - ], - ), - ), - Padding( - padding: EdgeInsets.only(bottom: 32.h), - child: Text( - "${storeInfo != null ? storeInfo.address : ""}", - maxLines: 2, - textAlign: TextAlign.justify, - style: TextStyle( - color: Color(0xFF353535), - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - ), - ), - ), - GestureDetector( + ) + : navigationDistance(), + ], + ), + navigationState == 0 + ? GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - if (myCity == null) { - getLocation(); - } else { - navigationState = 1; - if ((distance ?? 0) < 500) - navigationType = 1; - else if ((distance ?? 0) < 1500) - navigationType = 2; - else navigationType = 4; - navigationPosition(); - } + Navigator.of(context).pop(); }, child: Container( - alignment: Alignment.center, - width: double.infinity, - padding: EdgeInsets.symmetric(vertical: 10.h), - margin: EdgeInsets.only(bottom: 30.h), + height: 56.h, + margin: EdgeInsets.only( + top: MediaQuery.of(context).padding.top + 16.h, + left: 14.w, + right: 14.w), + padding: EdgeInsets.only(left: 12.w, right: 21.w), decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(23), + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x08213303), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.circular(6), ), - child: Text( - "到这去", - style: TextStyle( - fontSize: 20.sp, - color: Colors.white, - fontWeight: MyFontWeight.medium, - ), + child: Row( + children: [ + Icon( + Icons.arrow_back_ios, + color: Color(0xFF353535), + size: 24, + ), + Expanded( + child: Text( + storeInfo?.storeName ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 18.sp, + fontWeight: MyFontWeight.regular, + ), + )) + ], ), ), ) - ], - ), - ) - : navigationDistance(), + : navigationBox(), ], ), - navigationState == 0 - ? GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Navigator.of(context).pop(); - }, - child: Container( - height: 56.h, - margin: EdgeInsets.only( - top: MediaQuery.of(context).padding.top + 16.h, - left: 14.w, - right: 14.w), - padding: EdgeInsets.only(left: 12.w, right: 21.w), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Color(0x08213303), - offset: Offset(0, 2), - blurRadius: 4, - spreadRadius: 0, - ), - ], - borderRadius: BorderRadius.circular(6), - ), - child: Row( - children: [ - Icon( - Icons.arrow_back_ios, - color: Color(0xFF353535), - size: 24, - ), - Expanded( - child: Text( - storeInfo?.storeName ?? "", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFF0D0D0D), - fontSize: 18.sp, - fontWeight: MyFontWeight.regular, - ), - )) - ], - ), - ), - ) - : navigationBox(), + if (_isShowLocalTips) + Padding( + padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), + child: LocationTips(() { + setState(() { + _isShowLocalTips = false; + }); + }), + ) ], ), ); } + void onOpenBaiduMap() async { + launch("baidumap://map/marker?location=${storeInfo.latitude},${storeInfo.longitude}&title=${storeInfo.storeName}&content=${storeInfo.storeName}&traffic=on&src=andr.baidu.openAPIdemo&coord_type=gcj02"); + } + //調取百度地圖APP void onOpenBaiduMapRoute() async { // 我的位置 @@ -378,15 +425,15 @@ class _LocationMap extends State { routeType: navigationType == 1 ? BMFOpenRouteType.WalkingRoute : navigationType == 2 - ? BMFOpenRouteType.WalkingRoute - : navigationType == 3 - ? BMFOpenRouteType.TransitRoute - : BMFOpenRouteType.DrivingRoute, + ? BMFOpenRouteType.WalkingRoute + : navigationType == 3 + ? BMFOpenRouteType.TransitRoute + : BMFOpenRouteType.DrivingRoute, appScheme: 'baidumapsdk_flutter://mapsdk.baidu.com', // 指定返回自定义scheme isSupportWeb: true); BMFOpenErrorCode flag = - await BMFOpenMapUtils.openBaiduMapRoute(routeOption); + await BMFOpenMapUtils.openBaiduMapRoute(routeOption); print('open - route - errorCode = $flag'); } @@ -397,15 +444,15 @@ class _LocationMap extends State { _mapController.cleanAllMarkers(); if (polylineId != null) _mapController.removeOverlay(polylineId); - BMFCoordinate startLocation = - BMFCoordinate(coordinates.first.latitude, coordinates.first.longitude); + BMFCoordinate startLocation = BMFCoordinate( + coordinates.first.latitude, coordinates.first.longitude); BMFCoordinate endLocation = - BMFCoordinate(coordinates.last.latitude, coordinates.last.longitude); + BMFCoordinate(coordinates.last.latitude, coordinates.last.longitude); /// 创建polyline BMFPolyline colorsPolyline = BMFPolyline( - // id: polylineOptions.hashCode.toString(), + // id: polylineOptions.hashCode.toString(), coordinates: coordinates, indexs: [0], textures: [ @@ -442,13 +489,13 @@ class _LocationMap extends State { visibleMapBounds: BMFCoordinateBounds( northeast: startLocation, southwest: endLocation), animated: true, - insets: EdgeInsets.only( - top: 500, bottom: 200, left: 200, right: 200)); + insets: + EdgeInsets.only(top: 500, bottom: 200, left: 200, right: 200)); hours = needHours == 0 ? "" : "$needHours小时"; minutes = needMinutes == 0 ? "" : "$needMinutes分钟"; distance = needDistance; - }finally{ + } finally { setState(() {}); EasyLoading.dismiss(); } @@ -472,7 +519,7 @@ class _LocationMap extends State { if (navigationType == 1) { //步行 BMFWalkingRoutePlanOption walkingRoutePlanOption = - BMFWalkingRoutePlanOption(from: from, to: to); + BMFWalkingRoutePlanOption(from: from, to: to); // 检索实例 BMFWalkingRouteSearch walkingRouteSearch = BMFWalkingRouteSearch(); // 检索回调 @@ -504,11 +551,11 @@ class _LocationMap extends State { result.routes.first.distance.toDouble()); }); bool flag = - await walkingRouteSearch.walkingRouteSearch(walkingRoutePlanOption); + await walkingRouteSearch.walkingRouteSearch(walkingRoutePlanOption); } else if (navigationType == 2) { //骑行 BMFRidingRoutePlanOption ridingRoutePlanOption = - BMFRidingRoutePlanOption(from: from, to: to); + BMFRidingRoutePlanOption(from: from, to: to); BMFRidingRouteSearch ridingRouteSearch = BMFRidingRouteSearch(); ridingRouteSearch.onGetRidingRouteSearchResult(callback: (BMFRidingRouteResult result, BMFSearchErrorCode errorCode) { @@ -539,11 +586,11 @@ class _LocationMap extends State { }); // 发起检索 bool flag = - await ridingRouteSearch.ridingRouteSearch(ridingRoutePlanOption); + await ridingRouteSearch.ridingRouteSearch(ridingRoutePlanOption); } else if (navigationType == 3) { //公交 BMFTransitRoutePlanOption transitRoutePlanOption = - BMFTransitRoutePlanOption(from: from, to: to, city: '武汉市'); + BMFTransitRoutePlanOption(from: from, to: to, city: '武汉市'); BMFTransitRouteSearch transitRouteSearch = BMFTransitRouteSearch(); transitRouteSearch.onGetTransitRouteSearchResult(callback: (BMFTransitRouteResult result, BMFSearchErrorCode errorCode) { @@ -574,11 +621,11 @@ class _LocationMap extends State { }); // 发起检索 bool flag = - await transitRouteSearch.transitRouteSearch(transitRoutePlanOption); + await transitRouteSearch.transitRouteSearch(transitRoutePlanOption); } else { //驾车 BMFDrivingRoutePlanOption drivingRoutePlanOption = - BMFDrivingRoutePlanOption(from: from, to: to); + BMFDrivingRoutePlanOption(from: from, to: to); BMFDrivingRouteSearch drivingRouteSearch = BMFDrivingRouteSearch(); drivingRouteSearch.onGetDrivingRouteSearchResult(callback: (BMFDrivingRouteResult result, BMFSearchErrorCode errorCode) { @@ -609,7 +656,7 @@ class _LocationMap extends State { }); // 发起检索 bool flag = - await drivingRouteSearch.dringRouteSearch(drivingRoutePlanOption); + await drivingRouteSearch.dringRouteSearch(drivingRoutePlanOption); } } @@ -654,279 +701,279 @@ class _LocationMap extends State { ), Expanded( child: Column( + children: [ + Container( + width: double.infinity, + decoration: BoxDecoration( + color: Color(0xFFF5F5F5), + borderRadius: BorderRadius.circular(6), + ), + padding: EdgeInsets.only( + top: 12.h, + bottom: 12.h, + left: 15.w, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + bottom: 14.h, + ), + child: Row( + children: [ + Container( + width: 4.h, + height: 4.h, + margin: EdgeInsets.only(right: 20.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(6), + ), + ), + Expanded( + child: Text( + positionSorta == false + ? "我的位置" + : (storeInfo?.storeName ?? ""), + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + ), + )) + ], + ), + ), + Row( + children: [ + Container( + width: 4.h, + height: 4.h, + margin: EdgeInsets.only(right: 20.w), + decoration: BoxDecoration( + color: Color(0xFFFA5151), + borderRadius: BorderRadius.circular(6), + ), + ), + Expanded( + child: Text( + positionSorta == false + ? (storeInfo?.storeName ?? "") + : "我的位置", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + ), + )) + ], + ) + ], + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + positionSorta = !positionSorta; + navigationPosition(); + }, + child: Container( + padding: EdgeInsets.only(right: 24.w), + child: Image.asset( + "assets/image/position_sort.webp", + fit: BoxFit.fill, + height: 16.h, + width: 14.w, + ), + ), + ) + ], + ), + ), + SizedBox( + height: 12.h, + ), + Row( children: [ - Container( - width: double.infinity, - decoration: BoxDecoration( - color: Color(0xFFF5F5F5), - borderRadius: BorderRadius.circular(6), - ), - padding: EdgeInsets.only( - top: 12.h, - bottom: 12.h, - left: 15.w, + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + navigationType = 4; + navigationPosition(); + }, + child: Container( + decoration: BoxDecoration( + color: navigationType == 4 + ? Color(0xFFE8FFF2) + : Colors.transparent, + borderRadius: BorderRadius.circular(23), + ), + padding: + EdgeInsets.symmetric(vertical: 5.h, horizontal: 13.w), + child: Row( + children: [ + if (navigationType == 4) + Image.asset( + "assets/image/icon_drive.webp", + fit: BoxFit.fill, + height: 16.h, + width: 14.w, + ), + Padding( + padding: EdgeInsets.only(left: 2.w), + child: Text( + "驾车", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: navigationType == 4 + ? Color(0xFF32A060) + : Colors.black, + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ) + ], + ), ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + )), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + navigationType = 3; + navigationPosition(); + }, + child: Container( + decoration: BoxDecoration( + color: navigationType == 3 + ? Color(0xFFE8FFF2) + : Colors.transparent, + borderRadius: BorderRadius.circular(23), + ), + padding: EdgeInsets.symmetric( + vertical: 5.h, horizontal: 13.w), + child: Row( children: [ + if (navigationType == 3) + Image.asset( + "assets/image/icon_transit.webp", + fit: BoxFit.fill, + height: 16.h, + width: 14.w, + ), Padding( - padding: EdgeInsets.only( - bottom: 14.h, + padding: EdgeInsets.only(left: 2.w), + child: Text( + "公交", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: navigationType == 3 + ? Color(0xFF32A060) + : Colors.black, + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + ), ), - child: Row( - children: [ - Container( - width: 4.h, - height: 4.h, - margin: EdgeInsets.only(right: 20.w), - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(6), - ), - ), - Expanded( - child: Text( - positionSorta == false - ? "我的位置" - : (storeInfo?.storeName ?? ""), - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFF0D0D0D), - fontSize: 14.sp, - fontWeight: MyFontWeight.semi_bold, - ), - )) - ], + ) + ], + ), + ))), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + navigationType = 2; + navigationPosition(); + }, + child: Container( + decoration: BoxDecoration( + color: navigationType == 2 + ? Color(0xFFE8FFF2) + : Colors.transparent, + borderRadius: BorderRadius.circular(23), + ), + padding: EdgeInsets.symmetric( + vertical: 5.h, horizontal: 13.w), + child: Row( + children: [ + if (navigationType == 2) + Image.asset( + "assets/image/icon_by_bike.webp", + fit: BoxFit.fill, + height: 16.h, + width: 14.w, ), - ), - Row( - children: [ - Container( - width: 4.h, - height: 4.h, - margin: EdgeInsets.only(right: 20.w), - decoration: BoxDecoration( - color: Color(0xFFFA5151), - borderRadius: BorderRadius.circular(6), - ), + Padding( + padding: EdgeInsets.only(left: 2.w), + child: Text( + "骑行", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: navigationType == 2 + ? Color(0xFF32A060) + : Colors.black, + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, ), - Expanded( - child: Text( - positionSorta == false - ? (storeInfo?.storeName ?? "") - : "我的位置", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFF0D0D0D), - fontSize: 14.sp, - fontWeight: MyFontWeight.semi_bold, - ), - )) - ], + ), ) ], - )), - GestureDetector( + ), + ))), + Expanded( + child: GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - positionSorta = !positionSorta; + navigationType = 1; navigationPosition(); }, child: Container( - padding: EdgeInsets.only(right: 24.w), - child: Image.asset( - "assets/image/position_sort.webp", - fit: BoxFit.fill, - height: 16.h, - width: 14.w, + decoration: BoxDecoration( + color: navigationType == 1 + ? Color(0xFFE8FFF2) + : Colors.transparent, + borderRadius: BorderRadius.circular(23), ), - ), - ) - ], - ), - ), - SizedBox( - height: 12.h, - ), - Row( - children: [ - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - navigationType = 4; - navigationPosition(); - }, - child: Container( - decoration: BoxDecoration( - color: navigationType == 4 - ? Color(0xFFE8FFF2) - : Colors.transparent, - borderRadius: BorderRadius.circular(23), - ), - padding: - EdgeInsets.symmetric(vertical: 5.h, horizontal: 13.w), - child: Row( - children: [ - if (navigationType == 4) - Image.asset( - "assets/image/icon_drive.webp", - fit: BoxFit.fill, - height: 16.h, - width: 14.w, - ), - Padding( - padding: EdgeInsets.only(left: 2.w), - child: Text( - "驾车", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: navigationType == 4 - ? Color(0xFF32A060) - : Colors.black, - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - ), + padding: EdgeInsets.symmetric( + vertical: 5.h, horizontal: 13.w), + child: Row( + children: [ + if (navigationType == 1) + Image.asset( + "assets/image/icon_walk.webp", + fit: BoxFit.fill, + height: 16.h, + width: 14.w, + ), + Padding( + padding: EdgeInsets.only(left: 2.w), + child: Text( + "步行", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: navigationType == 1 + ? Color(0xFF32A060) + : Colors.black, + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, ), - ) - ], - ), + ), + ) + ], ), - )), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - navigationType = 3; - navigationPosition(); - }, - child: Container( - decoration: BoxDecoration( - color: navigationType == 3 - ? Color(0xFFE8FFF2) - : Colors.transparent, - borderRadius: BorderRadius.circular(23), - ), - padding: EdgeInsets.symmetric( - vertical: 5.h, horizontal: 13.w), - child: Row( - children: [ - if (navigationType == 3) - Image.asset( - "assets/image/icon_transit.webp", - fit: BoxFit.fill, - height: 16.h, - width: 14.w, - ), - Padding( - padding: EdgeInsets.only(left: 2.w), - child: Text( - "公交", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: navigationType == 3 - ? Color(0xFF32A060) - : Colors.black, - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - ), - ), - ) - ], - ), - ))), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - navigationType = 2; - navigationPosition(); - }, - child: Container( - decoration: BoxDecoration( - color: navigationType == 2 - ? Color(0xFFE8FFF2) - : Colors.transparent, - borderRadius: BorderRadius.circular(23), - ), - padding: EdgeInsets.symmetric( - vertical: 5.h, horizontal: 13.w), - child: Row( - children: [ - if (navigationType == 2) - Image.asset( - "assets/image/icon_by_bike.webp", - fit: BoxFit.fill, - height: 16.h, - width: 14.w, - ), - Padding( - padding: EdgeInsets.only(left: 2.w), - child: Text( - "骑行", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: navigationType == 2 - ? Color(0xFF32A060) - : Colors.black, - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - ), - ), - ) - ], - ), - ))), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - navigationType = 1; - navigationPosition(); - }, - child: Container( - decoration: BoxDecoration( - color: navigationType == 1 - ? Color(0xFFE8FFF2) - : Colors.transparent, - borderRadius: BorderRadius.circular(23), - ), - padding: EdgeInsets.symmetric( - vertical: 5.h, horizontal: 13.w), - child: Row( - children: [ - if (navigationType == 1) - Image.asset( - "assets/image/icon_walk.webp", - fit: BoxFit.fill, - height: 16.h, - width: 14.w, - ), - Padding( - padding: EdgeInsets.only(left: 2.w), - child: Text( - "步行", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: navigationType == 1 - ? Color(0xFF32A060) - : Colors.black, - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - ), - ), - ) - ], - ), - ))), - ], - ) + ))), ], - )) + ) + ], + )) ], ), ); @@ -972,10 +1019,10 @@ class _LocationMap extends State { child: Text( (distance ?? 0) > 1000 ? S.of(context).gongli( - ((distance ?? 0) / 1000 * 100).toInt() / 100.0) + ((distance ?? 0) / 1000 * 100).toInt() / 100.0) : S - .of(context) - .mi(((distance ?? 0) * 100).toInt() / 100.0), + .of(context) + .mi(((distance ?? 0) * 100).toInt() / 100.0), overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 20.sp, @@ -1008,10 +1055,10 @@ class _LocationMap extends State { navigationType == 1 ? "步行导航" : navigationType == 2 - ? "骑行导航" - : navigationType == 3 - ? "公交导航" - : "驾车导航", + ? "骑行导航" + : navigationType == 3 + ? "公交导航" + : "驾车导航", style: TextStyle( fontSize: 20.sp, color: Colors.white, @@ -1030,19 +1077,19 @@ class _LocationMap extends State { var list = businessService.split(","); return list .map((e) => Container( - margin: EdgeInsets.only(right: 8.w), - child: RoundButton( - height: 17.h * AppUtils.textScale(context), - text: "$e", - backgroup: Color(0xFFFF7A1A), - padding: EdgeInsets.only( - left: 2.w, - right: 2.w, - ), - fontSize: 10.sp, - textColor: Colors.white, - ), - )) + margin: EdgeInsets.only(right: 8.w), + child: RoundButton( + height: 17.h * AppUtils.textScale(context), + text: "$e", + backgroup: Color(0xFFFF7A1A), + padding: EdgeInsets.only( + left: 2.w, + right: 2.w, + ), + fontSize: 10.sp, + textColor: Colors.white, + ), + )) .toList(); } @@ -1064,7 +1111,7 @@ class _LocationMap extends State { isAccuracyCircleShow: true, locationViewImage: 'assets/image/icon_my_location.webp', locationViewHierarchy: - BMFLocationViewHierarchy.LOCATION_VIEW_HIERARCHY_BOTTOM, + BMFLocationViewHierarchy.LOCATION_VIEW_HIERARCHY_BOTTOM, ); _mapController.updateLocationViewWithParam(displayParam); addMarker(); diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 95631d64..3bcb69bd 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -21,6 +21,7 @@ import 'package:flutter/rendering.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; +import '../view_widget/location_tips.dart'; import '../view_widget/no_data_view.dart'; class UnionPage extends StatefulWidget { @@ -45,6 +46,7 @@ class UnionPageState extends State BMFCoordinate latLng; String areaName; List _allKey = []; + bool _isShowLocalTips = false; jumpIndex(jpIndex) { tabController.index = jpIndex; @@ -59,6 +61,23 @@ class UnionPageState extends State Location.getInstance().aMapFlutterLocation.stopLocation(); } + @override + void didChangeAppLifecycleState(AppLifecycleState state) { + if (state == AppLifecycleState.resumed) { + // 处理应用程序切换回前台的逻辑 + permissionSettings(); + } else if (state == AppLifecycleState.paused) { + // 处理应用程序切换到后台的逻辑 + } + } + + void permissionSettings() async { + if (await Permission.location.isGranted){ + _isShowLocalTips = false; + startLocation(); + } + } + @override void didChangeMetrics() { super.didChangeMetrics(); @@ -127,8 +146,10 @@ class UnionPageState extends State if (!powerFlag) { if (await Permission.locationWhenInUse.status.isGranted) { startLocation(); - } else + } else { + _isShowLocalTips = true; loadFinish(showLoading: false); + } } } } @@ -185,120 +206,134 @@ class UnionPageState extends State onTap: () { FocusScope.of(context).requestFocus(FocusNode()); }, - child: Container( - child: Column( - children: [ - Row( + child: Stack( + alignment: Alignment.bottomCenter, + children: [ + Container( + child: Column( children: [ - Padding( - padding: EdgeInsets.only(left: 18.w, right: 10.w), - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Navigator.of(context).pushNamed( - '/router/union_select_city', - arguments: {"cityName": areaName}).then((value) { - if (value != null) { - areaName = value; - loadFinish(); - } - }); - }, - child: Row( - children: [ - Text( - areaName ?? "", - overflow: TextOverflow.ellipsis, - maxLines: 1, - style: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.bold, - color: Colors.white), + Row( + children: [ + Padding( + padding: EdgeInsets.only(left: 18.w, right: 10.w), + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context).pushNamed( + '/router/union_select_city', + arguments: {"cityName": areaName}).then((value) { + if (value != null) { + areaName = value; + loadFinish(); + } + }); + }, + child: Row( + children: [ + Text( + areaName ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.bold, + color: Colors.white), + ), + Icon( + Icons.keyboard_arrow_down, + color: Colors.white, + size: 24, + ) + ], ), - Icon( - Icons.keyboard_arrow_down, - color: Colors.white, - size: 24, - ) - ], + ), + ), + Expanded(child: buildSearchItem()) + ], + ), + Align( + alignment: Alignment.centerLeft, + child: TabBar( + controller: tabController, + isScrollable: true, + //可滚动 + indicatorColor: Colors.white, + labelColor: Colors.white, + labelStyle: TextStyle( + fontSize: 18.sp, + fontWeight: FontWeight.bold, + ), + unselectedLabelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.normal, ), + //未选中文字颜色 + unselectedLabelColor: Colors.white, + indicatorSize: TabBarIndicatorSize.label, + //指示器与文字等宽 + tabs: [ + MyTab(text: S.of(context).quanbu), + MyTab(text: S.of(context).chi), + MyTab(text: S.of(context).he), + MyTab(text: S.of(context).wan), + ], ), ), - Expanded(child: buildSearchItem()) + _allKey.isEmpty + ? NoDataView( + src: "assets/image/di_zhi.webp", + isShowBtn: false, + text: "暂无店铺列表~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ) + : Expanded( + child: TabBarView( + controller: tabController, + children: [ + UnionList(_allKey[0], "", latLng, + editingController.text, areaName), + UnionList(_allKey[1], "EATSTORE", latLng, + editingController.text, areaName), + UnionList(_allKey[2], "DRINKSTORE", latLng, + editingController.text, areaName), + UnionList(_allKey[3], "HAPPYSTORE", latLng, + editingController.text, areaName), + ], + ), + ) ], ), - Align( - alignment: Alignment.centerLeft, - child: TabBar( - controller: tabController, - isScrollable: true, - //可滚动 - indicatorColor: Colors.white, - labelColor: Colors.white, - labelStyle: TextStyle( - fontSize: 18.sp, - fontWeight: FontWeight.bold, - ), - unselectedLabelStyle: TextStyle( - fontSize: 15.sp, - fontWeight: FontWeight.normal, - ), - //未选中文字颜色 - unselectedLabelColor: Colors.white, - indicatorSize: TabBarIndicatorSize.label, - //指示器与文字等宽 - tabs: [ - MyTab(text: S.of(context).quanbu), - MyTab(text: S.of(context).chi), - MyTab(text: S.of(context).he), - MyTab(text: S.of(context).wan), - ], - ), + padding: + EdgeInsets.only(top: MediaQuery.of(context).padding.top + 17.h), + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color(0xFF32A060), + Color(0xFF32A060), + Colors.white, + Colors.white, + ], + stops: [ + 0, + 0.2, + 0.4, + 1 + ]), ), - _allKey.isEmpty - ? NoDataView( - src: "assets/image/di_zhi.webp", - isShowBtn: false, - text: "暂无店铺列表~", - fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h), - ) - : Expanded( - child: TabBarView( - controller: tabController, - children: [ - UnionList(_allKey[0], "", latLng, - editingController.text, areaName), - UnionList(_allKey[1], "EATSTORE", latLng, - editingController.text, areaName), - UnionList(_allKey[2], "DRINKSTORE", latLng, - editingController.text, areaName), - UnionList(_allKey[3], "HAPPYSTORE", latLng, - editingController.text, areaName), - ], - ), - ) - ], - ), - padding: - EdgeInsets.only(top: MediaQuery.of(context).padding.top + 17.h), - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF32A060), - Color(0xFF32A060), - Colors.white, - Colors.white, - ], - stops: [ - 0, - 0.2, - 0.4, - 1 - ]), - ), + ), + if (_isShowLocalTips) + Padding( + padding: EdgeInsets.only(bottom: 70.h), + child: LocationTips(() { + setState(() { + _isShowLocalTips = false; + }); + }), + ) + ], ), ); } diff --git a/lib/utils/location.dart b/lib/utils/location.dart index f678878c..2b1f1482 100644 --- a/lib/utils/location.dart +++ b/lib/utils/location.dart @@ -11,10 +11,9 @@ import 'package:permission_handler/permission_handler.dart'; import 'font_weight.dart'; - BaiduLocationAndroidOption initAndroidOptions() { BaiduLocationAndroidOption options = BaiduLocationAndroidOption( - // 定位模式,可选的模式有高精度、仅设备、仅网络。默认为高精度模式 + // 定位模式,可选的模式有高精度、仅设备、仅网络。默认为高精度模式 locationMode: BMFLocationMode.hightAccuracy, // 是否需要返回地址信息 isNeedAddress: true, @@ -63,7 +62,6 @@ BaiduLocationIOSOption initIOSOptions() { return options; } - class Location { static Location _instance; @@ -80,17 +78,18 @@ class Location { LocationFlutterPlugin aMapFlutterLocation; - Future startLocation(context, Function(BaiduLocation result) locationCallback) async { - aMapFlutterLocation.prepareLoc(initAndroidOptions().getMap(), initIOSOptions().getMap()); - if (!(await Permission.locationWhenInUse.serviceStatus.isEnabled)) { - enableLocation(context); + Future startLocation( + context, Function(BaiduLocation result) locationCallback) async { + aMapFlutterLocation.prepareLoc( + initAndroidOptions().getMap(), initIOSOptions().getMap()); + var permissionStatus = await Permission.location.status; + if (!permissionStatus.isGranted) { + if (permissionStatus.isUndetermined) + showTipsAlertDialog(context); return false; - } - if (await Permission.location.isPermanentlyDenied) { - requestDialog(context, locationCallback); - return false; - } else if (await Permission.location.isGranted) { - aMapFlutterLocation.singleLocationCallback(callback: (BaiduLocation result) { + } else { + aMapFlutterLocation.singleLocationCallback( + callback: (BaiduLocation result) { locationCallback.call(result); }); if (Platform.isIOS) { @@ -102,21 +101,6 @@ class Location { await aMapFlutterLocation.startLocation(); } return true; - } else if (await Permission.location.isUndetermined) { - showAlertDialog(context); - await Permission.location.request(); - Navigator.of(context).pop(); - return false; - } else { - if (Platform.isIOS) { - //去设置中心 - requestDialog(context, locationCallback); - } else { - showAlertDialog(context); - await Permission.location.request(); - Navigator.of(context).pop(); - } - return false; } } @@ -172,56 +156,173 @@ class Location { } ///定位权限说明弹窗 - showAlertDialog(context) { + showTipsAlertDialog(context) async { //显示对话框 showDialog( context: context, + barrierDismissible: false, + barrierColor: null, builder: (BuildContext context) { - return SimpleDialog( - titlePadding: EdgeInsets.all(10), - backgroundColor: Colors.transparent, - elevation: 0, - alignment: Alignment.topCenter, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(6), - ), - children: [ + return Column( + children: [ Container( width: double.infinity, - height: 120.h, - padding: EdgeInsets.all(16), + padding: EdgeInsets.all(15), + margin: EdgeInsets.all(15), decoration: new BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.circular(8), + borderRadius: BorderRadius.circular(10), ), - child:Column( + child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - "访问精确地理位置信息权限说明", - style: TextStyle( - fontSize: 15.sp, - fontWeight:MyFontWeight.regular, - color: Colors.black, - ), + Icon( + Icons.location_on_outlined, + color: Colors.black, + size: 22, ), - SizedBox(height: 3.h,), - Text( - "为了向您推荐附近的门店信息,推荐您在使用期间让我们使用位置信息,不授权该权限不影响app正常使用。", - style: TextStyle( - fontSize: 13.sp, - height: 1.3.h, - fontWeight:MyFontWeight.regular, - color: Colors.black, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + // "访问精确地理位置信息权限说明", + "位置权限使用说明", + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, + ), + ), + SizedBox( + height: 3.h, + ), + Text( + // "为了向您推荐附近的门店信息,推荐您在使用期间让我们使用位置信息,不授权该权限不影响app正常使用。", + "为了向您推荐附近的门店信息,推荐您在使用期间让我们使用位置信息", + style: TextStyle( + fontSize: 13.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, + ), + ), + ], ), ), ], ), - ), + ) ], + mainAxisSize: MainAxisSize.min, ); }, ); + await Permission.location.request(); + Navigator.of(context).pop(); } + ///定位权限说明和申请弹窗 + showAlertDialog(context) { + //显示对话框 + showDialog( + context: context, + barrierDismissible: true, + barrierColor: null, + builder: (BuildContext context) { + return Column( + children: [ + Container( + width: double.infinity, + padding: EdgeInsets.all(15), + margin: EdgeInsets.all(15), + decoration: new BoxDecoration( + color: Colors.black.withOpacity(0.6), + borderRadius: BorderRadius.circular(10), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + // "访问精确地理位置信息权限说明", + "定位服务未开启", + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + SizedBox( + height: 3.h, + ), + Text( + // "为了向您推荐附近的门店信息,推荐您在使用期间让我们使用位置信息,不授权该权限不影响app正常使用。", + "开启后才能提供更详细的定位服务哦!", + style: TextStyle( + fontSize: 13.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + ], + ), + ), + GestureDetector( + child: Container( + child: Text( + "去开启", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + margin: EdgeInsets.symmetric( + horizontal: 15.w, vertical: 25.h), + padding: + EdgeInsets.symmetric(vertical: 2.h, horizontal: 10.w), + decoration: BoxDecoration( + color: Colors.green, + borderRadius: BorderRadius.circular(100), + ), + ), + onTap: () async { + await openAppSettings(); + if (await Permission.location.isGranted) + Navigator.of(context).pop(); + }, + behavior: HitTestBehavior.opaque, + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + child: Container( + child: Icon( + Icons.close, + color: Colors.white.withOpacity(0.8), + size: 12, + ), + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.8), + borderRadius: BorderRadius.circular(100), + ), + padding: EdgeInsets.all(5), + ), + onTap: () { + Navigator.of(context).pop(); + }, + ) + ], + ), + ) + ], + mainAxisSize: MainAxisSize.min, + ); + }, + ); + } } diff --git a/lib/view_widget/location_tips.dart b/lib/view_widget/location_tips.dart new file mode 100644 index 00000000..726b94ad --- /dev/null +++ b/lib/view_widget/location_tips.dart @@ -0,0 +1,120 @@ +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/retrofit/data/activity_pos.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:permission_handler/permission_handler.dart'; + +import '../retrofit/data/login_info.dart'; +import '../utils/font_weight.dart'; +import 'custom_image.dart'; +import 'new_people_reward.dart'; + +class LocationTips extends StatefulWidget { + final Function disMissLocationTips; + + LocationTips(this.disMissLocationTips); + + @override + State createState() { + return _LocationTips(); + } +} + +class _LocationTips extends State { + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + padding: EdgeInsets.all(10), + margin: EdgeInsets.only(left: 15.w, right: 15.w, bottom: 15.h), + decoration: new BoxDecoration( + color: Colors.black.withOpacity(0.8), + borderRadius: BorderRadius.circular(10), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + // "访问精确地理位置信息权限说明", + "定位服务未开启", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + SizedBox( + height: 3.h, + ), + Text( + // "为了向您推荐附近的门店信息,推荐您在使用期间让我们使用位置信息,不授权该权限不影响app正常使用。", + "开启后才能提供更详细的定位服务哦!", + style: TextStyle( + fontSize: 13.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + ], + ), + ), + GestureDetector( + child: Container( + child: Text( + "去开启", + style: TextStyle( + fontSize: 13.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + margin: EdgeInsets.only(left: 15.w, right: 15.w, top: 15.h), + padding: EdgeInsets.symmetric(vertical: 2.h, horizontal: 10.w), + decoration: BoxDecoration( + color: Colors.green, + borderRadius: BorderRadius.circular(100), + ), + ), + onTap: () async { + if (!await openAppSettings()) { + SmartDialog.showToast("打开应用设置失败,请手动前往系统设置中心开启应用位置权限", + alignment: Alignment.center); + } + }, + behavior: HitTestBehavior.opaque, + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + child: Container( + child: Icon( + Icons.close, + color: Colors.white.withOpacity(0.8), + size: 10, + ), + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.8), + borderRadius: BorderRadius.circular(100), + ), + padding: EdgeInsets.all(3), + ), + onTap: () { + widget.disMissLocationTips(); + }, + ) + ], + ), + ); + } +} From ad8be1257ede422bcc18468dd37285ec7e27fd2d Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Tue, 5 Sep 2023 09:35:43 +0800 Subject: [PATCH 21/35] 11 --- lib/union/location_map_pages.dart | 1092 +++++++++++++++++++++++++++++ 1 file changed, 1092 insertions(+) create mode 100644 lib/union/location_map_pages.dart diff --git a/lib/union/location_map_pages.dart b/lib/union/location_map_pages.dart new file mode 100644 index 00000000..56cdbcf1 --- /dev/null +++ b/lib/union/location_map_pages.dart @@ -0,0 +1,1092 @@ +import 'dart:convert'; +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; +import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; +import 'package:flutter_baidu_mapapi_search/flutter_baidu_mapapi_search.dart'; +import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart'; +import 'package:flutter_bmflocation/flutter_bmflocation.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/utils/flutter_utils.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/utils/location.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:permission_handler/permission_handler.dart'; + +import '../generated/l10n.dart'; +import '../retrofit/data/store_info.dart'; +import '../view_widget/custom_image.dart'; +import '../view_widget/round_button.dart'; + +class LocationMaps extends StatefulWidget { + final Map arguments; + + LocationMaps({this.arguments}); + + @override + State createState() { + return _LocationMaps(); + } +} + +class _LocationMaps extends State { + StoreInfo storeInfo; + int navigationState = 0; + double distance; + int navigationType = 0; + bool positionSorta = false; + String myAddress; + String myCity; + String hours; + String minutes; + String polylineId; + + @override + void initState() { + super.initState(); + storeInfo = widget.arguments["storeInfo"]; + distance = widget.arguments["distance"]; + getLocation(); + } + + void getLocation() async { + bool powerFlag = false; + try { + Future.delayed(Duration(seconds: 5), () { + Location.getInstance().stopLocation(); + }); + powerFlag = await Location.getInstance().startLocation(context, + (BaiduLocation result) { + if (result != null && + result.latitude != null && + result.longitude != null) { + print("location: $result"); + myLatLng = BMFCoordinate(result.latitude, result.longitude); + myAddress = result.locationDetail; + myCity = result.city; + if(distance == null) + calculate(); + AppUtils.coordConvert(myLatLng).then((value) { + this.myLatLng = value; + locationShow(); + }); + Location.getInstance().stopLocation(); + } + }); + } finally { + if (!powerFlag) { + if (await Permission.locationWhenInUse.status.isGranted) { + getLocation(); + } else { + SmartDialog.showToast("您定位服务未开启,请前往系统设置中开启定位服务", + alignment: Alignment.center); + } + } + } + } + + calculate() async { + BMFCoordinate bmfCoordinate = BMFCoordinate( + double.tryParse(storeInfo.latitude), + double.tryParse(storeInfo.longitude), + ); + distance = double.tryParse(await AppUtils.calculateDistance(bmfCoordinate, myLatLng,isMi:true)); + } + + locationShow() { + BMFLocation location = BMFLocation( + coordinate: myLatLng, + altitude: 0, + horizontalAccuracy: 5, + verticalAccuracy: -1.0, + speed: -1.0, + course: -1.0, + ); + BMFUserLocation userLocation = BMFUserLocation( + location: location, + ); + setState(() { + _mapController.updateLocationData(userLocation); + }); + } + + @override + void dispose() { + super.dispose(); + Location.getInstance().stopLocation(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + // appBar: MyAppBar( + // background: Color(0xFFF7F7F7), + // title: widget.arguments["storeName"], + // titleColor: Colors.black87, + // titleSize: 18.sp, + // leadingColor: Colors.black, + // ), + body: Stack( + children: [ + Column( + children: [ + Expanded( + child: Container( + //BMFMapWidget 组件会自动默认沾满全屏,并且挡住所有遮盖物 ,BMFTextureMapWidget不会强制遮盖其他控件。 + child: BMFTextureMapWidget( + mapOptions: BMFMapOptions( + center: BMFCoordinate( + double.tryParse(widget.arguments["lat"]), + double.tryParse(widget.arguments["lng"]), + ), + showZoomControl: false, + showMapScaleBar: false, + rotateEnabled: false, + zoomLevel: 15, + ), + onBMFMapCreated: onMapCreated, + )), + flex: 3, + ), + navigationState == 0 + ? Container( + height: 253.h, + padding: + EdgeInsets.only(top: 16.h, left: 16.w, right: 28.w), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x08213303), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.vertical( + top: Radius.circular(8), + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Row( + children: [ + Expanded( + child: Column( + children: [ + Text( + storeInfo?.storeName ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 20.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.medium, + ), + ), + Row( + children: [ + Text( + S.of(context).ren( + storeInfo != null + ? storeInfo + .perCapitaConsumption + : "", + ), + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF4D4D4D), + ), + ), + SizedBox( + width: 20.w, + ), + ]..addAll(itemServer(storeInfo != null + ? storeInfo.businessService + : "")), + ), + Text( + S.of(context).yingyeshijian(storeInfo == + null + ? "" + : (storeInfo.openStartTime == + null && + storeInfo.openEndTime == + null) + ? S.of(context).quantian + : "${storeInfo.openStartTime.substring(0, storeInfo.openStartTime.lastIndexOf(":"))} " + "- ${storeInfo.openEndTime.substring(0, storeInfo.openEndTime.lastIndexOf(":"))}"), + style: TextStyle( + color: Color(0xFF4D4D4D), + fontWeight: MyFontWeight.medium, + fontSize: 12.sp, + ), + ), + ], + mainAxisAlignment: + MainAxisAlignment.spaceAround, + crossAxisAlignment: + CrossAxisAlignment.start, + ), + ), + MImage( + storeInfo != null ? storeInfo.logo : "", + width: 72.h, + height: 72.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 32.h), + child: Text( + "${storeInfo != null ? storeInfo.address : ""}", + maxLines: 2, + textAlign: TextAlign.justify, + style: TextStyle( + color: Color(0xFF353535), + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + ), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if (myCity == null) { + getLocation(); + } else { + navigationState = 1; + if ((distance ?? 0) < 500) + navigationType = 1; + else if ((distance ?? 0) < 1500) + navigationType = 2; + else navigationType = 4; + navigationPosition(); + } + }, + child: Container( + alignment: Alignment.center, + width: double.infinity, + padding: EdgeInsets.symmetric(vertical: 10.h), + margin: EdgeInsets.only(bottom: 30.h), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(23), + ), + child: Text( + "到这去", + style: TextStyle( + fontSize: 20.sp, + color: Colors.white, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ) + ], + ), + ) + : navigationDistance(), + ], + ), + navigationState == 0 + ? GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + height: 56.h, + margin: EdgeInsets.only( + top: MediaQuery.of(context).padding.top + 16.h, + left: 14.w, + right: 14.w), + padding: EdgeInsets.only(left: 12.w, right: 21.w), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x08213303), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.circular(6), + ), + child: Row( + children: [ + Icon( + Icons.arrow_back_ios, + color: Color(0xFF353535), + size: 24, + ), + Expanded( + child: Text( + storeInfo?.storeName ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 18.sp, + fontWeight: MyFontWeight.regular, + ), + )) + ], + ), + ), + ) + : navigationBox(), + ], + ), + ); + } + + //調取百度地圖APP + void onOpenBaiduMapRoute() async { + // 我的位置 + BMFCoordinate startCoord = BMFCoordinate( + positionSorta == false + ? myLatLng.latitude + : double.tryParse(widget.arguments["lat"]), + positionSorta == false + ? myLatLng.longitude + : double.tryParse(widget.arguments["lng"])); + String startName = ((positionSorta == false) ? "我的位置" : "终点"); + // 去的位置 + String endName = ((positionSorta == false) ? "终点" : "我的位置"); + BMFCoordinate endCoord = BMFCoordinate( + positionSorta == false + ? double.tryParse(widget.arguments["lat"]) + : myLatLng.latitude, + positionSorta == false + ? double.tryParse(widget.arguments["lng"]) + : myLatLng.longitude); + BMFOpenRouteOption routeOption = BMFOpenRouteOption( + startCoord: startCoord, + startName: startName, + endCoord: endCoord, + endName: endName, + routeType: navigationType == 1 + ? BMFOpenRouteType.WalkingRoute + : navigationType == 2 + ? BMFOpenRouteType.WalkingRoute + : navigationType == 3 + ? BMFOpenRouteType.TransitRoute + : BMFOpenRouteType.DrivingRoute, + appScheme: 'baidumapsdk_flutter://mapsdk.baidu.com', + // 指定返回自定义scheme + isSupportWeb: true); + BMFOpenErrorCode flag = + await BMFOpenMapUtils.openBaiduMapRoute(routeOption); + print('open - route - errorCode = $flag'); + } + + updateMapLine(List coordinates, int needHours, int needMinutes, + double needDistance) { + try { + //刪除之前的創建的點和綫 + _mapController.cleanAllMarkers(); + if (polylineId != null) _mapController.removeOverlay(polylineId); + + BMFCoordinate startLocation = + BMFCoordinate(coordinates.first.latitude, coordinates.first.longitude); + + BMFCoordinate endLocation = + BMFCoordinate(coordinates.last.latitude, coordinates.last.longitude); + + /// 创建polyline + BMFPolyline colorsPolyline = BMFPolyline( + // id: polylineOptions.hashCode.toString(), + coordinates: coordinates, + indexs: [0], + textures: [ + navigationType != 4 + ? 'assets/image/traffic_texture_unknown.png' + : 'assets/image/traffic_texture_smooth.png' + ], + width: 16, + lineDashType: BMFLineDashType.LineDashTypeNone, + lineCapType: BMFLineCapType.LineCapButt, + lineJoinType: BMFLineJoinType.LineJoinRound); + polylineId = colorsPolyline.id; + + /// 添加polyline + _mapController.addPolyline(colorsPolyline); + var startBmfMarker = BMFMarker.icon( + position: startLocation, + centerOffset: BMFPoint(0.5, 0.7), + enabled: false, + icon: "assets/image/icon_start.png", + draggable: false, + ); + _mapController.addMarker(startBmfMarker); + + var terminalBmfMarker = BMFMarker.icon( + position: endLocation, + centerOffset: BMFPoint(0.5, 0.7), + enabled: false, + icon: "assets/image/icon_end.png", + draggable: false, + ); + _mapController.addMarker(terminalBmfMarker); + _mapController.setVisibleMapRectWithPadding( + visibleMapBounds: BMFCoordinateBounds( + northeast: startLocation, southwest: endLocation), + animated: true, + insets: EdgeInsets.only( + top: 500, bottom: 200, left: 200, right: 200)); + + hours = needHours == 0 ? "" : "$needHours小时"; + minutes = needMinutes == 0 ? "" : "$needMinutes分钟"; + distance = needDistance; + }finally{ + setState(() {}); + EasyLoading.dismiss(); + } + } + + navigationPosition() async { + EasyLoading.show( + status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); + BMFPlanNode from = BMFPlanNode( + cityName: positionSorta == false ? myCity : (storeInfo?.city ?? ""), + name: positionSorta == false ? myAddress : storeInfo?.address ?? "", + pt: positionSorta == false + ? BMFCoordinate(myLatLng?.latitude ?? 0, myLatLng?.longitude ?? 0) + : latLng); + BMFPlanNode to = BMFPlanNode( + cityName: positionSorta == false ? (storeInfo?.city ?? "") : myCity, + name: positionSorta == false ? (storeInfo?.address ?? "") : myAddress, + pt: positionSorta == false + ? latLng + : BMFCoordinate(myLatLng?.latitude ?? 0, myLatLng?.longitude ?? 0)); + if (navigationType == 1) { + //步行 + BMFWalkingRoutePlanOption walkingRoutePlanOption = + BMFWalkingRoutePlanOption(from: from, to: to); + // 检索实例 + BMFWalkingRouteSearch walkingRouteSearch = BMFWalkingRouteSearch(); + // 检索回调 + walkingRouteSearch.onGetWalkingRouteSearchResult(callback: + (BMFWalkingRouteResult result, BMFSearchErrorCode errorCode) async { + if (errorCode == BMFSearchErrorCode.RESULT_NOT_FOUND) { + SmartDialog.showToast("该方案暂无可用的规划路线", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } else if (errorCode != BMFSearchErrorCode.NO_ERROR) { + SmartDialog.showToast("获取路线规划失败,请稍后再试", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } + print( + '`步行检索回调 errorCode = ${errorCode} \n result = ${result?.toMap()}'); + + /// 坐标点 + List coordinates = []; + result.routes.first.steps.forEach((e1) { + e1.points.forEach((e2) { + coordinates.add(BMFCoordinate(e2.latitude, e2.longitude)); + }); + }); + updateMapLine( + coordinates, + result.routes.first.duration.hours, + result.routes.first.duration.minutes, + result.routes.first.distance.toDouble()); + }); + bool flag = + await walkingRouteSearch.walkingRouteSearch(walkingRoutePlanOption); + } else if (navigationType == 2) { + //骑行 + BMFRidingRoutePlanOption ridingRoutePlanOption = + BMFRidingRoutePlanOption(from: from, to: to); + BMFRidingRouteSearch ridingRouteSearch = BMFRidingRouteSearch(); + ridingRouteSearch.onGetRidingRouteSearchResult(callback: + (BMFRidingRouteResult result, BMFSearchErrorCode errorCode) { + if (errorCode == BMFSearchErrorCode.RESULT_NOT_FOUND) { + SmartDialog.showToast("该方案暂无可用的规划路线", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } else if (errorCode != BMFSearchErrorCode.NO_ERROR) { + SmartDialog.showToast("获取路线规划失败,请稍后再试", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } + print( + '`骑行检索回调 errorCode = ${errorCode} \n result = ${result?.toMap()}'); + + /// 坐标点 + List coordinates = []; + result.routes.first.steps.forEach((e1) { + e1.points.forEach((e2) { + coordinates.add(BMFCoordinate(e2.latitude, e2.longitude)); + }); + }); + updateMapLine( + coordinates, + result.routes.first.duration.hours, + result.routes.first.duration.minutes, + result.routes.first.distance.toDouble()); + }); +// 发起检索 + bool flag = + await ridingRouteSearch.ridingRouteSearch(ridingRoutePlanOption); + } else if (navigationType == 3) { + //公交 + BMFTransitRoutePlanOption transitRoutePlanOption = + BMFTransitRoutePlanOption(from: from, to: to, city: '武汉市'); + BMFTransitRouteSearch transitRouteSearch = BMFTransitRouteSearch(); + transitRouteSearch.onGetTransitRouteSearchResult(callback: + (BMFTransitRouteResult result, BMFSearchErrorCode errorCode) { + if (errorCode == BMFSearchErrorCode.RESULT_NOT_FOUND) { + SmartDialog.showToast("该方案暂无可用的规划路线", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } else if (errorCode != BMFSearchErrorCode.NO_ERROR) { + SmartDialog.showToast("获取路线规划失败,请稍后再试", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } + print( + '`市内公交检索回调 errorCode = ${errorCode} \n result = ${result?.toMap()}'); + + /// 坐标点 + List coordinates = []; + result.routes.first.steps.forEach((e1) { + e1.points.forEach((e2) { + coordinates.add(BMFCoordinate(e2.latitude, e2.longitude)); + }); + }); + updateMapLine( + coordinates, + result.routes.first.duration.hours, + result.routes.first.duration.minutes, + result.routes.first.distance.toDouble()); + }); +// 发起检索 + bool flag = + await transitRouteSearch.transitRouteSearch(transitRoutePlanOption); + } else { + //驾车 + BMFDrivingRoutePlanOption drivingRoutePlanOption = + BMFDrivingRoutePlanOption(from: from, to: to); + BMFDrivingRouteSearch drivingRouteSearch = BMFDrivingRouteSearch(); + drivingRouteSearch.onGetDrivingRouteSearchResult(callback: + (BMFDrivingRouteResult result, BMFSearchErrorCode errorCode) { + if (errorCode == BMFSearchErrorCode.RESULT_NOT_FOUND) { + SmartDialog.showToast("该方案暂无可用的规划路线", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } else if (errorCode != BMFSearchErrorCode.NO_ERROR) { + SmartDialog.showToast("获取路线规划失败,请稍后再试", alignment: Alignment.center); + EasyLoading.dismiss(); + return; + } + print( + '驾车检索回调 errorCode = ${errorCode} \n result = ${result?.toMap()}'); + + /// 坐标点 + List coordinates = []; + result.routes.first.steps.forEach((e1) { + e1.points.forEach((e2) { + coordinates.add(BMFCoordinate(e2.latitude, e2.longitude)); + }); + }); + updateMapLine( + coordinates, + result.routes.first.duration.hours, + result.routes.first.duration.minutes, + result.routes.first.distance.toDouble()); + }); +// 发起检索 + bool flag = + await drivingRouteSearch.dringRouteSearch(drivingRoutePlanOption); + } + } + + Widget navigationBox() { + return Container( + height: 132.h, + margin: EdgeInsets.only( + top: MediaQuery.of(context).padding.top + 16.h, + left: 14.w, + right: 14.w), + padding: EdgeInsets.only(left: 12.w, right: 18.w, top: 8.h), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x08213303), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.circular(6), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + navigationState = 0; + }); + }, + child: Padding( + padding: EdgeInsets.only(top: 10.h, right: 10.w), + child: Icon( + Icons.arrow_back_ios, + color: Color(0xFF353535), + size: 24, + ), + ), + ), + Expanded( + child: Column( + children: [ + Container( + width: double.infinity, + decoration: BoxDecoration( + color: Color(0xFFF5F5F5), + borderRadius: BorderRadius.circular(6), + ), + padding: EdgeInsets.only( + top: 12.h, + bottom: 12.h, + left: 15.w, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + bottom: 14.h, + ), + child: Row( + children: [ + Container( + width: 4.h, + height: 4.h, + margin: EdgeInsets.only(right: 20.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(6), + ), + ), + Expanded( + child: Text( + positionSorta == false + ? "我的位置" + : (storeInfo?.storeName ?? ""), + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + ), + )) + ], + ), + ), + Row( + children: [ + Container( + width: 4.h, + height: 4.h, + margin: EdgeInsets.only(right: 20.w), + decoration: BoxDecoration( + color: Color(0xFFFA5151), + borderRadius: BorderRadius.circular(6), + ), + ), + Expanded( + child: Text( + positionSorta == false + ? (storeInfo?.storeName ?? "") + : "我的位置", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + ), + )) + ], + ) + ], + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + positionSorta = !positionSorta; + navigationPosition(); + }, + child: Container( + padding: EdgeInsets.only(right: 24.w), + child: Image.asset( + "assets/image/position_sort.webp", + fit: BoxFit.fill, + height: 16.h, + width: 14.w, + ), + ), + ) + ], + ), + ), + SizedBox( + height: 12.h, + ), + Row( + children: [ + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + navigationType = 4; + navigationPosition(); + }, + child: Container( + decoration: BoxDecoration( + color: navigationType == 4 + ? Color(0xFFE8FFF2) + : Colors.transparent, + borderRadius: BorderRadius.circular(23), + ), + padding: + EdgeInsets.symmetric(vertical: 5.h, horizontal: 13.w), + child: Row( + children: [ + if (navigationType == 4) + Image.asset( + "assets/image/icon_drive.webp", + fit: BoxFit.fill, + height: 16.h, + width: 14.w, + ), + Padding( + padding: EdgeInsets.only(left: 2.w), + child: Text( + "驾车", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: navigationType == 4 + ? Color(0xFF32A060) + : Colors.black, + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ) + ], + ), + ), + )), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + navigationType = 3; + navigationPosition(); + }, + child: Container( + decoration: BoxDecoration( + color: navigationType == 3 + ? Color(0xFFE8FFF2) + : Colors.transparent, + borderRadius: BorderRadius.circular(23), + ), + padding: EdgeInsets.symmetric( + vertical: 5.h, horizontal: 13.w), + child: Row( + children: [ + if (navigationType == 3) + Image.asset( + "assets/image/icon_transit.webp", + fit: BoxFit.fill, + height: 16.h, + width: 14.w, + ), + Padding( + padding: EdgeInsets.only(left: 2.w), + child: Text( + "公交", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: navigationType == 3 + ? Color(0xFF32A060) + : Colors.black, + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ) + ], + ), + ))), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + navigationType = 2; + navigationPosition(); + }, + child: Container( + decoration: BoxDecoration( + color: navigationType == 2 + ? Color(0xFFE8FFF2) + : Colors.transparent, + borderRadius: BorderRadius.circular(23), + ), + padding: EdgeInsets.symmetric( + vertical: 5.h, horizontal: 13.w), + child: Row( + children: [ + if (navigationType == 2) + Image.asset( + "assets/image/icon_by_bike.webp", + fit: BoxFit.fill, + height: 16.h, + width: 14.w, + ), + Padding( + padding: EdgeInsets.only(left: 2.w), + child: Text( + "骑行", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: navigationType == 2 + ? Color(0xFF32A060) + : Colors.black, + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ) + ], + ), + ))), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + navigationType = 1; + navigationPosition(); + }, + child: Container( + decoration: BoxDecoration( + color: navigationType == 1 + ? Color(0xFFE8FFF2) + : Colors.transparent, + borderRadius: BorderRadius.circular(23), + ), + padding: EdgeInsets.symmetric( + vertical: 5.h, horizontal: 13.w), + child: Row( + children: [ + if (navigationType == 1) + Image.asset( + "assets/image/icon_walk.webp", + fit: BoxFit.fill, + height: 16.h, + width: 14.w, + ), + Padding( + padding: EdgeInsets.only(left: 2.w), + child: Text( + "步行", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: navigationType == 1 + ? Color(0xFF32A060) + : Colors.black, + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ) + ], + ), + ))), + ], + ) + ], + )) + ], + ), + ); + } + + Widget navigationDistance() { + return Container( + height: 173.h, + padding: EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x08213303), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.vertical( + top: Radius.circular(8), + ), + ), + child: Column( + // mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "${navigationType == 1 ? "步行" : navigationType == 2 ? "骑行" : navigationType == 3 ? "公交" : "驾车"}${(hours ?? "") + (minutes ?? "")}", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 20.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.bold, + ), + ), + Padding( + padding: EdgeInsets.only(left: 40.w), + child: Text( + (distance ?? 0) > 1000 + ? S.of(context).gongli( + ((distance ?? 0) / 1000 * 100).toInt() / 100.0) + : S + .of(context) + .mi(((distance ?? 0) * 100).toInt() / 100.0), + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 20.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.bold, + ), + ), + ), + ], + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + navigationState = 1; + onOpenBaiduMapRoute(); + }); + }, + child: Container( + alignment: Alignment.center, + width: double.infinity, + padding: EdgeInsets.symmetric(vertical: 10.h), + margin: EdgeInsets.only(bottom: 30.h), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(23), + ), + child: Text( + navigationType == 1 + ? "步行导航" + : navigationType == 2 + ? "骑行导航" + : navigationType == 3 + ? "公交导航" + : "驾车导航", + style: TextStyle( + fontSize: 20.sp, + color: Colors.white, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ) + ], + ), + ); + } + + List itemServer(String businessService) { + if (businessService == null || businessService == "") return []; + var list = businessService.split(","); + return list + .map((e) => Container( + margin: EdgeInsets.only(right: 8.w), + child: RoundButton( + height: 17.h * AppUtils.textScale(context), + text: "$e", + backgroup: Color(0xFFFF7A1A), + padding: EdgeInsets.only( + left: 2.w, + right: 2.w, + ), + fontSize: 10.sp, + textColor: Colors.white, + ), + )) + .toList(); + } + + BMFMapController _mapController; + BMFCoordinate latLng; + BMFCoordinate myLatLng; + BMFMarker bmfMarker; + + onMapCreated(BMFMapController controller) { + _mapController = controller; + setState(() { + _mapController.showUserLocation(true); + _mapController.setCustomMapStyle('assets/map_style/chatian.sty', 0); + BMFUserLocationDisplayParam displayParam = BMFUserLocationDisplayParam( + locationViewOffsetX: 0, + locationViewOffsetY: 0, + accuracyCircleFillColor: Colors.red, + accuracyCircleStrokeColor: Colors.blue, + isAccuracyCircleShow: true, + locationViewImage: 'assets/image/icon_my_location.webp', + locationViewHierarchy: + BMFLocationViewHierarchy.LOCATION_VIEW_HIERARCHY_BOTTOM, + ); + _mapController.updateLocationViewWithParam(displayParam); + addMarker(); + }); + } + + addMarker() async { + // latLng = await AppUtils.coordConvert(BMFCoordinate(double.tryParse(widget.arguments["lat"]), + // double.tryParse(widget.arguments["lng"]))); + latLng = BMFCoordinate(double.tryParse(widget.arguments["lat"]), + double.tryParse(widget.arguments["lng"])); + + if (bmfMarker == null && _mapController != null) { + bmfMarker = BMFMarker.icon( + position: latLng, + centerOffset: BMFPoint(0.5, 0.7), + enabled: false, + icon: "assets/image/icon_map_marker.webp", + draggable: false, + ); + _mapController.addMarker(bmfMarker); + } + _mapController.setCenterCoordinate(latLng, true); + } +} From 963b379081068be8cb9f7a320ed66b018862b4b7 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Tue, 5 Sep 2023 11:10:06 +0800 Subject: [PATCH 22/35] 11 --- lib/union/location_map_pages.dart | 1092 ----------------------------- 1 file changed, 1092 deletions(-) delete mode 100644 lib/union/location_map_pages.dart diff --git a/lib/union/location_map_pages.dart b/lib/union/location_map_pages.dart deleted file mode 100644 index 56cdbcf1..00000000 --- a/lib/union/location_map_pages.dart +++ /dev/null @@ -1,1092 +0,0 @@ -import 'dart:convert'; -import 'dart:ui'; -import 'package:flutter/material.dart'; -import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; -import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; -import 'package:flutter_baidu_mapapi_search/flutter_baidu_mapapi_search.dart'; -import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart'; -import 'package:flutter_bmflocation/flutter_bmflocation.dart'; -import 'package:flutter_easyloading/flutter_easyloading.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:huixiang/utils/flutter_utils.dart'; -import 'package:huixiang/utils/font_weight.dart'; -import 'package:huixiang/utils/location.dart'; -import 'package:huixiang/view_widget/my_appbar.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:permission_handler/permission_handler.dart'; - -import '../generated/l10n.dart'; -import '../retrofit/data/store_info.dart'; -import '../view_widget/custom_image.dart'; -import '../view_widget/round_button.dart'; - -class LocationMaps extends StatefulWidget { - final Map arguments; - - LocationMaps({this.arguments}); - - @override - State createState() { - return _LocationMaps(); - } -} - -class _LocationMaps extends State { - StoreInfo storeInfo; - int navigationState = 0; - double distance; - int navigationType = 0; - bool positionSorta = false; - String myAddress; - String myCity; - String hours; - String minutes; - String polylineId; - - @override - void initState() { - super.initState(); - storeInfo = widget.arguments["storeInfo"]; - distance = widget.arguments["distance"]; - getLocation(); - } - - void getLocation() async { - bool powerFlag = false; - try { - Future.delayed(Duration(seconds: 5), () { - Location.getInstance().stopLocation(); - }); - powerFlag = await Location.getInstance().startLocation(context, - (BaiduLocation result) { - if (result != null && - result.latitude != null && - result.longitude != null) { - print("location: $result"); - myLatLng = BMFCoordinate(result.latitude, result.longitude); - myAddress = result.locationDetail; - myCity = result.city; - if(distance == null) - calculate(); - AppUtils.coordConvert(myLatLng).then((value) { - this.myLatLng = value; - locationShow(); - }); - Location.getInstance().stopLocation(); - } - }); - } finally { - if (!powerFlag) { - if (await Permission.locationWhenInUse.status.isGranted) { - getLocation(); - } else { - SmartDialog.showToast("您定位服务未开启,请前往系统设置中开启定位服务", - alignment: Alignment.center); - } - } - } - } - - calculate() async { - BMFCoordinate bmfCoordinate = BMFCoordinate( - double.tryParse(storeInfo.latitude), - double.tryParse(storeInfo.longitude), - ); - distance = double.tryParse(await AppUtils.calculateDistance(bmfCoordinate, myLatLng,isMi:true)); - } - - locationShow() { - BMFLocation location = BMFLocation( - coordinate: myLatLng, - altitude: 0, - horizontalAccuracy: 5, - verticalAccuracy: -1.0, - speed: -1.0, - course: -1.0, - ); - BMFUserLocation userLocation = BMFUserLocation( - location: location, - ); - setState(() { - _mapController.updateLocationData(userLocation); - }); - } - - @override - void dispose() { - super.dispose(); - Location.getInstance().stopLocation(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - // appBar: MyAppBar( - // background: Color(0xFFF7F7F7), - // title: widget.arguments["storeName"], - // titleColor: Colors.black87, - // titleSize: 18.sp, - // leadingColor: Colors.black, - // ), - body: Stack( - children: [ - Column( - children: [ - Expanded( - child: Container( - //BMFMapWidget 组件会自动默认沾满全屏,并且挡住所有遮盖物 ,BMFTextureMapWidget不会强制遮盖其他控件。 - child: BMFTextureMapWidget( - mapOptions: BMFMapOptions( - center: BMFCoordinate( - double.tryParse(widget.arguments["lat"]), - double.tryParse(widget.arguments["lng"]), - ), - showZoomControl: false, - showMapScaleBar: false, - rotateEnabled: false, - zoomLevel: 15, - ), - onBMFMapCreated: onMapCreated, - )), - flex: 3, - ), - navigationState == 0 - ? Container( - height: 253.h, - padding: - EdgeInsets.only(top: 16.h, left: 16.w, right: 28.w), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Color(0x08213303), - offset: Offset(0, 2), - blurRadius: 4, - spreadRadius: 0, - ), - ], - borderRadius: BorderRadius.vertical( - top: Radius.circular(8), - ), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Row( - children: [ - Expanded( - child: Column( - children: [ - Text( - storeInfo?.storeName ?? "", - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 20.sp, - color: Color(0xFF0D0D0D), - fontWeight: MyFontWeight.medium, - ), - ), - Row( - children: [ - Text( - S.of(context).ren( - storeInfo != null - ? storeInfo - .perCapitaConsumption - : "", - ), - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF4D4D4D), - ), - ), - SizedBox( - width: 20.w, - ), - ]..addAll(itemServer(storeInfo != null - ? storeInfo.businessService - : "")), - ), - Text( - S.of(context).yingyeshijian(storeInfo == - null - ? "" - : (storeInfo.openStartTime == - null && - storeInfo.openEndTime == - null) - ? S.of(context).quantian - : "${storeInfo.openStartTime.substring(0, storeInfo.openStartTime.lastIndexOf(":"))} " - "- ${storeInfo.openEndTime.substring(0, storeInfo.openEndTime.lastIndexOf(":"))}"), - style: TextStyle( - color: Color(0xFF4D4D4D), - fontWeight: MyFontWeight.medium, - fontSize: 12.sp, - ), - ), - ], - mainAxisAlignment: - MainAxisAlignment.spaceAround, - crossAxisAlignment: - CrossAxisAlignment.start, - ), - ), - MImage( - storeInfo != null ? storeInfo.logo : "", - width: 72.h, - height: 72.h, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.webp", - fadeSrc: "assets/image/default_1.webp", - ), - ], - ), - ), - Padding( - padding: EdgeInsets.only(bottom: 32.h), - child: Text( - "${storeInfo != null ? storeInfo.address : ""}", - maxLines: 2, - textAlign: TextAlign.justify, - style: TextStyle( - color: Color(0xFF353535), - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - ), - ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (myCity == null) { - getLocation(); - } else { - navigationState = 1; - if ((distance ?? 0) < 500) - navigationType = 1; - else if ((distance ?? 0) < 1500) - navigationType = 2; - else navigationType = 4; - navigationPosition(); - } - }, - child: Container( - alignment: Alignment.center, - width: double.infinity, - padding: EdgeInsets.symmetric(vertical: 10.h), - margin: EdgeInsets.only(bottom: 30.h), - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(23), - ), - child: Text( - "到这去", - style: TextStyle( - fontSize: 20.sp, - color: Colors.white, - fontWeight: MyFontWeight.medium, - ), - ), - ), - ) - ], - ), - ) - : navigationDistance(), - ], - ), - navigationState == 0 - ? GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Navigator.of(context).pop(); - }, - child: Container( - height: 56.h, - margin: EdgeInsets.only( - top: MediaQuery.of(context).padding.top + 16.h, - left: 14.w, - right: 14.w), - padding: EdgeInsets.only(left: 12.w, right: 21.w), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Color(0x08213303), - offset: Offset(0, 2), - blurRadius: 4, - spreadRadius: 0, - ), - ], - borderRadius: BorderRadius.circular(6), - ), - child: Row( - children: [ - Icon( - Icons.arrow_back_ios, - color: Color(0xFF353535), - size: 24, - ), - Expanded( - child: Text( - storeInfo?.storeName ?? "", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFF0D0D0D), - fontSize: 18.sp, - fontWeight: MyFontWeight.regular, - ), - )) - ], - ), - ), - ) - : navigationBox(), - ], - ), - ); - } - - //調取百度地圖APP - void onOpenBaiduMapRoute() async { - // 我的位置 - BMFCoordinate startCoord = BMFCoordinate( - positionSorta == false - ? myLatLng.latitude - : double.tryParse(widget.arguments["lat"]), - positionSorta == false - ? myLatLng.longitude - : double.tryParse(widget.arguments["lng"])); - String startName = ((positionSorta == false) ? "我的位置" : "终点"); - // 去的位置 - String endName = ((positionSorta == false) ? "终点" : "我的位置"); - BMFCoordinate endCoord = BMFCoordinate( - positionSorta == false - ? double.tryParse(widget.arguments["lat"]) - : myLatLng.latitude, - positionSorta == false - ? double.tryParse(widget.arguments["lng"]) - : myLatLng.longitude); - BMFOpenRouteOption routeOption = BMFOpenRouteOption( - startCoord: startCoord, - startName: startName, - endCoord: endCoord, - endName: endName, - routeType: navigationType == 1 - ? BMFOpenRouteType.WalkingRoute - : navigationType == 2 - ? BMFOpenRouteType.WalkingRoute - : navigationType == 3 - ? BMFOpenRouteType.TransitRoute - : BMFOpenRouteType.DrivingRoute, - appScheme: 'baidumapsdk_flutter://mapsdk.baidu.com', - // 指定返回自定义scheme - isSupportWeb: true); - BMFOpenErrorCode flag = - await BMFOpenMapUtils.openBaiduMapRoute(routeOption); - print('open - route - errorCode = $flag'); - } - - updateMapLine(List coordinates, int needHours, int needMinutes, - double needDistance) { - try { - //刪除之前的創建的點和綫 - _mapController.cleanAllMarkers(); - if (polylineId != null) _mapController.removeOverlay(polylineId); - - BMFCoordinate startLocation = - BMFCoordinate(coordinates.first.latitude, coordinates.first.longitude); - - BMFCoordinate endLocation = - BMFCoordinate(coordinates.last.latitude, coordinates.last.longitude); - - /// 创建polyline - BMFPolyline colorsPolyline = BMFPolyline( - // id: polylineOptions.hashCode.toString(), - coordinates: coordinates, - indexs: [0], - textures: [ - navigationType != 4 - ? 'assets/image/traffic_texture_unknown.png' - : 'assets/image/traffic_texture_smooth.png' - ], - width: 16, - lineDashType: BMFLineDashType.LineDashTypeNone, - lineCapType: BMFLineCapType.LineCapButt, - lineJoinType: BMFLineJoinType.LineJoinRound); - polylineId = colorsPolyline.id; - - /// 添加polyline - _mapController.addPolyline(colorsPolyline); - var startBmfMarker = BMFMarker.icon( - position: startLocation, - centerOffset: BMFPoint(0.5, 0.7), - enabled: false, - icon: "assets/image/icon_start.png", - draggable: false, - ); - _mapController.addMarker(startBmfMarker); - - var terminalBmfMarker = BMFMarker.icon( - position: endLocation, - centerOffset: BMFPoint(0.5, 0.7), - enabled: false, - icon: "assets/image/icon_end.png", - draggable: false, - ); - _mapController.addMarker(terminalBmfMarker); - _mapController.setVisibleMapRectWithPadding( - visibleMapBounds: BMFCoordinateBounds( - northeast: startLocation, southwest: endLocation), - animated: true, - insets: EdgeInsets.only( - top: 500, bottom: 200, left: 200, right: 200)); - - hours = needHours == 0 ? "" : "$needHours小时"; - minutes = needMinutes == 0 ? "" : "$needMinutes分钟"; - distance = needDistance; - }finally{ - setState(() {}); - EasyLoading.dismiss(); - } - } - - navigationPosition() async { - EasyLoading.show( - status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); - BMFPlanNode from = BMFPlanNode( - cityName: positionSorta == false ? myCity : (storeInfo?.city ?? ""), - name: positionSorta == false ? myAddress : storeInfo?.address ?? "", - pt: positionSorta == false - ? BMFCoordinate(myLatLng?.latitude ?? 0, myLatLng?.longitude ?? 0) - : latLng); - BMFPlanNode to = BMFPlanNode( - cityName: positionSorta == false ? (storeInfo?.city ?? "") : myCity, - name: positionSorta == false ? (storeInfo?.address ?? "") : myAddress, - pt: positionSorta == false - ? latLng - : BMFCoordinate(myLatLng?.latitude ?? 0, myLatLng?.longitude ?? 0)); - if (navigationType == 1) { - //步行 - BMFWalkingRoutePlanOption walkingRoutePlanOption = - BMFWalkingRoutePlanOption(from: from, to: to); - // 检索实例 - BMFWalkingRouteSearch walkingRouteSearch = BMFWalkingRouteSearch(); - // 检索回调 - walkingRouteSearch.onGetWalkingRouteSearchResult(callback: - (BMFWalkingRouteResult result, BMFSearchErrorCode errorCode) async { - if (errorCode == BMFSearchErrorCode.RESULT_NOT_FOUND) { - SmartDialog.showToast("该方案暂无可用的规划路线", alignment: Alignment.center); - EasyLoading.dismiss(); - return; - } else if (errorCode != BMFSearchErrorCode.NO_ERROR) { - SmartDialog.showToast("获取路线规划失败,请稍后再试", alignment: Alignment.center); - EasyLoading.dismiss(); - return; - } - print( - '`步行检索回调 errorCode = ${errorCode} \n result = ${result?.toMap()}'); - - /// 坐标点 - List coordinates = []; - result.routes.first.steps.forEach((e1) { - e1.points.forEach((e2) { - coordinates.add(BMFCoordinate(e2.latitude, e2.longitude)); - }); - }); - updateMapLine( - coordinates, - result.routes.first.duration.hours, - result.routes.first.duration.minutes, - result.routes.first.distance.toDouble()); - }); - bool flag = - await walkingRouteSearch.walkingRouteSearch(walkingRoutePlanOption); - } else if (navigationType == 2) { - //骑行 - BMFRidingRoutePlanOption ridingRoutePlanOption = - BMFRidingRoutePlanOption(from: from, to: to); - BMFRidingRouteSearch ridingRouteSearch = BMFRidingRouteSearch(); - ridingRouteSearch.onGetRidingRouteSearchResult(callback: - (BMFRidingRouteResult result, BMFSearchErrorCode errorCode) { - if (errorCode == BMFSearchErrorCode.RESULT_NOT_FOUND) { - SmartDialog.showToast("该方案暂无可用的规划路线", alignment: Alignment.center); - EasyLoading.dismiss(); - return; - } else if (errorCode != BMFSearchErrorCode.NO_ERROR) { - SmartDialog.showToast("获取路线规划失败,请稍后再试", alignment: Alignment.center); - EasyLoading.dismiss(); - return; - } - print( - '`骑行检索回调 errorCode = ${errorCode} \n result = ${result?.toMap()}'); - - /// 坐标点 - List coordinates = []; - result.routes.first.steps.forEach((e1) { - e1.points.forEach((e2) { - coordinates.add(BMFCoordinate(e2.latitude, e2.longitude)); - }); - }); - updateMapLine( - coordinates, - result.routes.first.duration.hours, - result.routes.first.duration.minutes, - result.routes.first.distance.toDouble()); - }); -// 发起检索 - bool flag = - await ridingRouteSearch.ridingRouteSearch(ridingRoutePlanOption); - } else if (navigationType == 3) { - //公交 - BMFTransitRoutePlanOption transitRoutePlanOption = - BMFTransitRoutePlanOption(from: from, to: to, city: '武汉市'); - BMFTransitRouteSearch transitRouteSearch = BMFTransitRouteSearch(); - transitRouteSearch.onGetTransitRouteSearchResult(callback: - (BMFTransitRouteResult result, BMFSearchErrorCode errorCode) { - if (errorCode == BMFSearchErrorCode.RESULT_NOT_FOUND) { - SmartDialog.showToast("该方案暂无可用的规划路线", alignment: Alignment.center); - EasyLoading.dismiss(); - return; - } else if (errorCode != BMFSearchErrorCode.NO_ERROR) { - SmartDialog.showToast("获取路线规划失败,请稍后再试", alignment: Alignment.center); - EasyLoading.dismiss(); - return; - } - print( - '`市内公交检索回调 errorCode = ${errorCode} \n result = ${result?.toMap()}'); - - /// 坐标点 - List coordinates = []; - result.routes.first.steps.forEach((e1) { - e1.points.forEach((e2) { - coordinates.add(BMFCoordinate(e2.latitude, e2.longitude)); - }); - }); - updateMapLine( - coordinates, - result.routes.first.duration.hours, - result.routes.first.duration.minutes, - result.routes.first.distance.toDouble()); - }); -// 发起检索 - bool flag = - await transitRouteSearch.transitRouteSearch(transitRoutePlanOption); - } else { - //驾车 - BMFDrivingRoutePlanOption drivingRoutePlanOption = - BMFDrivingRoutePlanOption(from: from, to: to); - BMFDrivingRouteSearch drivingRouteSearch = BMFDrivingRouteSearch(); - drivingRouteSearch.onGetDrivingRouteSearchResult(callback: - (BMFDrivingRouteResult result, BMFSearchErrorCode errorCode) { - if (errorCode == BMFSearchErrorCode.RESULT_NOT_FOUND) { - SmartDialog.showToast("该方案暂无可用的规划路线", alignment: Alignment.center); - EasyLoading.dismiss(); - return; - } else if (errorCode != BMFSearchErrorCode.NO_ERROR) { - SmartDialog.showToast("获取路线规划失败,请稍后再试", alignment: Alignment.center); - EasyLoading.dismiss(); - return; - } - print( - '驾车检索回调 errorCode = ${errorCode} \n result = ${result?.toMap()}'); - - /// 坐标点 - List coordinates = []; - result.routes.first.steps.forEach((e1) { - e1.points.forEach((e2) { - coordinates.add(BMFCoordinate(e2.latitude, e2.longitude)); - }); - }); - updateMapLine( - coordinates, - result.routes.first.duration.hours, - result.routes.first.duration.minutes, - result.routes.first.distance.toDouble()); - }); -// 发起检索 - bool flag = - await drivingRouteSearch.dringRouteSearch(drivingRoutePlanOption); - } - } - - Widget navigationBox() { - return Container( - height: 132.h, - margin: EdgeInsets.only( - top: MediaQuery.of(context).padding.top + 16.h, - left: 14.w, - right: 14.w), - padding: EdgeInsets.only(left: 12.w, right: 18.w, top: 8.h), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Color(0x08213303), - offset: Offset(0, 2), - blurRadius: 4, - spreadRadius: 0, - ), - ], - borderRadius: BorderRadius.circular(6), - ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - navigationState = 0; - }); - }, - child: Padding( - padding: EdgeInsets.only(top: 10.h, right: 10.w), - child: Icon( - Icons.arrow_back_ios, - color: Color(0xFF353535), - size: 24, - ), - ), - ), - Expanded( - child: Column( - children: [ - Container( - width: double.infinity, - decoration: BoxDecoration( - color: Color(0xFFF5F5F5), - borderRadius: BorderRadius.circular(6), - ), - padding: EdgeInsets.only( - top: 12.h, - bottom: 12.h, - left: 15.w, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - bottom: 14.h, - ), - child: Row( - children: [ - Container( - width: 4.h, - height: 4.h, - margin: EdgeInsets.only(right: 20.w), - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(6), - ), - ), - Expanded( - child: Text( - positionSorta == false - ? "我的位置" - : (storeInfo?.storeName ?? ""), - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFF0D0D0D), - fontSize: 14.sp, - fontWeight: MyFontWeight.semi_bold, - ), - )) - ], - ), - ), - Row( - children: [ - Container( - width: 4.h, - height: 4.h, - margin: EdgeInsets.only(right: 20.w), - decoration: BoxDecoration( - color: Color(0xFFFA5151), - borderRadius: BorderRadius.circular(6), - ), - ), - Expanded( - child: Text( - positionSorta == false - ? (storeInfo?.storeName ?? "") - : "我的位置", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFF0D0D0D), - fontSize: 14.sp, - fontWeight: MyFontWeight.semi_bold, - ), - )) - ], - ) - ], - )), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - positionSorta = !positionSorta; - navigationPosition(); - }, - child: Container( - padding: EdgeInsets.only(right: 24.w), - child: Image.asset( - "assets/image/position_sort.webp", - fit: BoxFit.fill, - height: 16.h, - width: 14.w, - ), - ), - ) - ], - ), - ), - SizedBox( - height: 12.h, - ), - Row( - children: [ - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - navigationType = 4; - navigationPosition(); - }, - child: Container( - decoration: BoxDecoration( - color: navigationType == 4 - ? Color(0xFFE8FFF2) - : Colors.transparent, - borderRadius: BorderRadius.circular(23), - ), - padding: - EdgeInsets.symmetric(vertical: 5.h, horizontal: 13.w), - child: Row( - children: [ - if (navigationType == 4) - Image.asset( - "assets/image/icon_drive.webp", - fit: BoxFit.fill, - height: 16.h, - width: 14.w, - ), - Padding( - padding: EdgeInsets.only(left: 2.w), - child: Text( - "驾车", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: navigationType == 4 - ? Color(0xFF32A060) - : Colors.black, - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - ), - ), - ) - ], - ), - ), - )), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - navigationType = 3; - navigationPosition(); - }, - child: Container( - decoration: BoxDecoration( - color: navigationType == 3 - ? Color(0xFFE8FFF2) - : Colors.transparent, - borderRadius: BorderRadius.circular(23), - ), - padding: EdgeInsets.symmetric( - vertical: 5.h, horizontal: 13.w), - child: Row( - children: [ - if (navigationType == 3) - Image.asset( - "assets/image/icon_transit.webp", - fit: BoxFit.fill, - height: 16.h, - width: 14.w, - ), - Padding( - padding: EdgeInsets.only(left: 2.w), - child: Text( - "公交", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: navigationType == 3 - ? Color(0xFF32A060) - : Colors.black, - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - ), - ), - ) - ], - ), - ))), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - navigationType = 2; - navigationPosition(); - }, - child: Container( - decoration: BoxDecoration( - color: navigationType == 2 - ? Color(0xFFE8FFF2) - : Colors.transparent, - borderRadius: BorderRadius.circular(23), - ), - padding: EdgeInsets.symmetric( - vertical: 5.h, horizontal: 13.w), - child: Row( - children: [ - if (navigationType == 2) - Image.asset( - "assets/image/icon_by_bike.webp", - fit: BoxFit.fill, - height: 16.h, - width: 14.w, - ), - Padding( - padding: EdgeInsets.only(left: 2.w), - child: Text( - "骑行", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: navigationType == 2 - ? Color(0xFF32A060) - : Colors.black, - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - ), - ), - ) - ], - ), - ))), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - navigationType = 1; - navigationPosition(); - }, - child: Container( - decoration: BoxDecoration( - color: navigationType == 1 - ? Color(0xFFE8FFF2) - : Colors.transparent, - borderRadius: BorderRadius.circular(23), - ), - padding: EdgeInsets.symmetric( - vertical: 5.h, horizontal: 13.w), - child: Row( - children: [ - if (navigationType == 1) - Image.asset( - "assets/image/icon_walk.webp", - fit: BoxFit.fill, - height: 16.h, - width: 14.w, - ), - Padding( - padding: EdgeInsets.only(left: 2.w), - child: Text( - "步行", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: navigationType == 1 - ? Color(0xFF32A060) - : Colors.black, - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - ), - ), - ) - ], - ), - ))), - ], - ) - ], - )) - ], - ), - ); - } - - Widget navigationDistance() { - return Container( - height: 173.h, - padding: EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Color(0x08213303), - offset: Offset(0, 2), - blurRadius: 4, - spreadRadius: 0, - ), - ], - borderRadius: BorderRadius.vertical( - top: Radius.circular(8), - ), - ), - child: Column( - // mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "${navigationType == 1 ? "步行" : navigationType == 2 ? "骑行" : navigationType == 3 ? "公交" : "驾车"}${(hours ?? "") + (minutes ?? "")}", - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 20.sp, - color: Color(0xFF0D0D0D), - fontWeight: MyFontWeight.bold, - ), - ), - Padding( - padding: EdgeInsets.only(left: 40.w), - child: Text( - (distance ?? 0) > 1000 - ? S.of(context).gongli( - ((distance ?? 0) / 1000 * 100).toInt() / 100.0) - : S - .of(context) - .mi(((distance ?? 0) * 100).toInt() / 100.0), - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 20.sp, - color: Color(0xFF0D0D0D), - fontWeight: MyFontWeight.bold, - ), - ), - ), - ], - ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - navigationState = 1; - onOpenBaiduMapRoute(); - }); - }, - child: Container( - alignment: Alignment.center, - width: double.infinity, - padding: EdgeInsets.symmetric(vertical: 10.h), - margin: EdgeInsets.only(bottom: 30.h), - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(23), - ), - child: Text( - navigationType == 1 - ? "步行导航" - : navigationType == 2 - ? "骑行导航" - : navigationType == 3 - ? "公交导航" - : "驾车导航", - style: TextStyle( - fontSize: 20.sp, - color: Colors.white, - fontWeight: MyFontWeight.medium, - ), - ), - ), - ) - ], - ), - ); - } - - List itemServer(String businessService) { - if (businessService == null || businessService == "") return []; - var list = businessService.split(","); - return list - .map((e) => Container( - margin: EdgeInsets.only(right: 8.w), - child: RoundButton( - height: 17.h * AppUtils.textScale(context), - text: "$e", - backgroup: Color(0xFFFF7A1A), - padding: EdgeInsets.only( - left: 2.w, - right: 2.w, - ), - fontSize: 10.sp, - textColor: Colors.white, - ), - )) - .toList(); - } - - BMFMapController _mapController; - BMFCoordinate latLng; - BMFCoordinate myLatLng; - BMFMarker bmfMarker; - - onMapCreated(BMFMapController controller) { - _mapController = controller; - setState(() { - _mapController.showUserLocation(true); - _mapController.setCustomMapStyle('assets/map_style/chatian.sty', 0); - BMFUserLocationDisplayParam displayParam = BMFUserLocationDisplayParam( - locationViewOffsetX: 0, - locationViewOffsetY: 0, - accuracyCircleFillColor: Colors.red, - accuracyCircleStrokeColor: Colors.blue, - isAccuracyCircleShow: true, - locationViewImage: 'assets/image/icon_my_location.webp', - locationViewHierarchy: - BMFLocationViewHierarchy.LOCATION_VIEW_HIERARCHY_BOTTOM, - ); - _mapController.updateLocationViewWithParam(displayParam); - addMarker(); - }); - } - - addMarker() async { - // latLng = await AppUtils.coordConvert(BMFCoordinate(double.tryParse(widget.arguments["lat"]), - // double.tryParse(widget.arguments["lng"]))); - latLng = BMFCoordinate(double.tryParse(widget.arguments["lat"]), - double.tryParse(widget.arguments["lng"])); - - if (bmfMarker == null && _mapController != null) { - bmfMarker = BMFMarker.icon( - position: latLng, - centerOffset: BMFPoint(0.5, 0.7), - enabled: false, - icon: "assets/image/icon_map_marker.webp", - draggable: false, - ); - _mapController.addMarker(bmfMarker); - } - _mapController.setCenterCoordinate(latLng, true); - } -} From 0e81aed07b9cb206185cd586ca49559748aa9559 Mon Sep 17 00:00:00 2001 From: fmk Date: Tue, 5 Sep 2023 16:33:13 +0800 Subject: [PATCH 23/35] =?UTF-8?q?ios=20=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Podfile | 2 +- ios/Podfile.lock | 29 +++++-------- ios/Runner.xcodeproj/project.pbxproj | 6 +-- lib/union/location_map_page.dart | 17 +++++++- lib/union/union_list.dart | 4 +- pubspec.lock | 65 +++++++++++++++++++++------- pubspec.yaml | 5 ++- 7 files changed, 86 insertions(+), 42 deletions(-) diff --git a/ios/Podfile b/ios/Podfile index ed9a15bc..a6a40c03 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -45,7 +45,7 @@ post_install do |installer| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| config.build_settings['ENABLE_BITCODE'] = 'NO' - config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0' end end end diff --git a/ios/Podfile.lock b/ios/Podfile.lock index d5042f22..7dc542bd 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -45,12 +45,11 @@ PODS: - Flutter - fluwx (0.0.1): - Flutter - - "OpenWeChatSDK (~> 1.9.2+1)" + - mob_sharesdk/ShareSDKPlatforms/WeChatFull - image_pickers (0.0.1): - AFNetworking - Flutter - - SDWebImage - - ZLPhotoBrowser (~> 4.3.9) + - ZLPhotoBrowser-objc (= 1.0.4) - mob_sharesdk (4.4.15): - mob_sharesdk/ShareSDK (= 4.4.15) - MOBFoundation (>= 3.2.9) @@ -143,7 +142,7 @@ PODS: - mob_sharesdk/ShareSDKPlatforms/WatermelonVideo (4.4.15): - mob_sharesdk/ShareSDK - MOBFoundation (>= 3.2.9) - - mob_sharesdk/ShareSDKPlatforms/WeChat_Lite (4.4.15): + - mob_sharesdk/ShareSDKPlatforms/WeChatFull (4.4.15): - mob_sharesdk/ShareSDK - MOBFoundation (>= 3.2.9) - mob_sharesdk/ShareSDKPlatforms/WeWork (4.4.15): @@ -164,7 +163,6 @@ PODS: - MOBFoundation (3.2.49) - number_precision (0.0.1): - Flutter - - "OpenWeChatSDK (1.9.9+1)" - package_info (0.0.1): - Flutter - path_provider (0.0.1): @@ -211,7 +209,7 @@ PODS: - mob_sharesdk/ShareSDKPlatforms/Twitter - mob_sharesdk/ShareSDKPlatforms/VKontakte - mob_sharesdk/ShareSDKPlatforms/WatermelonVideo - - mob_sharesdk/ShareSDKPlatforms/WeChat_Lite + - mob_sharesdk/ShareSDKPlatforms/WeChatFull - mob_sharesdk/ShareSDKPlatforms/WeWork - mob_sharesdk/ShareSDKPlatforms/WhatsApp - mob_sharesdk/ShareSDKPlatforms/Yixin @@ -241,9 +239,8 @@ PODS: - Flutter - webview_flutter (0.0.1): - Flutter - - ZLPhotoBrowser (4.3.9): - - ZLPhotoBrowser/Core (= 4.3.9) - - ZLPhotoBrowser/Core (4.3.9) + - ZLPhotoBrowser-objc (1.0.4): + - SDWebImage DEPENDENCIES: - emoji_picker_flutter (from `.symlinks/plugins/emoji_picker_flutter/ios`) @@ -279,13 +276,12 @@ SPEC REPOS: - BMKLocationKit - mob_sharesdk - MOBFoundation - - OpenWeChatSDK - SDWebImage - SSZipArchive - TPNS-iOS - UMCommon - UMDevice - - ZLPhotoBrowser + - ZLPhotoBrowser-objc EXTERNAL SOURCES: emoji_picker_flutter: @@ -348,19 +344,18 @@ SPEC CHECKSUMS: flutter_baidu_mapapi_search: 13a360334e91abea0bcf820546b2ef4548e42e08 flutter_baidu_mapapi_utils: f6a5d23da26b0e58f1ae9908da7ba87fd48384b1 flutter_bmflocation: 1bd73181196567fe1529f765aa4f8e2615a8a3cf - fluwx: 79c66b6d795ab8208262ada215d9e60388cfe492 - image_pickers: 4406949954a5eb4fac5ada5f13810e6419ef4467 + fluwx: 838466d89c1ba099f6eec36c514801658371cda5 + image_pickers: 25c8916d358bc9d2707cb470ba3d57497f105773 mob_sharesdk: 0698d60b3c1549a5b0bcfdec6f407439dd2960c0 MOBFoundation: 6df2684b4db4f0f5bd71b0623f82e11271bf7ac8 number_precision: 26fa2be2212f9d1429f92d667d6b0aa4df0058d8 - OpenWeChatSDK: ea48e9db20645f78128db9091893910280b8e4b1 package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 path_provider: f96fff6166a8867510d2c25fdcc346327cc4b259 permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 scan: aea35bb4aa59ccc8839c576a18cd57c7d492cc86 SDWebImage: e5cc87bf736e60f49592f307bdf9e157189298a3 shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472 - sharesdk_plugin: 7e8abfa7c4aa4c20d94e0a162406ba79a971f2ca + sharesdk_plugin: b105d82bed39e1d229591999058ab1e12ff95001 SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef thumbnails: bb4f4e9bb4b51c8ae4e6ad9a2fa81373f9b634ad tobias: 2aded9b83e3663b907360a800d8e3c13284f25c5 @@ -373,8 +368,8 @@ SPEC CHECKSUMS: video_player_avfoundation: 6d971a232d72e6ee25368378d48a079dea01f1cf wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f webview_flutter: 5fb4def2bbd4339889ee14d045b605cefc5bc232 - ZLPhotoBrowser: 02b3569b8f702d2e153e8fdb1f6b32fef3a2867c + ZLPhotoBrowser-objc: c7657d3bc85ae231884e058d0e3638f619164736 -PODFILE CHECKSUM: f4ea28c741a7c9a1c417c066f9cfd7b29654dd12 +PODFILE CHECKSUM: f8bac8842dd5d4f36a3709c129ae7a2ccd5be619 COCOAPODS: 1.11.3 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index a8a9508a..38e89163 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -617,7 +617,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -819,7 +819,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -912,7 +912,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index 1ae4158a..59967a37 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:io'; import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; @@ -162,7 +163,19 @@ class _LocationMap extends State with WidgetsBindingObserver { Expanded( child: Container( //BMFMapWidget 组件会自动默认沾满全屏,并且挡住所有遮盖物 ,BMFTextureMapWidget不会强制遮盖其他控件。 - child: BMFTextureMapWidget( + child: (Platform.isAndroid) ? BMFTextureMapWidget( + mapOptions: BMFMapOptions( + center: BMFCoordinate( + double.tryParse(widget.arguments["lat"]), + double.tryParse(widget.arguments["lng"]), + ), + showZoomControl: false, + showMapScaleBar: false, + rotateEnabled: false, + zoomLevel: 15, + ), + onBMFMapCreated: onMapCreated, + ) : BMFMapWidget( mapOptions: BMFMapOptions( center: BMFCoordinate( double.tryParse(widget.arguments["lat"]), @@ -460,7 +473,7 @@ class _LocationMap extends State with WidgetsBindingObserver { ? 'assets/image/traffic_texture_unknown.png' : 'assets/image/traffic_texture_smooth.png' ], - width: 16, + width: 16.w.toInt(), lineDashType: BMFLineDashType.LineDashTypeNone, lineCapType: BMFLineCapType.LineCapButt, lineJoinType: BMFLineJoinType.LineJoinRound); diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index d0a4448f..6361a568 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -195,7 +195,7 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { Widget buildStoreItem(Store store, position) { return Container( margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 12.h), - padding: EdgeInsets.all(12.h), + padding: EdgeInsets.symmetric(horizontal:12.w,vertical: 12.h), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(6)), @@ -307,7 +307,7 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { SizedBox(height: store.businessService == "" ? 40.h : 23.h), if (storeList[position].productShow != null) Container( - height: 120.h, + height: 100.h, child: ListView.builder( padding: EdgeInsets.zero, itemCount: diff --git a/pubspec.lock b/pubspec.lock index 3fa22321..2da24db9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -215,7 +215,7 @@ packages: name: flutter_easyloading url: "https://pub.flutter-io.cn" source: hosted - version: "3.0.0" + version: "3.0.5" flutter_html: dependency: "direct main" description: @@ -269,7 +269,7 @@ packages: name: flutter_slidable url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0" + version: "1.3.2" flutter_smart_dialog: dependency: "direct main" description: @@ -283,14 +283,14 @@ packages: name: flutter_spinkit url: "https://pub.flutter-io.cn" source: hosted - version: "5.0.0" + version: "5.2.0" flutter_staggered_grid_view: dependency: "direct main" description: name: flutter_staggered_grid_view url: "https://pub.flutter-io.cn" source: hosted - version: "0.4.0" + version: "0.4.1" flutter_svg: dependency: "direct main" description: @@ -328,7 +328,7 @@ packages: name: font_awesome_flutter url: "https://pub.flutter-io.cn" source: hosted - version: "9.1.0" + version: "9.2.0" gbk2utf8: dependency: "direct main" description: @@ -405,14 +405,14 @@ packages: name: like_button url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.2" + version: "2.0.5" logger: dependency: "direct main" description: name: logger url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.0" + version: "1.4.0" matcher: dependency: transitive description: @@ -531,7 +531,7 @@ packages: name: permission_handler url: "https://pub.flutter-io.cn" source: hosted - version: "5.0.1+1" + version: "5.1.0+2" permission_handler_platform_interface: dependency: transitive description: @@ -559,7 +559,7 @@ packages: name: pin_input_text_field url: "https://pub.flutter-io.cn" source: hosted - version: "4.1.2" + version: "4.4.1" platform: dependency: transitive description: @@ -643,7 +643,7 @@ packages: name: scan url: "https://pub.flutter-io.cn" source: hosted - version: "1.5.0" + version: "1.6.0" shared_preferences: dependency: "direct main" description: @@ -699,7 +699,7 @@ packages: name: sharesdk_plugin url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.4" + version: "1.3.10" shimmer: dependency: "direct main" description: @@ -781,13 +781,13 @@ packages: name: tobias url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.1" + version: "2.4.2" tpns_flutter_plugin: dependency: "direct main" description: path: "." ref: "V1.1.6" - resolved-ref: c21ce8a966f9238a5bf70a617c30468b79baa5a7 + resolved-ref: a7e45d151171f9ec4b56bc97a720f545aa4a8722 url: "https://github.com/TencentCloud/TPNS-Flutter-Plugin" source: git version: "1.1.6" @@ -818,14 +818,49 @@ packages: name: umeng_common_sdk url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.3" + version: "1.2.6" url_launcher: dependency: "direct main" description: name: url_launcher url: "https://pub.flutter-io.cn" source: hosted - version: "5.0.0" + version: "5.7.10" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.0.1+4" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.0.1+9" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.9" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.5+3" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.0.1+3" vector_math: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index c3ac0772..a5850713 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,8 @@ dependencies: sdk: flutter fluwx: 3.9.0+2 - tobias: 2.4.1 + tobias: ^2.4.1 + gradient_widgets: ^0.6.0 @@ -67,7 +68,7 @@ dependencies: url_launcher: ^5.0.0 #多图, 裁剪 - image_pickers: ^2.0.0 + image_pickers: 2.0.0 # flutter_scankit: ^1.2.0 # qrscan: ^0.3.1 From 1a0c6f7282d1ec09d2dbd4dde925b15c33636b5e Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Tue, 5 Sep 2023 16:34:23 +0800 Subject: [PATCH 24/35] =?UTF-8?q?=E8=81=94=E7=9B=9F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9B=20=E8=B7=AF=E5=BE=84=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/store/store_view/store_info.dart | 4 ++-- lib/union/location_map_page.dart | 20 +++++++++++++++++--- lib/union/union_list.dart | 10 +++++----- lib/union/union_page.dart | 1 - 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/lib/store/store_view/store_info.dart b/lib/store/store_view/store_info.dart index afcbc336..5aff71d7 100644 --- a/lib/store/store_view/store_info.dart +++ b/lib/store/store_view/store_info.dart @@ -298,8 +298,8 @@ class _StoreInfoView extends State { text: "$e", backgroup: Color(0xFFFF7A1A), padding: EdgeInsets.only( - left: 2.w, - right: 2.w, + left: 4.w, + right: 4.w, ), fontSize: 10.sp, textColor: Colors.white, diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index 1ae4158a..dde6fbe5 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:io'; import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; @@ -162,7 +163,7 @@ class _LocationMap extends State with WidgetsBindingObserver { Expanded( child: Container( //BMFMapWidget 组件会自动默认沾满全屏,并且挡住所有遮盖物 ,BMFTextureMapWidget不会强制遮盖其他控件。 - child: BMFTextureMapWidget( + child: (Platform.isAndroid) ? BMFTextureMapWidget( mapOptions: BMFMapOptions( center: BMFCoordinate( double.tryParse(widget.arguments["lat"]), @@ -174,7 +175,20 @@ class _LocationMap extends State with WidgetsBindingObserver { zoomLevel: 15, ), onBMFMapCreated: onMapCreated, - )), + ) : + BMFMapWidget( + mapOptions: BMFMapOptions( + center: BMFCoordinate( + double.tryParse(widget.arguments["lat"]), + double.tryParse(widget.arguments["lng"]), + ), + showZoomControl: false, + showMapScaleBar: false, + rotateEnabled: false, + zoomLevel: 15, + ), + onBMFMapCreated: onMapCreated, + )), flex: 3, ), navigationState == 0 @@ -460,7 +474,7 @@ class _LocationMap extends State with WidgetsBindingObserver { ? 'assets/image/traffic_texture_unknown.png' : 'assets/image/traffic_texture_smooth.png' ], - width: 16, + width: 16.w.toInt(), lineDashType: BMFLineDashType.LineDashTypeNone, lineCapType: BMFLineCapType.LineCapButt, lineJoinType: BMFLineJoinType.LineJoinRound); diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index d0a4448f..d4d4ed08 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -195,7 +195,7 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { Widget buildStoreItem(Store store, position) { return Container( margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 12.h), - padding: EdgeInsets.all(12.h), + padding: EdgeInsets.symmetric(horizontal:12.w,vertical: 12.h), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(6)), @@ -208,7 +208,6 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { ) ]), width: double.infinity, - // height: 235.h, child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -307,7 +306,7 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { SizedBox(height: store.businessService == "" ? 40.h : 23.h), if (storeList[position].productShow != null) Container( - height: 120.h, + height: 100.h, child: ListView.builder( padding: EdgeInsets.zero, itemCount: @@ -343,9 +342,9 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { child: Container( decoration: BoxDecoration( color: Color(0xFFF65720), - borderRadius: BorderRadius.circular(1), + borderRadius: BorderRadius.circular(2), ), - padding: EdgeInsets.all(2), + padding: EdgeInsets.symmetric(vertical:2.h,horizontal:3.w), margin: EdgeInsets.only(right: 10.w), child: Text( "$e", @@ -365,6 +364,7 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { width: 74.h, margin: EdgeInsets.only(right: 8.w), child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ MImage( diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 3bcb69bd..d1cb3c36 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -109,7 +109,6 @@ class UnionPageState extends State } }); queryIpInfo(); - // loadFinish(showLoading: false); } startLocation() async { From ed2fa1640969bbfacce4eb7578486102eff1eb79 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Tue, 5 Sep 2023 20:41:28 +0800 Subject: [PATCH 25/35] =?UTF-8?q?=E7=BC=A9=E6=94=BE=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/union/location_map_page.dart | 76 +++++++++++++++++++------------- 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index dde6fbe5..17e5c619 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -163,32 +163,33 @@ class _LocationMap extends State with WidgetsBindingObserver { Expanded( child: Container( //BMFMapWidget 组件会自动默认沾满全屏,并且挡住所有遮盖物 ,BMFTextureMapWidget不会强制遮盖其他控件。 - child: (Platform.isAndroid) ? BMFTextureMapWidget( - mapOptions: BMFMapOptions( - center: BMFCoordinate( - double.tryParse(widget.arguments["lat"]), - double.tryParse(widget.arguments["lng"]), - ), - showZoomControl: false, - showMapScaleBar: false, - rotateEnabled: false, - zoomLevel: 15, - ), - onBMFMapCreated: onMapCreated, - ) : - BMFMapWidget( - mapOptions: BMFMapOptions( - center: BMFCoordinate( - double.tryParse(widget.arguments["lat"]), - double.tryParse(widget.arguments["lng"]), - ), - showZoomControl: false, - showMapScaleBar: false, - rotateEnabled: false, - zoomLevel: 15, - ), - onBMFMapCreated: onMapCreated, - )), + child: (Platform.isAndroid) + ? BMFTextureMapWidget( + mapOptions: BMFMapOptions( + center: BMFCoordinate( + double.tryParse(widget.arguments["lat"]), + double.tryParse(widget.arguments["lng"]), + ), + showZoomControl: false, + showMapScaleBar: false, + rotateEnabled: false, + zoomLevel: 15, + ), + onBMFMapCreated: onMapCreated, + ) + : BMFMapWidget( + mapOptions: BMFMapOptions( + center: BMFCoordinate( + double.tryParse(widget.arguments["lat"]), + double.tryParse(widget.arguments["lng"]), + ), + showZoomControl: false, + showMapScaleBar: false, + rotateEnabled: false, + zoomLevel: 15, + ), + onBMFMapCreated: onMapCreated, + )), flex: 3, ), navigationState == 0 @@ -306,8 +307,9 @@ class _LocationMap extends State with WidgetsBindingObserver { onTap: () { if (myCity == null) { // onOpenBaiduMap(); - SmartDialog.showToast("您定位服务未开启,请前往系统设置中开启定位服务", - alignment: Alignment.center); + SmartDialog.showToast( + "您定位服务未开启,请前往系统设置中开启定位服务", + alignment: Alignment.center); } else { navigationState = 1; if ((distance ?? 0) < 500) @@ -408,7 +410,8 @@ class _LocationMap extends State with WidgetsBindingObserver { } void onOpenBaiduMap() async { - launch("baidumap://map/marker?location=${storeInfo.latitude},${storeInfo.longitude}&title=${storeInfo.storeName}&content=${storeInfo.storeName}&traffic=on&src=andr.baidu.openAPIdemo&coord_type=gcj02"); + launch( + "baidumap://map/marker?location=${storeInfo.latitude},${storeInfo.longitude}&title=${storeInfo.storeName}&content=${storeInfo.storeName}&traffic=on&src=andr.baidu.openAPIdemo&coord_type=gcj02"); } //調取百度地圖APP @@ -452,7 +455,7 @@ class _LocationMap extends State with WidgetsBindingObserver { } updateMapLine(List coordinates, int needHours, int needMinutes, - double needDistance) { + double needDistance) async { try { //刪除之前的創建的點和綫 _mapController.cleanAllMarkers(); @@ -499,12 +502,23 @@ class _LocationMap extends State with WidgetsBindingObserver { draggable: false, ); _mapController.addMarker(terminalBmfMarker); - _mapController.setVisibleMapRectWithPadding( + SmartDialog.showToast( + "${startLocation.longitude} ${startLocation.latitude} ${endLocation.longitude} ${endLocation.latitude}", + alignment: Alignment.center); + bool tryFlag = await _mapController.setVisibleMapRectWithPadding( visibleMapBounds: BMFCoordinateBounds( northeast: startLocation, southwest: endLocation), animated: true, insets: EdgeInsets.only(top: 500, bottom: 200, left: 200, right: 200)); + if (!tryFlag) { + tryFlag = await _mapController.setVisibleMapBounds( + BMFCoordinateBounds(northeast: startLocation, southwest: endLocation), + true, + ); + if (!tryFlag) + SmartDialog.showToast("还是不行", alignment: Alignment.center); + } hours = needHours == 0 ? "" : "$needHours小时"; minutes = needMinutes == 0 ? "" : "$needMinutes分钟"; From 63d9c005170af246c70f455a2dd8d4e9c2907263 Mon Sep 17 00:00:00 2001 From: fmk Date: Tue, 5 Sep 2023 20:42:52 +0800 Subject: [PATCH 26/35] =?UTF-8?q?ios=20=E7=99=BE=E5=BA=A6=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- ios/Runner/Info.plist | 6 ++++++ lib/union/location_map_page.dart | 2 +- lib/union/union_list.dart | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 38e89163..7e315834 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -617,7 +617,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -819,7 +819,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -912,7 +912,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index e12a98a1..173f6c23 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -177,5 +177,11 @@ location + LSApplicationQueriesSchemes + + iosamap + qqmap + baidumap + diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index 59967a37..3955a9b7 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -473,7 +473,7 @@ class _LocationMap extends State with WidgetsBindingObserver { ? 'assets/image/traffic_texture_unknown.png' : 'assets/image/traffic_texture_smooth.png' ], - width: 16.w.toInt(), + width: Platform.isAndroid ? 16 :10, lineDashType: BMFLineDashType.LineDashTypeNone, lineCapType: BMFLineCapType.LineCapButt, lineJoinType: BMFLineJoinType.LineJoinRound); diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index 6361a568..2c1d685e 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -316,7 +316,7 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { : storeList[position].productShow?.length ?? 0, scrollDirection: Axis.horizontal, shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), + physics:BouncingScrollPhysics(), itemBuilder: (context, index) { return GestureDetector( onTap: () {}, From a6e374c034b5344c6d798869990af70ef05092c8 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Tue, 5 Sep 2023 22:02:43 +0800 Subject: [PATCH 27/35] =?UTF-8?q?=E7=BC=A9=E6=94=BE=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/union/location_map_page.dart | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index 17e5c619..e145f69a 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -502,23 +502,12 @@ class _LocationMap extends State with WidgetsBindingObserver { draggable: false, ); _mapController.addMarker(terminalBmfMarker); - SmartDialog.showToast( - "${startLocation.longitude} ${startLocation.latitude} ${endLocation.longitude} ${endLocation.latitude}", - alignment: Alignment.center); - bool tryFlag = await _mapController.setVisibleMapRectWithPadding( - visibleMapBounds: BMFCoordinateBounds( + await _mapController.setVisibleMapBounds( + BMFCoordinateBounds( northeast: startLocation, southwest: endLocation), - animated: true, - insets: - EdgeInsets.only(top: 500, bottom: 200, left: 200, right: 200)); - if (!tryFlag) { - tryFlag = await _mapController.setVisibleMapBounds( - BMFCoordinateBounds(northeast: startLocation, southwest: endLocation), - true, - ); - if (!tryFlag) - SmartDialog.showToast("还是不行", alignment: Alignment.center); - } + true,); + _mapController.setZoomBy(-1); + _mapController.setScrollBy(0,-200); hours = needHours == 0 ? "" : "$needHours小时"; minutes = needMinutes == 0 ? "" : "$needMinutes分钟"; From 0c0e76f0186efc7fd18d57e29c32e2c23343045d Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Tue, 5 Sep 2023 22:45:06 +0800 Subject: [PATCH 28/35] =?UTF-8?q?=E7=BC=A9=E6=94=BE=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/union/location_map_page.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index e145f69a..4ec95009 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -455,7 +455,7 @@ class _LocationMap extends State with WidgetsBindingObserver { } updateMapLine(List coordinates, int needHours, int needMinutes, - double needDistance) async { + double needDistance) { try { //刪除之前的創建的點和綫 _mapController.cleanAllMarkers(); @@ -502,12 +502,12 @@ class _LocationMap extends State with WidgetsBindingObserver { draggable: false, ); _mapController.addMarker(terminalBmfMarker); - await _mapController.setVisibleMapBounds( - BMFCoordinateBounds( + _mapController.setVisibleMapRectWithPadding( + visibleMapBounds: BMFCoordinateBounds( northeast: startLocation, southwest: endLocation), - true,); - _mapController.setZoomBy(-1); - _mapController.setScrollBy(0,-200); + animated: true, + insets: + EdgeInsets.only(top: 500.h, bottom: 200.h, left: 200.w, right: 200.w)); hours = needHours == 0 ? "" : "$needHours小时"; minutes = needMinutes == 0 ? "" : "$needMinutes分钟"; From 99e5f8406e3ab872e6613a3e75415da0547f06af Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Wed, 6 Sep 2023 00:27:13 +0800 Subject: [PATCH 29/35] =?UTF-8?q?=E9=97=A8=E5=BA=97=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=BA=8B=E4=BB=B6=E7=9A=84=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/store/store_order.dart | 47 ++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 0dae970d..b56907f8 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -97,7 +97,9 @@ class _StoreOrderPage extends State /// 小程序登录 minLogin(SharedPreferences shared) async { - EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); + EasyLoading.show( + status: S.of(context).zhengzaijiazai, + maskType: EasyLoadingMaskType.black); apiService = ApiService( Dio(), context: context, @@ -127,7 +129,6 @@ class _StoreOrderPage extends State storeId: storeId, ); - queryMemberInfo(); queryShopCar().then((value) { @@ -244,7 +245,7 @@ class _StoreOrderPage extends State context), sliver: SliverAppBar( expandedHeight: (storeInfo != null && - storeInfo.couponVOList != null) + storeInfo.couponVOList != null) ? 400.h : 395.h, floating: false, @@ -327,7 +328,10 @@ class _StoreOrderPage extends State CrossAxisAlignment.start, children: [ ///门店信息 - StoreInfoView(storeInfo,widget.arguments["distance"],), + StoreInfoView( + storeInfo, + widget.arguments["distance"], + ), // Padding(padding:EdgeInsets.only(left: 14.w), // child: Text( // S.of(context).diandan, @@ -655,7 +659,7 @@ class _StoreOrderPage extends State "shoppingCart": shopCarGoods, "numberOfPeople": numberOfPeople, "distance": widget.arguments["distance"], - "vipLevelName": memberVo?.memberRankVo?.rankName ??"", + "vipLevelName": memberVo?.memberRankVo?.rankName ?? "", "isVips": memberVo?.isVip ?? false, "subscribeParam": miNiDetail?.subscribeParam, }, @@ -753,7 +757,8 @@ class _StoreOrderPage extends State ///选规格 _queryMiNiDetail(String id, int count) async { - EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); + EasyLoading.show( + status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); if (count < 0) { shopCarGoods.shoppingCartSkuItemList.forEach((element) async { if (element.productId == id) { @@ -1054,17 +1059,17 @@ class _Title extends State { double maxScrollExtent = widget.controller.position.maxScrollExtent; double alphaHeight = (kToolbarHeight) / 2; double alphaProgress = maxScrollExtent - widget.controller.offset; - double alphatemp = 0; + double alphaTemp = 0; if (alphaProgress <= 1) { - alphatemp = 1; + alphaTemp = 1; } else if (alphaProgress <= alphaHeight) { - alphatemp = + alphaTemp = (((alphaHeight - alphaProgress) / alphaHeight) > 0.5) ? 1 : 0; } else { - alphatemp = 0; + alphaTemp = 0; } - if (alpha != alphatemp && mounted) { - alpha = alphatemp; + if (alpha != alphaTemp && mounted) { + alpha = alphaTemp; print("object: $alpha"); widget.scrollChange(alpha); setState(() {}); @@ -1076,14 +1081,16 @@ class _Title extends State<Title> { Widget build(BuildContext context) { return Container( margin: EdgeInsets.only(bottom: 38.h), - child: Text( - widget.title ?? "", - style: TextStyle( - color: Colors.black.withOpacity(alpha), - fontWeight: FontWeight.bold, - fontSize: 18.sp, - ), - ), + child: alpha == 0 + ? null + : Text( + widget.title ?? "", + style: TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 18.sp, + ), + ), ); } } From f8ebb86abd8a48661a8eb4c07b04a03d2006fbc7 Mon Sep 17 00:00:00 2001 From: fmk <fengmeikan@hotmail.com> Date: Wed, 6 Sep 2023 00:29:57 +0800 Subject: [PATCH 30/35] =?UTF-8?q?ios=20=E7=99=BE=E5=BA=A6=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E8=B7=AF=E5=BE=84=E7=9A=84=E6=98=BE=E7=A4=BA=EF=BC=9B?= =?UTF-8?q?=20=E9=97=A8=E5=BA=97=E5=88=97=E8=A1=A8=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=9A=84=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/union/location_map_page.dart | 2 +- lib/union/union_page.dart | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index 8becd164..52c6e762 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -507,7 +507,7 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver { northeast: startLocation, southwest: endLocation), animated: true, insets: - EdgeInsets.only(top: 500.h, bottom: 200.h, left: 200.w, right: 200.w)); + EdgeInsets.only(top: Platform.isAndroid?500.h:150.h, bottom: Platform.isAndroid?200.h:50.h)); hours = needHours == 0 ? "" : "$needHours小时"; minutes = needMinutes == 0 ? "" : "$needMinutes分钟"; diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index d1cb3c36..204d3f89 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -72,7 +72,7 @@ class UnionPageState extends State<UnionPage> } void permissionSettings() async { - if (await Permission.location.isGranted){ + if (_isShowLocalTips && await Permission.location.isGranted){ _isShowLocalTips = false; startLocation(); } @@ -111,7 +111,10 @@ class UnionPageState extends State<UnionPage> queryIpInfo(); } - startLocation() async { + startLocation({bool showLoading = true}) async { + if(showLoading) + EasyLoading.show( + status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); bool powerFlag = false; // bool finallyFlag = false; try { @@ -184,7 +187,7 @@ class UnionPageState extends State<UnionPage> areaName = baseData.city.replaceAll("市", ""); } } finally { - startLocation(); + startLocation(showLoading: false); } } From 9583968a565b01ec1902b44791d18daaa11b48bd Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Wed, 6 Sep 2023 10:52:03 +0800 Subject: [PATCH 31/35] =?UTF-8?q?=E8=B7=AF=E5=BE=84=E4=B8=8D=E6=A0=B9?= =?UTF-8?q?=E6=8D=AEPadding=E5=B1=9E=E6=80=A7=E6=9B=B4=E6=94=B9=EF=BC=8C?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E6=A0=B9=E6=8D=AEx=E8=BD=B4=E5=92=8Cy?= =?UTF-8?q?=E8=BD=B4=E7=9A=84=E6=9E=81=E5=80=BC=E5=B7=AE=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E5=87=BA=E8=B7=AF=E5=BE=84=E8=8C=83=E5=9B=B4=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/union/location_map_page.dart | 44 ++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index 4ec95009..2d0eaff1 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -461,12 +461,6 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver { _mapController.cleanAllMarkers(); if (polylineId != null) _mapController.removeOverlay(polylineId); - BMFCoordinate startLocation = BMFCoordinate( - coordinates.first.latitude, coordinates.first.longitude); - - BMFCoordinate endLocation = - BMFCoordinate(coordinates.last.latitude, coordinates.last.longitude); - /// 创建polyline BMFPolyline colorsPolyline = BMFPolyline( // id: polylineOptions.hashCode.toString(), @@ -486,7 +480,8 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver { /// 添加polyline _mapController.addPolyline(colorsPolyline); var startBmfMarker = BMFMarker.icon( - position: startLocation, + position: BMFCoordinate( + coordinates.first.latitude, coordinates.first.longitude), centerOffset: BMFPoint(0.5, 0.7), enabled: false, icon: "assets/image/icon_start.png", @@ -495,19 +490,40 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver { _mapController.addMarker(startBmfMarker); var terminalBmfMarker = BMFMarker.icon( - position: endLocation, + position: BMFCoordinate( + coordinates.last.latitude, coordinates.last.longitude), centerOffset: BMFPoint(0.5, 0.7), enabled: false, icon: "assets/image/icon_end.png", draggable: false, ); _mapController.addMarker(terminalBmfMarker); - _mapController.setVisibleMapRectWithPadding( - visibleMapBounds: BMFCoordinateBounds( - northeast: startLocation, southwest: endLocation), - animated: true, - insets: - EdgeInsets.only(top: 500.h, bottom: 200.h, left: 200.w, right: 200.w)); + + double maxLatitude = 0, + minLatitude = 0, + maxLongitude = 0, + minLongitude = 0; + coordinates.forEach((element) { + if (element.latitude > maxLatitude) maxLatitude = element.latitude; + if (minLatitude == 0) + minLatitude = element.latitude; + else if (element.latitude < minLatitude) minLatitude = element.latitude; + + if (element.longitude > maxLongitude) maxLongitude = element.longitude; + if (minLongitude == 0) + minLongitude = element.longitude; + else if (element.longitude < minLongitude) + minLongitude = element.longitude; + }); + _mapController.setVisibleMapBounds( + BMFCoordinateBounds( + northeast: BMFCoordinate( + maxLatitude + ((maxLatitude - minLatitude) * 0.8), + maxLongitude + ((maxLongitude - minLongitude) / 2)), + southwest: BMFCoordinate( + minLatitude - ((maxLatitude - minLatitude) * 0.2), + minLongitude - ((maxLongitude - minLongitude) / 2))), + true); hours = needHours == 0 ? "" : "$needHours小时"; minutes = needMinutes == 0 ? "" : "$needMinutes分钟"; From 30f3eb690fdfbab46de5695e490dbd4dc768667b Mon Sep 17 00:00:00 2001 From: fmk <fengmeikan@hotmail.com> Date: Wed, 6 Sep 2023 21:24:04 +0800 Subject: [PATCH 32/35] ios --- lib/union/union_list.dart | 32 ++++++++++++++------------------ lib/union/union_page.dart | 8 ++++---- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index 6e554855..111b6821 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -303,6 +303,7 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin { children: []..addAll( itemServer(store != null ? store.businessService : "")), ), + if (storeList[position].productShow != null) SizedBox(height: store.businessService == "" ? 40.h : 23.h), if (storeList[position].productShow != null) Container( @@ -338,24 +339,19 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin { var list = businessService.split(","); return list .map((e) => Container( - margin: EdgeInsets.only(right: 8.w), - child: Container( - decoration: BoxDecoration( - color: Color(0xFFF65720), - borderRadius: BorderRadius.circular(2), - ), - padding: EdgeInsets.symmetric(vertical:2.h,horizontal:3.w), - margin: EdgeInsets.only(right: 10.w), - child: Text( - "$e", - style: TextStyle( - color: Colors.white, - fontSize: 10.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ), - )) + margin: EdgeInsets.only(right: 8.w), + child: RoundButton( + height: 17.h * AppUtils.textScale(context), + text: "$e", + backgroup: Color(0xFFF65720), + padding: EdgeInsets.only( + left: 4.w, + right: 4.w, + ), + fontSize: 10.sp, + textColor: Colors.white, + ), + )) .toList(); } diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 204d3f89..0a1de5a6 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -74,7 +74,7 @@ class UnionPageState extends State<UnionPage> void permissionSettings() async { if (_isShowLocalTips && await Permission.location.isGranted){ _isShowLocalTips = false; - startLocation(); + getLocation(); } } @@ -111,7 +111,7 @@ class UnionPageState extends State<UnionPage> queryIpInfo(); } - startLocation({bool showLoading = true}) async { + getLocation({bool showLoading = true}) async { if(showLoading) EasyLoading.show( status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); @@ -147,7 +147,7 @@ class UnionPageState extends State<UnionPage> // finallyFlag = true; if (!powerFlag) { if (await Permission.locationWhenInUse.status.isGranted) { - startLocation(); + getLocation(); } else { _isShowLocalTips = true; loadFinish(showLoading: false); @@ -187,7 +187,7 @@ class UnionPageState extends State<UnionPage> areaName = baseData.city.replaceAll("市", ""); } } finally { - startLocation(showLoading: false); + getLocation(showLoading: false); } } From 2b2dcd215b71161f8e509f375f202c0c1c653b94 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Wed, 6 Sep 2023 22:11:19 +0800 Subject: [PATCH 33/35] =?UTF-8?q?=E5=89=8D=E5=90=8E=E5=8F=B0=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E7=9B=91=E5=90=AC=E6=B7=B7=E6=B7=86=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/union/location_map_page.dart | 4 ++-- lib/union/union_page.dart | 14 ++++++++++++-- pubspec.lock | 9 ++++++++- pubspec.yaml | 4 +++- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index 819eda41..311fb466 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -138,7 +138,7 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver { } void permissionSettings() async { - if (await Permission.location.isGranted) { + if (_isShowLocalTips && await Permission.location.isGranted) { _isShowLocalTips = false; getLocation(); } @@ -305,7 +305,7 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver { GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - if (myCity == null) { + if (myLatLng == null) { // onOpenBaiduMap(); SmartDialog.showToast( "您定位服务未开启,请前往系统设置中开启定位服务", diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 0a1de5a6..c8158739 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -20,6 +20,7 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; +import 'package:visibility_detector/visibility_detector.dart'; import '../view_widget/location_tips.dart'; import '../view_widget/no_data_view.dart'; @@ -47,6 +48,7 @@ class UnionPageState extends State<UnionPage> String areaName; List<GlobalKey> _allKey = []; bool _isShowLocalTips = false; + double visiblePercentage; jumpIndex(jpIndex) { tabController.index = jpIndex; @@ -65,6 +67,7 @@ class UnionPageState extends State<UnionPage> void didChangeAppLifecycleState(AppLifecycleState state) { if (state == AppLifecycleState.resumed) { // 处理应用程序切换回前台的逻辑 + if(visiblePercentage == 1) permissionSettings(); } else if (state == AppLifecycleState.paused) { // 处理应用程序切换到后台的逻辑 @@ -203,7 +206,14 @@ class UnionPageState extends State<UnionPage> @override Widget build(BuildContext context) { super.build(context); - return GestureDetector( + return VisibilityDetector( + key: Key('my-widget-key'), + onVisibilityChanged: (visibilityInfo) { + visiblePercentage = visibilityInfo.visibleFraction; + if(visiblePercentage == 1) + permissionSettings(); + }, + child: GestureDetector( behavior: HitTestBehavior.translucent, onTap: () { FocusScope.of(context).requestFocus(FocusNode()); @@ -337,7 +347,7 @@ class UnionPageState extends State<UnionPage> ) ], ), - ); + )); } Widget buildSearchItem() { diff --git a/pubspec.lock b/pubspec.lock index 2da24db9..be43806d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -781,7 +781,7 @@ packages: name: tobias url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.2" + version: "2.4.1" tpns_flutter_plugin: dependency: "direct main" description: @@ -903,6 +903,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.0.15" + visibility_detector: + dependency: "direct main" + description: + name: visibility_detector + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.3" wakelock: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index a5850713..d654b60b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: sdk: flutter fluwx: 3.9.0+2 - tobias: ^2.4.1 + tobias: 2.4.1 gradient_widgets: ^0.6.0 @@ -58,6 +58,8 @@ dependencies: gbk2utf8: ^1.0.1 + visibility_detector: ^0.3.3 + event_bus: ^2.0.0 intl: ^0.17.0 shared_preferences: ^2.0.6 From b2d9062f93be378810fadf77e99ee46501dbd61e Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Fri, 8 Sep 2023 17:44:47 +0800 Subject: [PATCH 34/35] =?UTF-8?q?1.=E5=95=86=E6=88=B7=E5=85=85=E5=80=BC?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=E9=99=90=E5=88=B6=E6=9B=B4=E6=94=B9=EF=BC=9B?= =?UTF-8?q?=202.=E9=97=A8=E5=BA=97=E5=88=97=E8=A1=A8=E6=97=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=97=B6=E6=98=BE=E7=A4=BA=EF=BC=8C=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E5=85=AC=E5=8F=B8=E5=B7=B2=E6=9C=89=E4=B8=89=E4=B8=AA=E5=9F=8E?= =?UTF-8?q?=E5=B8=82=E8=AE=BE=E7=BD=AE=EF=BC=8Cip=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E8=B6=85=E5=87=BA=E5=85=AC=E5=8F=B8=E6=89=80=E5=9C=A8=E5=9F=8E?= =?UTF-8?q?=E5=B8=82=E5=A4=96=EF=BC=8C=E6=98=BE=E7=A4=BA=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96=EF=BC=8C?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E9=80=89=E6=8B=A9=E6=9B=B4=E6=94=B9=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=9B=203.=E5=9C=B0=E5=9B=BE=E5=9D=90=E6=A0=87?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=9B=B4=E6=94=B9=EF=BC=8C=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AB=AF=E6=98=AF=EF=BC=9A=E9=AB=98=E5=BE=B7=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E5=9D=90=E6=A0=87=EF=BC=8C=E6=95=85=E5=BA=94=E7=94=A8=E7=AB=AF?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E8=AF=A5=E5=9D=90=E6=A0=87=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E4=B8=BA=E7=99=BE=E5=BA=A6=E5=9C=B0=E5=9B=BE=E5=9D=90=E6=A0=87?= =?UTF-8?q?=E5=8D=B3=E5=8F=AF=EF=BC=9B=204.=E5=9D=90=E6=A0=87=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E6=96=B9=E6=B3=95=E6=9B=B4=E6=94=B9=EF=BC=9B=205.?= =?UTF-8?q?=E5=95=86=E6=88=B7=E5=85=85=E5=80=BC=E6=8E=A5=E5=8F=A3=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=B1=BB=E5=9E=8B=E6=9B=B4=E6=94=B9=EF=BC=9B=206.?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E9=A1=B5=E6=96=B0=E5=A2=9E=E7=99=BE=E5=BA=A6?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E5=BA=95=E9=83=A8=E9=80=89=E6=8B=A9=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mine/mine_shop_recharge.dart | 10 +-- lib/mine/mine_view/mine_item.dart | 1 - lib/retrofit/data/member_recharge_list.dart | 18 +++--- lib/union/location_map_page.dart | 67 ++++++++++++++++----- lib/union/union_list.dart | 5 +- lib/utils/flutter_utils.dart | 6 +- 6 files changed, 72 insertions(+), 35 deletions(-) diff --git a/lib/mine/mine_shop_recharge.dart b/lib/mine/mine_shop_recharge.dart index cdf8e95e..3699879a 100644 --- a/lib/mine/mine_shop_recharge.dart +++ b/lib/mine/mine_shop_recharge.dart @@ -92,10 +92,10 @@ class _MineShopRecharge extends State<MineShopRecharge> { vipCard = baseData.data; } } finally { - if(isSingle) - setState((){}); + if (isSingle) + setState(() {}); else - addLoadCount(); + addLoadCount(); } } @@ -617,7 +617,9 @@ class _MineShopRecharge extends State<MineShopRecharge> { ), TextSpan( text: - "${AppUtils.calculateDouble((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) + (double.tryParse(memberRechargeList.giftdMoney) ?? 0) + ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) - ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) * (discount / 100))))}元", + "${((memberRechargeList?.limitNum ?? 0) != 0 && ((memberRechargeList?.limitNum ?? 0) - (memberRechargeList?.useNum ?? 0) <= 0)) ? + (AppUtils.calculateDouble(double.tryParse(memberRechargeList.rechargeMoney) ?? 0)) : + (AppUtils.calculateDouble((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) + (double.tryParse(memberRechargeList.giftdMoney) ?? 0) + ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) - ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) * (discount / 100)))))}元", style: TextStyle( fontSize: 18.sp, fontFamily: 'JDZhengHT', diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index e2ecbdf2..6cb1fd39 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -1,6 +1,5 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; diff --git a/lib/retrofit/data/member_recharge_list.dart b/lib/retrofit/data/member_recharge_list.dart index 30c207d0..0fa2db51 100644 --- a/lib/retrofit/data/member_recharge_list.dart +++ b/lib/retrofit/data/member_recharge_list.dart @@ -20,7 +20,7 @@ class MemberRechargeList { String id, String rechargeMoney, String giftdMoney, - num limitNum, + dynamic limitNum, dynamic gitfdCouponId, dynamic startDate, dynamic endDate, @@ -31,8 +31,8 @@ class MemberRechargeList { num isDeleted, num rechargeType, String remark, - num sortValue, - num useNum,}){ + num sortValue, + dynamic useNum,}){ _id = id; _rechargeMoney = rechargeMoney; _giftdMoney = giftdMoney; @@ -72,7 +72,7 @@ class MemberRechargeList { String _id; String _rechargeMoney; String _giftdMoney; - num _limitNum; + dynamic _limitNum; dynamic _gitfdCouponId; dynamic _startDate; dynamic _endDate; @@ -84,11 +84,11 @@ class MemberRechargeList { num _rechargeType; String _remark; num _sortValue; - num _useNum; + dynamic _useNum; MemberRechargeList copyWith({ String id, String rechargeMoney, String giftdMoney, - num limitNum, + dynamic limitNum, dynamic gitfdCouponId, dynamic startDate, dynamic endDate, @@ -100,7 +100,7 @@ MemberRechargeList copyWith({ String id, num rechargeType, String remark, num sortValue, - num useNum, + dynamic useNum, }) => MemberRechargeList( id: id ?? _id, rechargeMoney: rechargeMoney ?? _rechargeMoney, giftdMoney: giftdMoney ?? _giftdMoney, @@ -121,7 +121,7 @@ MemberRechargeList copyWith({ String id, String get id => _id; String get rechargeMoney => _rechargeMoney; String get giftdMoney => _giftdMoney; - num get limitNum => _limitNum; + dynamic get limitNum => _limitNum; dynamic get gitfdCouponId => _gitfdCouponId; dynamic get startDate => _startDate; dynamic get endDate => _endDate; @@ -133,7 +133,7 @@ MemberRechargeList copyWith({ String id, num get rechargeType => _rechargeType; String get remark => _remark; num get sortValue => _sortValue; - num get useNum => _useNum; + dynamic get useNum => _useNum; Map<String, dynamic> toJson() { final map = <String, dynamic>{}; diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index 311fb466..7cfbffc5 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:io'; import 'dart:ui'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; @@ -12,7 +13,6 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/location.dart'; -import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -72,10 +72,10 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver { myAddress = result.locationDetail; myCity = result.city; if (distance == null) calculate(); - AppUtils.coordConvert(myLatLng).then((value) { - this.myLatLng = value; + // AppUtils.coordConvert(myLatLng).then((value) { + // this.myLatLng = value; locationShow(); - }); + // }); Location.getInstance().stopLocation(); } }); @@ -420,19 +420,19 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver { BMFCoordinate startCoord = BMFCoordinate( positionSorta == false ? myLatLng.latitude - : double.tryParse(widget.arguments["lat"]), + : latLng.latitude, positionSorta == false ? myLatLng.longitude - : double.tryParse(widget.arguments["lng"])); + : latLng.longitude); String startName = ((positionSorta == false) ? "我的位置" : "终点"); // 去的位置 String endName = ((positionSorta == false) ? "终点" : "我的位置"); BMFCoordinate endCoord = BMFCoordinate( positionSorta == false - ? double.tryParse(widget.arguments["lat"]) + ? latLng.latitude : myLatLng.latitude, positionSorta == false - ? double.tryParse(widget.arguments["lng"]) + ? latLng.longitude : myLatLng.longitude); BMFOpenRouteOption routeOption = BMFOpenRouteOption( startCoord: startCoord, @@ -471,7 +471,7 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver { ? 'assets/image/traffic_texture_unknown.png' : 'assets/image/traffic_texture_smooth.png' ], - width: Platform.isAndroid ? 16 :10, + width: Platform.isAndroid ? 16 : 10, lineDashType: BMFLineDashType.LineDashTypeNone, lineCapType: BMFLineCapType.LineCapButt, lineJoinType: BMFLineJoinType.LineJoinRound); @@ -544,8 +544,8 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver { ? BMFCoordinate(myLatLng?.latitude ?? 0, myLatLng?.longitude ?? 0) : latLng); BMFPlanNode to = BMFPlanNode( - cityName: positionSorta == false ? (storeInfo?.city ?? "") : myCity, - name: positionSorta == false ? (storeInfo?.address ?? "") : myAddress, + // cityName: positionSorta == false ? (storeInfo?.city ?? "") : myCity, + // name: positionSorta == false ? (storeInfo?.address ?? "") : myAddress, pt: positionSorta == false ? latLng : BMFCoordinate(myLatLng?.latitude ?? 0, myLatLng?.longitude ?? 0)); @@ -1072,7 +1072,7 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver { onTap: () { setState(() { navigationState = 1; - onOpenBaiduMapRoute(); + showMapSelect(); }); }, child: Container( @@ -1105,6 +1105,41 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver { ); } + showMapSelect() { + showCupertinoModalPopup( + context: context, + builder: (context) { + return CupertinoActionSheet( + actions: [ + CupertinoActionSheetAction( + child: Text( + "百度地图", + style: TextStyle( + fontWeight: MyFontWeight.regular, + ), + ), + onPressed: () { + onOpenBaiduMapRoute(); + Navigator.of(context).pop(); + }, + isDefaultAction: true, + isDestructiveAction: false, + ), + ], + cancelButton: CupertinoActionSheetAction( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text(S.of(context).quxiao, + style: TextStyle( + color: Colors.blue, + ),), + isDestructiveAction: true, + ), + ); + }); + } + List<Widget> itemServer(String businessService) { if (businessService == null || businessService == "") return []; var list = businessService.split(","); @@ -1152,10 +1187,10 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver { } addMarker() async { - // latLng = await AppUtils.coordConvert(BMFCoordinate(double.tryParse(widget.arguments["lat"]), - // double.tryParse(widget.arguments["lng"]))); - latLng = BMFCoordinate(double.tryParse(widget.arguments["lat"]), - double.tryParse(widget.arguments["lng"])); + latLng = await AppUtils.coordConvert(BMFCoordinate(double.tryParse(widget.arguments["lat"]), + double.tryParse(widget.arguments["lng"]))); + // latLng = BMFCoordinate(double.tryParse(widget.arguments["lat"]), + // double.tryParse(widget.arguments["lng"])); if (bmfMarker == null && _mapController != null) { bmfMarker = BMFMarker.icon( diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index 111b6821..173bc4ef 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -102,9 +102,10 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin { ? NoDataView( src: "assets/image/di_zhi.webp", isShowBtn: false, - text: "暂无店铺列表~", + text: ((widget.city??"") != "武汉" && (widget.city??"") != "郑州" && (widget.city??"") != "北京") ? + " 当前回乡开放门店 仅包含 武汉/北京/郑州,您当前的位置无法获取,请手动更换城市" :"暂无店铺列表~", fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h), + margin: EdgeInsets.only(top: 120.h,left:45.w,right:45.w), ) : ListView.builder( itemCount: storeList.length, diff --git a/lib/utils/flutter_utils.dart b/lib/utils/flutter_utils.dart index 4e53bdb5..f9257c79 100644 --- a/lib/utils/flutter_utils.dart +++ b/lib/utils/flutter_utils.dart @@ -78,12 +78,12 @@ class AppUtils { return resString; } - ///坐标系转换 + ///坐标系转换(高德转百度) static Future<BMFCoordinate> coordConvert(BMFCoordinate latLng) async { return BMFCalculateUtils.coordConvert( coordinate: latLng, - fromType: BMF_COORD_TYPE.BD09LL, - toType: BMF_COORD_TYPE.COMMON); + fromType: BMF_COORD_TYPE.COMMON, + toType: BMF_COORD_TYPE.BD09LL); } static bool isPhone(mobile) { From d62f0bf7969356563082e0fc017a9e54887e5e82 Mon Sep 17 00:00:00 2001 From: fmk <fengmeikan@hotmail.com> Date: Fri, 8 Sep 2023 17:50:14 +0800 Subject: [PATCH 35/35] =?UTF-8?q?ios=E7=AB=AF=E6=9D=83=E9=99=90=E9=80=82?= =?UTF-8?q?=E9=85=8D=E6=9B=B4=E6=94=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- lib/union/location_map_page.dart | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 7e315834..304ac515 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -617,7 +617,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -819,7 +819,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -912,7 +912,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index 311fb466..4799a91a 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -91,6 +91,7 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver { // alignment: Alignment.center); // } } + setState(() {}); } }