From 6b2cffa34ea13bff451ba8116ca06021f521fb40 Mon Sep 17 00:00:00 2001 From: fmk Date: Sat, 18 Sep 2021 17:03:13 +0800 Subject: [PATCH 1/3] safety --- android/app/build.gradle | 2 + .../src/main/assets/data/dcloud_control.xml | 2 +- .../main/kotlin/com/zsw/huixiang/MinPlugin.kt | 5 +- lib/login/login_page.dart | 18 +++---- lib/main.dart | 5 +- lib/retrofit/retrofit_api.dart | 8 ++-- lib/setting/setting_page.dart | 1 + lib/union/union_details_page.dart | 4 +- lib/union/union_view/store_info.dart | 48 +++++++++---------- lib/view_widget/mine_vip_view.dart | 7 +-- 10 files changed, 50 insertions(+), 50 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index be6c78ab..2856cd40 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -190,6 +190,8 @@ dependencies { implementation 'com.github.bumptech.glide:glide:4.12.0' implementation 'com.alibaba:fastjson:1.2.54' + implementation 'com.tencent.tpns:xiaomi:1.2.7.1-release' + implementation 'com.tencent.tpns:huawei:1.2.6.0-release' // HMS Core Push 模块依赖包 implementation 'com.huawei.hms:push:5.3.0.304' diff --git a/android/app/src/main/assets/data/dcloud_control.xml b/android/app/src/main/assets/data/dcloud_control.xml index 9d47b136..0047994b 100644 --- a/android/app/src/main/assets/data/dcloud_control.xml +++ b/android/app/src/main/assets/data/dcloud_control.xml @@ -1,4 +1,4 @@ - + diff --git a/android/app/src/main/kotlin/com/zsw/huixiang/MinPlugin.kt b/android/app/src/main/kotlin/com/zsw/huixiang/MinPlugin.kt index dbf6f7f3..a24157de 100644 --- a/android/app/src/main/kotlin/com/zsw/huixiang/MinPlugin.kt +++ b/android/app/src/main/kotlin/com/zsw/huixiang/MinPlugin.kt @@ -24,7 +24,7 @@ class MinPlugin: FlutterPlugin, MethodCallHandler { /// This local reference serves to register the plugin with the Flutter Engine and unregister it /// when the Flutter Engine is detached from the Activity private lateinit var channel : MethodChannel - private lateinit var context : Context; + private lateinit var context : Context override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { context = flutterPluginBinding.applicationContext; @@ -44,7 +44,7 @@ class MinPlugin: FlutterPlugin, MethodCallHandler { .setMenuDefFontColor("#000000") .setMenuDefFontWeight("normal") .setMenuActionSheetItems(sheetItems) - .setEnableBackground(true) + .setEnableBackground(false) //后台运行 .build() DCUniMPSDK.getInstance().initialize(context, config) { result.success(it) @@ -60,6 +60,7 @@ class MinPlugin: FlutterPlugin, MethodCallHandler { } DCUniMPSDK.getInstance().setUniMPOnCloseCallBack { Logger.e("用户点击了退出 it: $it") + DCUniMPSDK.getInstance().closeCurrentApp() } } } else if (call.method == "isInitialize") { diff --git a/lib/login/login_page.dart b/lib/login/login_page.dart index 13a653c8..63c291b1 100644 --- a/lib/login/login_page.dart +++ b/lib/login/login_page.dart @@ -85,11 +85,12 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { Image image; buildImageInfo(BuildContext context) async { image = Image.asset("assets/image/laoban.png"); + double screenWidth = MediaQuery.of(this.context).size.width; image.image .resolve(ImageConfiguration()) .addListener(ImageStreamListener((ImageInfo info, bool _) { double width = info.image.width.toDouble(); - double screenWidth = 375; + if (!mounted) return; if ((width / screenWidth) < rota) { rota = (screenWidth * 1.04) / width; } @@ -98,22 +99,11 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { })); } - @override - void didChangeDependencies() { - super.didChangeDependencies(); - - - } - @override void initState() { super.initState(); isLogin(); - try { - buildImageInfo(this.context); - } catch(ex) {} - } initController() { @@ -390,6 +380,10 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { + try { + buildImageInfo(this.context); + } catch(ex) {} + if (animatedContainer != null && !animatedContainer.isAnimating) { animatedContainer.forward(); } diff --git a/lib/main.dart b/lib/main.dart index b01f9a15..af44729f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -110,8 +110,9 @@ initSdk() async { if (Platform.isAndroid) { XgAndroidApi androidApi = xgFlutterPlugin.getXgAndroidApi(); //小米 - // androidApi.setMiPushAppId(appId:"APP_ID"); - // androidApi.setMiPushAppKey(appKey: "APPKEY"); + androidApi.setMiPushAppId(appId:"2882303761520050452"); + androidApi.setMiPushAppKey(appKey: "5582005091452"); + androidApi.enableOtherPush(); androidApi.regPush(); } diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 5545e91d..e070783a 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -37,11 +37,11 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +// const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +// const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -// const base_url = "http://192.168.10.236:8766/app/"; ///费韬 -// const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 +const base_url = "http://192.168.10.236:8766/app/"; ///费韬 +const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 // const base_url = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/"; diff --git a/lib/setting/setting_page.dart b/lib/setting/setting_page.dart index 4fad9362..1ee9fccc 100644 --- a/lib/setting/setting_page.dart +++ b/lib/setting/setting_page.dart @@ -190,6 +190,7 @@ class _SettingPage extends State { if (miniAppids != null && miniAppids.length > 0) { miniAppids.forEach((element) async { print("appid: $element"); + await Min.closeCurrentApp(); String path = await Min.getAppBasePath(element); AppUtils.deleteDirectory(Directory(path)); String filePath = ""; diff --git a/lib/union/union_details_page.dart b/lib/union/union_details_page.dart index 9846ed31..b28747fd 100644 --- a/lib/union/union_details_page.dart +++ b/lib/union/union_details_page.dart @@ -265,8 +265,8 @@ class _UnionDetailsPage extends State { "tenantCode": storeInfo.tenantCode, if (latitude != null && longitude != null) "position": "$latitude,$longitude", - "baseURL": "https://pos.api.lotus-wallet.com/app/", - // "baseURL": "http://192.168.10.236:8765/app/", + // "baseURL": "https://pos.api.lotus-wallet.com/app/", + "baseURL": "http://192.168.10.236:8765/app/", "uid": userId, "userInfo": { "nickname": nickname, diff --git a/lib/union/union_view/store_info.dart b/lib/union/union_view/store_info.dart index 64ad292a..f8dc7373 100644 --- a/lib/union/union_view/store_info.dart +++ b/lib/union/union_view/store_info.dart @@ -66,35 +66,37 @@ class _StoreInfos extends State { children: [ Row( children: [ - Text( - widget.storeInfo != null - ? widget.storeInfo.storeName - : "", - style: TextStyle( - fontSize: 16.sp, - color: Colors.black, - fontWeight: MyFontWeight.medium, - ), - ), Expanded( child: Container( alignment: - Alignment.centerRight, + Alignment.centerLeft, child: Text( - S.of(context).ren( - widget.storeInfo != null - ? widget.storeInfo - .perCapitaConsumption - : "", - ), + widget.storeInfo != null + ? widget.storeInfo.storeName + : "", + overflow: TextOverflow.ellipsis, style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF353535), + fontSize: 16.sp, + color: Colors.black, + fontWeight: MyFontWeight.medium, ), ), ), ), + Text( + S.of(context).ren( + widget.storeInfo != null + ? widget.storeInfo + .perCapitaConsumption + : "", + ), + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), ], ), Text( @@ -117,10 +119,8 @@ class _StoreInfos extends State { ), ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, children: [ Expanded( child: Text( diff --git a/lib/view_widget/mine_vip_view.dart b/lib/view_widget/mine_vip_view.dart index 713572e8..1aac0318 100644 --- a/lib/view_widget/mine_vip_view.dart +++ b/lib/view_widget/mine_vip_view.dart @@ -312,9 +312,10 @@ class MineVipView extends StatelessWidget { }); } }, - child: (tag == null || tag == "") - ? widget - : Hero(tag: tag, child: widget), + child: widget, + //(tag == null || tag == "") + // ? widget + // : Hero(tag: tag, child: widget) ); } } From daf0d7a68726cd125c624b544f97fac3603ba286 Mon Sep 17 00:00:00 2001 From: fmk Date: Sat, 18 Sep 2021 18:40:32 +0800 Subject: [PATCH 2/3] safety --- lib/retrofit/retrofit_api.dart | 8 ++-- lib/union/union_details_page.dart | 4 +- lib/web/web_view/web_content.dart | 64 +++++++++++++++++++++---------- 3 files changed, 49 insertions(+), 27 deletions(-) diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index e070783a..5545e91d 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -37,11 +37,11 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -// const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -// const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -const base_url = "http://192.168.10.236:8766/app/"; ///费韬 -const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 +// const base_url = "http://192.168.10.236:8766/app/"; ///费韬 +// const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 // const base_url = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/"; diff --git a/lib/union/union_details_page.dart b/lib/union/union_details_page.dart index b28747fd..9846ed31 100644 --- a/lib/union/union_details_page.dart +++ b/lib/union/union_details_page.dart @@ -265,8 +265,8 @@ class _UnionDetailsPage extends State { "tenantCode": storeInfo.tenantCode, if (latitude != null && longitude != null) "position": "$latitude,$longitude", - // "baseURL": "https://pos.api.lotus-wallet.com/app/", - "baseURL": "http://192.168.10.236:8765/app/", + "baseURL": "https://pos.api.lotus-wallet.com/app/", + // "baseURL": "http://192.168.10.236:8765/app/", "uid": userId, "userInfo": { "nickname": nickname, diff --git a/lib/web/web_view/web_content.dart b/lib/web/web_view/web_content.dart index 5a5175b8..687a4209 100644 --- a/lib/web/web_view/web_content.dart +++ b/lib/web/web_view/web_content.dart @@ -1,6 +1,7 @@ import 'package:chewie/chewie.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_html/image_render.dart'; import 'package:chewie/src/chewie_progress_colors.dart' as chewie; @@ -106,39 +107,60 @@ class _WebContent extends State { Widget videoWidget(double width, double height, src, sandboxMode) { print("src : $src"); + chewieAudioController = ChewieController( + videoPlayerController: videoPlayerController = + VideoPlayerController.network( + src, + ), + aspectRatio: width / height, + //宽高比 + autoPlay: false, + //自动播放 + looping: false, + //循环播放 + allowFullScreen: true, + // systemOverlaysAfterFullScreen: [], + // systemOverlaysOnEnterFullScreen: [], + // deviceOrientationsAfterFullScreen: [], + // deviceOrientationsOnEnterFullScreen: [], + // 拖动条样式颜色 + materialProgressColors: chewie.ChewieProgressColors( + playedColor: Colors.white, + handleColor: Colors.white, + backgroundColor: Colors.grey, + bufferedColor: Colors.transparent, + ), + autoInitialize: true, + ); + + chewieAudioController.addListener(_fullScreenListener); + return MediaQuery( data: MediaQuery.of(context).copyWith( - textScaleFactor: 0.9, + textScaleFactor: textScaleFactor, ), child: Container( width: MediaQuery.of(context).size.width - 17, height: (MediaQuery.of(context).size.width) / (width / height), child: chewies = Chewie( - controller: chewieAudioController = ChewieController( - videoPlayerController: videoPlayerController = - VideoPlayerController.network( - src, - ), - aspectRatio: width / height, - //宽高比 - autoPlay: false, - //自动播放 - looping: false, - //循环播放 - // 拖动条样式颜色 - materialProgressColors: chewie.ChewieProgressColors( - playedColor: Colors.white, - handleColor: Colors.white, - backgroundColor: Colors.grey, - bufferedColor: Colors.transparent, - ), - autoInitialize: true, - ), + controller: chewieAudioController, ), ), ); } + Future _fullScreenListener() async { + print("object: isPlaying: ${videoPlayerController.value.isPlaying}"); + print("object: isFullScreen: ${chewieAudioController.isFullScreen}"); + + if (!chewieAudioController.isFullScreen) { + textScaleFactor = 1; + setState(() {}); + } + } + + double textScaleFactor = 0.9; + Widget audioWidget(showControls, loop, autoplay, src, width) { return Container( width: width, From 58437ca219e559a57ed0b7f2c919f3f2dfac2840 Mon Sep 17 00:00:00 2001 From: fmk Date: Thu, 23 Sep 2021 13:47:18 +0800 Subject: [PATCH 3/3] safety --- .../src/main/assets/data/dcloud_control.xml | 2 +- lib/generated/intl/messages_en.dart | 1 + lib/generated/intl/messages_zh_CN.dart | 1 + lib/generated/intl/messages_zh_Hans_CN.dart | 1 + lib/generated/intl/messages_zh_Hant_CN.dart | 1 + lib/generated/intl/messages_zh_TW.dart | 1 + lib/generated/l10n.dart | 10 ++ lib/l10n/intl_en.arb | 1 + lib/l10n/intl_zh_CN.arb | 1 + lib/l10n/intl_zh_Hans_CN.arb | 1 + lib/l10n/intl_zh_Hant_CN.arb | 1 + lib/l10n/intl_zh_TW.arb | 1 + lib/mine/roll_center_page.dart | 87 ++++++----- lib/order/order_detail_page.dart | 144 +++++++++--------- lib/web/web_page.dart | 6 +- lib/web/web_view/comment_list.dart | 71 +++++---- lib/web/web_view/input_comment.dart | 34 ++--- lib/web/web_view/web_content.dart | 12 +- 18 files changed, 204 insertions(+), 172 deletions(-) diff --git a/android/app/src/main/assets/data/dcloud_control.xml b/android/app/src/main/assets/data/dcloud_control.xml index 0047994b..ae260249 100644 --- a/android/app/src/main/assets/data/dcloud_control.xml +++ b/android/app/src/main/assets/data/dcloud_control.xml @@ -1,4 +1,4 @@ - + diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index 7f9b5df3..a46f803b 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -214,6 +214,7 @@ class MessageLookup extends MessageLookupByLibrary { "guanyuchuangshiren" : MessageLookupByLibrary.simpleMessage("关于创始人"), "guojiankangyoujishenghuo" : MessageLookupByLibrary.simpleMessage("过健康有机生活"), "haimeiyouxiaoxi" : MessageLookupByLibrary.simpleMessage("还没有消息~"), + "haimeiyouyouhuiquankeyilingqu" : MessageLookupByLibrary.simpleMessage("还没有优惠券可以领取~"), "haixiajiemei" : MessageLookupByLibrary.simpleMessage("海峡姐妹"), "haowu" : MessageLookupByLibrary.simpleMessage("好物"), "heji" : MessageLookupByLibrary.simpleMessage("合计:"), diff --git a/lib/generated/intl/messages_zh_CN.dart b/lib/generated/intl/messages_zh_CN.dart index 80ff9c24..e51cefef 100644 --- a/lib/generated/intl/messages_zh_CN.dart +++ b/lib/generated/intl/messages_zh_CN.dart @@ -213,6 +213,7 @@ class MessageLookup extends MessageLookupByLibrary { "guanyu" : MessageLookupByLibrary.simpleMessage("关于"), "guojiankangyoujishenghuo" : MessageLookupByLibrary.simpleMessage("过健康有机生活"), "haimeiyouxiaoxi" : MessageLookupByLibrary.simpleMessage("还没有消息~"), + "haimeiyouyouhuiquankeyilingqu" : MessageLookupByLibrary.simpleMessage("还没有优惠券可以领取~"), "haixiajiemei" : MessageLookupByLibrary.simpleMessage("海峡姐妹"), "haowu" : MessageLookupByLibrary.simpleMessage("好物"), "heji" : MessageLookupByLibrary.simpleMessage("合计:"), diff --git a/lib/generated/intl/messages_zh_Hans_CN.dart b/lib/generated/intl/messages_zh_Hans_CN.dart index bff63ef3..ed207766 100644 --- a/lib/generated/intl/messages_zh_Hans_CN.dart +++ b/lib/generated/intl/messages_zh_Hans_CN.dart @@ -213,6 +213,7 @@ class MessageLookup extends MessageLookupByLibrary { "guanyu" : MessageLookupByLibrary.simpleMessage("关于"), "guojiankangyoujishenghuo" : MessageLookupByLibrary.simpleMessage("过健康有机生活"), "haimeiyouxiaoxi" : MessageLookupByLibrary.simpleMessage("还没有消息~"), + "haimeiyouyouhuiquankeyilingqu" : MessageLookupByLibrary.simpleMessage("还没有优惠券可以领取~"), "haixiajiemei" : MessageLookupByLibrary.simpleMessage("海峡姐妹"), "haowu" : MessageLookupByLibrary.simpleMessage("好物"), "heji" : MessageLookupByLibrary.simpleMessage("合计:"), diff --git a/lib/generated/intl/messages_zh_Hant_CN.dart b/lib/generated/intl/messages_zh_Hant_CN.dart index 63ad7b67..7ce9e8fa 100644 --- a/lib/generated/intl/messages_zh_Hant_CN.dart +++ b/lib/generated/intl/messages_zh_Hant_CN.dart @@ -213,6 +213,7 @@ class MessageLookup extends MessageLookupByLibrary { "guanyu" : MessageLookupByLibrary.simpleMessage("關於"), "guojiankangyoujishenghuo" : MessageLookupByLibrary.simpleMessage("過健康有機生活"), "haimeiyouxiaoxi" : MessageLookupByLibrary.simpleMessage("還沒有消息~"), + "haimeiyouyouhuiquankeyilingqu" : MessageLookupByLibrary.simpleMessage("還沒有優惠券可以領取~"), "haixiajiemei" : MessageLookupByLibrary.simpleMessage("海峽姐妹"), "haowu" : MessageLookupByLibrary.simpleMessage("好物"), "heji" : MessageLookupByLibrary.simpleMessage("合計:"), diff --git a/lib/generated/intl/messages_zh_TW.dart b/lib/generated/intl/messages_zh_TW.dart index 1f2594c5..f0e46757 100644 --- a/lib/generated/intl/messages_zh_TW.dart +++ b/lib/generated/intl/messages_zh_TW.dart @@ -213,6 +213,7 @@ class MessageLookup extends MessageLookupByLibrary { "guanyu" : MessageLookupByLibrary.simpleMessage("關於"), "guojiankangyoujishenghuo" : MessageLookupByLibrary.simpleMessage("過健康有機生活"), "haimeiyouxiaoxi" : MessageLookupByLibrary.simpleMessage("還沒有消息~"), + "haimeiyouyouhuiquankeyilingqu" : MessageLookupByLibrary.simpleMessage("還沒有優惠券可以領取~"), "haixiajiemei" : MessageLookupByLibrary.simpleMessage("海峽姐妹"), "haowu" : MessageLookupByLibrary.simpleMessage("好物"), "heji" : MessageLookupByLibrary.simpleMessage("合計:"), diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index ef98c14a..cfc63b86 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -4945,6 +4945,16 @@ class S { ); } + /// `还没有优惠券可以领取~` + String get haimeiyouyouhuiquankeyilingqu { + return Intl.message( + '还没有优惠券可以领取~', + name: 'haimeiyouyouhuiquankeyilingqu', + desc: '', + args: [], + ); + } + /// `并使用本机号码登录` String get privacy_policy4 { return Intl.message( diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 2b7a1f27..d251f7da 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -512,6 +512,7 @@ "yaoqingrenshoujihao_": "邀请人手机号:{shoujihao}", "saomashibieguanzhugongzonghao": "扫码识别,关注公众号", "fenxiangzhiweixin": "分享至微信", + "haimeiyouyouhuiquankeyilingqu": "还没有优惠券可以领取~", diff --git a/lib/l10n/intl_zh_CN.arb b/lib/l10n/intl_zh_CN.arb index 32503bb4..c5edc693 100644 --- a/lib/l10n/intl_zh_CN.arb +++ b/lib/l10n/intl_zh_CN.arb @@ -514,6 +514,7 @@ "yaoqingrenshoujihao_": "邀请人手机号:{shoujihao}", "saomashibieguanzhugongzonghao": "扫码识别,关注公众号", "fenxiangzhiweixin": "分享至微信", + "haimeiyouyouhuiquankeyilingqu": "还没有优惠券可以领取~", diff --git a/lib/l10n/intl_zh_Hans_CN.arb b/lib/l10n/intl_zh_Hans_CN.arb index 32503bb4..c5edc693 100644 --- a/lib/l10n/intl_zh_Hans_CN.arb +++ b/lib/l10n/intl_zh_Hans_CN.arb @@ -514,6 +514,7 @@ "yaoqingrenshoujihao_": "邀请人手机号:{shoujihao}", "saomashibieguanzhugongzonghao": "扫码识别,关注公众号", "fenxiangzhiweixin": "分享至微信", + "haimeiyouyouhuiquankeyilingqu": "还没有优惠券可以领取~", diff --git a/lib/l10n/intl_zh_Hant_CN.arb b/lib/l10n/intl_zh_Hant_CN.arb index 22a3c64e..e61d67c4 100644 --- a/lib/l10n/intl_zh_Hant_CN.arb +++ b/lib/l10n/intl_zh_Hant_CN.arb @@ -507,6 +507,7 @@ "yaoqingrenshoujihao_": "邀请人手機號:{shoujihao}", "saomashibieguanzhugongzonghao": "掃碼識別,關注公眾號", "fenxiangzhiweixin": "分享至微信", + "haimeiyouyouhuiquankeyilingqu": "還沒有優惠券可以領取~", diff --git a/lib/l10n/intl_zh_TW.arb b/lib/l10n/intl_zh_TW.arb index a6ecaa83..d6625150 100644 --- a/lib/l10n/intl_zh_TW.arb +++ b/lib/l10n/intl_zh_TW.arb @@ -506,6 +506,7 @@ "yaoqingrenshoujihao_": "邀请人手機號:{shoujihao}", "saomashibieguanzhugongzonghao": "掃碼識別,關注公眾號", "fenxiangzhiweixin": "分享至微信", + "haimeiyouyouhuiquankeyilingqu": "還沒有優惠券可以領取~", diff --git a/lib/mine/roll_center_page.dart b/lib/mine/roll_center_page.dart index fb02707a..2c46d765 100644 --- a/lib/mine/roll_center_page.dart +++ b/lib/mine/roll_center_page.dart @@ -11,6 +11,7 @@ import 'package:huixiang/view_widget/item_title.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/new_coupon_widget.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; import 'package:huixiang/view_widget/receive_success.dart'; import 'package:huixiang/view_widget/selector_store_dialog.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; @@ -34,8 +35,11 @@ class _RollCenterPage extends State { super.initState(); SharedPreferences.getInstance().then((value) => { - apiService = ApiService(Dio(), - context: context, token: value.getString('token')), + apiService = ApiService( + Dio(), + context: context, + token: value.getString('token'), + ), queryCoupon(), }); _refreshController = RefreshController(initialRefresh: false); @@ -114,40 +118,46 @@ class _RollCenterPage extends State { onRefresh: refreshCoupon, onLoading: queryCoupon, physics: BouncingScrollPhysics(), - child: ListView.builder( - itemBuilder: (context, position) { - return GestureDetector( - child: NewCouponWidget( - coupons[position], - (type) { - if (type == 1) { - receiveCoupon(coupons[position].id); - } else { - if (coupons[position].bizType == 5) { - Navigator.of(context).pushNamed( - '/router/write_off_page', - arguments: { - "couponId": coupons[position].id, - "coupon": coupons[position].toJson() - }); - } else { - showStoreSelector(coupons[position].storeList); - } - } + child: (coupons != null && coupons.length > 0) + ? ListView.builder( + itemBuilder: (context, position) { + return GestureDetector( + child: NewCouponWidget( + coupons[position], + (type) { + if (type == 1) { + receiveCoupon(coupons[position].id); + } else { + if (coupons[position].bizType == 5) { + Navigator.of(context).pushNamed( + '/router/write_off_page', + arguments: { + "couponId": coupons[position].id, + "coupon": coupons[position].toJson() + }); + } else { + showStoreSelector(coupons[position].storeList); + } + } + }, + () { + setState((){ + coupons[position].isEx = !coupons[position].isEx; + }); + }, + type: 1, + ), + ); }, - () { - setState(() { - coupons[position].isEx = !coupons[position].isEx; - }); - }, - type: 1, + itemCount: (coupons != null && coupons.length > 0) ? coupons.length : 0, + ) + : NoDataView( + isShowBtn: false, + text: S.of(context).haimeiyouyouhuiquankeyilingqu, + fontSize: 16.sp, ), - ); - }, - itemCount: coupons != null ? coupons.length : 0, - ), ), - ) + ), ], ), ), @@ -164,11 +174,12 @@ class _RollCenterPage extends State { showStoreSelector(storeList) { showModalBottomSheet( - context: context, - backgroundColor: Colors.transparent, - builder: (context) { - return SelectorStoreWidget(storeList); - }); + context: context, + backgroundColor: Colors.transparent, + builder: (context) { + return SelectorStoreWidget(storeList); + }, + ); } showAlertDialog() { diff --git a/lib/order/order_detail_page.dart b/lib/order/order_detail_page.dart index 0adc81a5..c1e48cb9 100644 --- a/lib/order/order_detail_page.dart +++ b/lib/order/order_detail_page.dart @@ -36,8 +36,11 @@ class _OrderDetailPage extends State { super.initState(); SharedPreferences.getInstance().then((value) { - apiService = - ApiService(Dio(), context: context, token: value.getString("token")); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); queryDetails(); }); } @@ -62,11 +65,11 @@ class _OrderDetailPage extends State { isTakeOut = orderInfo.isTakeOut; refundStatus = orderInfo.refundStatus; // storeType = orderInfo.storeVO.posType.code; - print("refund_status: $refundStatus"); - print("payStatus: $payStatus"); - print("orderStatus: $orderStatus"); - print("sendStatus: $sendStatus"); - print("isTakeOut: $isTakeOut"); + print("order refund_status: $refundStatus"); + print("order payStatus: $payStatus"); + print("order orderStatus: $orderStatus"); + print("order sendStatus: $sendStatus"); + print("order isTakeOut: $isTakeOut"); if (mounted) setState(() { statusTitle(); @@ -465,75 +468,76 @@ class _OrderDetailPage extends State { carryOnPay() async { showDialog( - context: context, - builder: (context) { - return AlertDialog( - content: Container( - width: MediaQuery.of(context).size.width - 84.w, - height: 120.h, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - "app暂不支持支付,\n请前往对应小程序处理", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16.sp, - fontWeight: FontWeight.bold, - color: Colors.black, - ), - ), - SizedBox( - height: 30.h, + context: context, + builder: (context) { + return AlertDialog( + content: Container( + width: MediaQuery.of(context).size.width - 84.w, + height: 140.h, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "app暂不支持支付,\n请前往对应小程序处理", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.sp, + fontWeight: FontWeight.bold, + color: Colors.black, ), - 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(); - }, + ), + 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, ), - flex: 1, - ), - SizedBox( - width: 16.w, + onTap: () { + Navigator.of(context).pop(); + }, ), - 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: () { - 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, ), - flex: 1, + onTap: () { + Navigator.of(context).pop(); + }, ), - ], - ) - ], - ), + flex: 1, + ), + ], + ), + ], ), - ); - }); + ), + ); + }, + ); } Widget paySelector() { diff --git a/lib/web/web_page.dart b/lib/web/web_page.dart index e4fcbb75..22f7936c 100644 --- a/lib/web/web_page.dart +++ b/lib/web/web_page.dart @@ -249,7 +249,9 @@ class _WebPage extends State with WidgetsBindingObserver { WebHeader(widget.arguments, activity, article), /// 富文本的内容 - WebContent(activity, article), + WebContent(activity, article, (){ + setState(() {}); + }), /// 富文本的评论 CommentList( @@ -317,7 +319,7 @@ class _WebPage extends State with WidgetsBindingObserver { Offset first = firstRenderBox.localToGlobal(Offset.zero); scrollController.animateTo(first.dy + scrollController.offset - (kToolbarHeight + MediaQuery.of(context).padding.top), - duration: Duration(milliseconds: 1000), + duration: Duration(milliseconds: 300), curve: Curves.easeIn); } diff --git a/lib/web/web_view/comment_list.dart b/lib/web/web_view/comment_list.dart index f85f3399..437808b5 100644 --- a/lib/web/web_view/comment_list.dart +++ b/lib/web/web_view/comment_list.dart @@ -52,7 +52,7 @@ class _CommentList extends State { LoginTipsDialog().show(context); return; } - BaseData baseData = await apiService.commentLike(id).catchError((error){}); + BaseData baseData = await apiService.commentLike(id).catchError((error) {}); if (baseData != null && baseData.isSuccess) { memberList.forEach((element) { if (element.id == id) { @@ -134,15 +134,15 @@ class _CommentList extends State { showPressMenu(memberList[position].createUser, memberList[position]); }, - child: commentItem(memberList[position], position, - memberList.length), + child: commentItem( + memberList[position], position, memberList.length), ), ); }, ), if (memberList != null && memberList.length > 0) Container( - height: 63.h, + height: commentHeight, decoration: BoxDecoration( color: Color(0xFFF2F2F2), boxShadow: [ @@ -154,7 +154,8 @@ class _CommentList extends State { ), ], ), - alignment: Alignment.center, + alignment: Alignment.topCenter, + padding: EdgeInsets.only(top: 22.h), child: Text( S.of(context).yixiansquanbupinglun, style: TextStyle( @@ -166,8 +167,13 @@ class _CommentList extends State { if (memberList == null || memberList.length == 0) Container( width: double.infinity, - height: 80.h, - alignment: Alignment.center, + height: MediaQuery.of(context).size.height - + kToolbarHeight - + MediaQuery.of(context).padding.top - + 160.h, + alignment: Alignment.topCenter, + color: Color(0xFFF2F2F2), + padding: EdgeInsets.only(top: 22.h), child: Text( S.of(context).zanwupinglun, style: TextStyle( @@ -180,30 +186,41 @@ class _CommentList extends State { ], ), ), - SizedBox( - height: 12.h, - ), ], ); } + double commentHeight = 60.h; + + contentHeight() { + double contentHeight = MediaQuery.of(context).size.height - + kToolbarHeight - + MediaQuery.of(context).padding.top - + 160.h; + if ((contentHeight - 60.h) > (128.h * memberList.length)) { + commentHeight = contentHeight - (128.h * memberList.length); + } + } + //评论列表 queryMemberCommentList() async { SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); if (apiService == null) - apiService = ApiService(Dio(), - context: context, token: sharedPreferences.getString("token")); - BaseData> baseData = - await apiService.memberCommentList({ + apiService = ApiService( + Dio(), + context: context, + token: sharedPreferences.getString("token"), + ); + BaseData> baseData = await apiService.memberCommentList({ "pageNum": 1, "pageSize": 100, - "relationalId": - widget.arguments["activityId"] ?? widget.arguments["articleId"], + "relationalId": widget.arguments["activityId"] ?? widget.arguments["articleId"], "relationalType": 1, }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { commentTotal = baseData.data.size; memberList = baseData.data.list; + contentHeight(); setState(() {}); } } @@ -214,24 +231,6 @@ class _CommentList extends State { return; } SharedPreferences.getInstance().then((value) { - // showModalBottomSheet( - // context: context, - // backgroundColor: Colors.transparent, - // builder: (context) { - // return CommentMenu( - // (type) { - // print("click: $type"); - // if (type == "huifu") { - // widget.reply(memberComment); - // } else if (type == "shanchu") { - // widget.delCommentTips(); - // } - // }, - // isSelf: userId == value.getString("userId"), - // ); - // }, - // ); - SmartDialog.show( widget: CommentMenu( (type) { @@ -364,8 +363,8 @@ class _CommentList extends State { ), Container( padding: EdgeInsets.only( - left: 68, - right: 16, + left: 68.w, + right: 16.w, top: 16.h, bottom: 16.h, ), diff --git a/lib/web/web_view/input_comment.dart b/lib/web/web_view/input_comment.dart index a1e5dcfe..5f3c0f24 100644 --- a/lib/web/web_view/input_comment.dart +++ b/lib/web/web_view/input_comment.dart @@ -64,27 +64,23 @@ class _InputComment extends State { color: Color(0xffF2F2F2), borderRadius: BorderRadius.circular(2.0), ), - child: Column( - children: [ - Container( - margin: EdgeInsets.symmetric(horizontal: 4.w), - alignment: Alignment.topLeft, - child: TextField( - maxLines: 8, - minLines: 1, - focusNode: widget.commentFocus, - controller: widget.commentTextController, - decoration: InputDecoration( - border: InputBorder.none, - hintText: widget.hintText, - hintStyle: TextStyle( - fontSize: 14.sp, - color: Color(0xFF868686), - ), - ), + child: Container( + margin: EdgeInsets.symmetric(horizontal: 4.w), + alignment: Alignment.topLeft, + child: TextField( + maxLines: 8, + minLines: 1, + focusNode: widget.commentFocus, + controller: widget.commentTextController, + decoration: InputDecoration( + border: InputBorder.none, + hintText: widget.hintText, + hintStyle: TextStyle( + fontSize: 14.sp, + color: Color(0xFF868686), ), ), - ], + ), ), ), ), diff --git a/lib/web/web_view/web_content.dart b/lib/web/web_view/web_content.dart index 687a4209..0775c18e 100644 --- a/lib/web/web_view/web_content.dart +++ b/lib/web/web_view/web_content.dart @@ -16,8 +16,9 @@ class WebContent extends StatefulWidget { final Activity activity; final Article article; + final Function exitFull; - WebContent(this.activity, this.article); + WebContent(this.activity, this.article, this.exitFull); @override State createState() { @@ -137,7 +138,7 @@ class _WebContent extends State { return MediaQuery( data: MediaQuery.of(context).copyWith( - textScaleFactor: textScaleFactor, + textScaleFactor: 0.9, ), child: Container( width: MediaQuery.of(context).size.width - 17, @@ -154,13 +155,12 @@ class _WebContent extends State { print("object: isFullScreen: ${chewieAudioController.isFullScreen}"); if (!chewieAudioController.isFullScreen) { - textScaleFactor = 1; - setState(() {}); + Future.delayed(Duration(seconds: 1), () { + widget.exitFull(); + }); } } - double textScaleFactor = 0.9; - Widget audioWidget(showControls, loop, autoplay, src, width) { return Container( width: width,