diff --git a/star_lock/lib/flavors.dart b/star_lock/lib/flavors.dart index 7cc0ef63..19d54133 100644 --- a/star_lock/lib/flavors.dart +++ b/star_lock/lib/flavors.dart @@ -109,8 +109,8 @@ class F { case Flavor.sky: return 'https://lock.skychip.top'; case Flavor.xhj: - // return 'https://lock.xhjcn.ltd'; - return 'https://pre.lock.star-lock.cn'; + return 'https://lock.xhjcn.ltd'; + // return 'https://pre.lock.star-lock.cn'; default: throw Exception('flavor[$name] apiPrefix not found'); } diff --git a/star_lock/lib/main/lockMian/lockList/lockList_xhj_page.dart b/star_lock/lib/main/lockMian/lockList/lockList_xhj_page.dart index 7f05d2e1..6bdd40b6 100644 --- a/star_lock/lib/main/lockMian/lockList/lockList_xhj_page.dart +++ b/star_lock/lib/main/lockMian/lockList/lockList_xhj_page.dart @@ -99,7 +99,7 @@ class _LockListXHJPageState extends State with RouteAware { child: GridView.extent( padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w), maxCrossAxisExtent: Get.width * .6, - childAspectRatio: 1.4, + childAspectRatio: 1.2, crossAxisSpacing: 15.w, mainAxisSpacing: 15.h, shrinkWrap: true, @@ -185,9 +185,10 @@ class _LockListXHJPageState extends State with RouteAware { borderRadius: BorderRadius.circular(20.w), ), child: Padding( - padding: EdgeInsets.symmetric(horizontal: 30.w, vertical: 20.h), + padding: EdgeInsets.symmetric(horizontal: 30.w, vertical: 10.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, children: [ Row( children: [ @@ -197,13 +198,6 @@ class _LockListXHJPageState extends State with RouteAware { height: 32.r, color: AppColors.mainColor, ), - Spacer(), - Text( - logic.getUseKeyTypeStr( - keyInfo.startDate, keyInfo.endDate, keyInfo.keyType), - style: TextStyle( - fontSize: 18.sp, color: AppColors.darkGrayTextColor), - ) ], ), SizedBox( @@ -313,6 +307,13 @@ class _LockListXHJPageState extends State with RouteAware { ), ], ), + Text( + Characters(logic.getUseKeyTypeStr( + keyInfo.startDate, keyInfo.endDate, keyInfo.keyType)) + .join('\u{200B}'), + style: TextStyle( + fontSize: 18.sp, color: AppColors.darkGrayTextColor), + ) ], ), ), diff --git a/star_lock/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart b/star_lock/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart index bc82bb14..191de81c 100644 --- a/star_lock/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart +++ b/star_lock/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart @@ -56,7 +56,7 @@ class _StarLockMainXHJPageState extends State widget: SafeArea( bottom: false, child: LockMallPage( - showAppBar: false, + allowReturn: false, ), ), logic: logic, diff --git a/star_lock/lib/mine/mall/lockMall_logic.dart b/star_lock/lib/mine/mall/lockMall_logic.dart index f7f61251..1532c65e 100644 --- a/star_lock/lib/mine/mall/lockMall_logic.dart +++ b/star_lock/lib/mine/mall/lockMall_logic.dart @@ -17,7 +17,7 @@ class LockMallLogic extends BaseGetXController { late LockMallState state; LockMallLogic({required bool allowReturn}) - : state = LockMallState(allowReturn: allowReturn); + : state = LockMallState(allowReturn: allowReturn ); //获取商城跳转地址 Future getMallURLRequest() async { @@ -35,6 +35,7 @@ class LockMallLogic extends BaseGetXController { }, onPageFinished: (String url) { state.webProgress.value = 1.0; + refreshGoBack(); }, onWebResourceError: (WebResourceError error) {}, onNavigationRequest: (NavigationRequest request) async { @@ -99,12 +100,25 @@ class LockMallLogic extends BaseGetXController { bool canGoBack = await state.mallWebView.canGoBack(); if (canGoBack) { await state.mallWebView.goBack(); - } else { - if (state.allowReturn) Get.back(); + } else if (state.allowReturn) { + Get.back(); } + refreshGoBack(); return false; } + //刷新当前路由状态 + void refreshGoBack(){ + //如果属于一直返回按钮,则根据是否有路由可以回退刷新 + if(state.allowReturn){ + return; + } + state.mallWebView.canGoBack().then((value) { + state.canGoBack = value; + update(); + }); + } + @override Future onReady() async { super.onReady(); diff --git a/star_lock/lib/mine/mall/lockMall_page.dart b/star_lock/lib/mine/mall/lockMall_page.dart index 6d648536..0a123dbb 100644 --- a/star_lock/lib/mine/mall/lockMall_page.dart +++ b/star_lock/lib/mine/mall/lockMall_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/app_settings/app_colors.dart'; +import 'package:star_lock/flavors.dart'; import 'package:star_lock/mine/mall/lockMall_logic.dart'; import 'package:star_lock/tools/titleAppBar.dart'; import 'package:webview_flutter/webview_flutter.dart'; @@ -30,36 +31,46 @@ class _LockMallPageState extends State { return GetBuilder( init: LockMallLogic(allowReturn: widget.allowReturn), builder: (LockMallLogic logic) { - return PopScope( - onPopInvoked: logic.canGoBack, - canPop: false, - child: Scaffold( - resizeToAvoidBottomInset: false, - backgroundColor: const Color(0xFFFFFFFF), - appBar: widget.showAppBar - ? TitleAppBar( - barTitle: getWebTitle(logic), - haveBack: true, - backgroundColor: AppColors.mainColor, - ) - : null, - body: Obx(() => Column( - children: [ - Container( - padding: EdgeInsets.only(bottom: 10.w), - child: LinearProgressIndicator( - value: logic.state.webProgress.value, - backgroundColor: Colors.grey, - valueColor: AlwaysStoppedAnimation( - AppColors.mainColor), - ), - ), - Expanded( - child: WebViewWidget( - controller: logic.state.mallWebView), - ), - ], - ))), + return Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: const Color(0xFFFFFFFF), + appBar: widget.showAppBar + ? TitleAppBar( + barTitle: getWebTitle(logic), + haveBack: logic.state.canGoBack || logic.state.allowReturn, + backgroundColor: F.sw( + defaultCall: () => AppColors.mainColor, + xhjCall: () => Colors.white), + titleColor: F.sw( + defaultCall: () => null, + xhjCall: () => AppColors.blackColor), + iconColor: F.sw( + defaultCall: () => null, + xhjCall: () => AppColors.blackColor), + backAction: () => logic.canGoBack(false), + ) + : null, + body: Obx(() => Column( + children: [ + PopScope( + onPopInvoked: logic.canGoBack, + canPop: false, + child: SizedBox(), + ), + Container( + padding: EdgeInsets.only(bottom: 10.w), + child: LinearProgressIndicator( + value: logic.state.webProgress.value, + backgroundColor: Colors.grey, + valueColor: + AlwaysStoppedAnimation(AppColors.mainColor), + ), + ), + Expanded( + child: WebViewWidget(controller: logic.state.mallWebView), + ), + ], + )), ); }); } diff --git a/star_lock/lib/mine/mall/lockMall_state.dart b/star_lock/lib/mine/mall/lockMall_state.dart index a9636f15..9864ccc7 100644 --- a/star_lock/lib/mine/mall/lockMall_state.dart +++ b/star_lock/lib/mine/mall/lockMall_state.dart @@ -9,6 +9,7 @@ class LockMallState { var lockMallUrl = "".obs; var webProgress = 0.0.obs; bool allowReturn; + bool canGoBack = false; late WebViewController mallWebView = initWebViewController(); //初始化webView控制器 diff --git a/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart b/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart index 61b95e05..b61e14f1 100644 --- a/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart +++ b/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart @@ -39,174 +39,215 @@ class _MinePersonInfoPageState extends State { : null, body: Column( children: [ - Obx(() => CommonItem( - leftTitel: TranslationLoader.lanKeys!.avatar!.tr, - rightTitle: "", - allHeight: 100.h, - isHaveLine: true, - isHaveDirection: true, - isHaveRightWidget: true, - rightWidget: ClipRRect( - borderRadius: BorderRadius.circular(36.w), - child: CustomNetworkImage( - url: state.headUrl.value, - defaultUrl: 'images/controls_user.png', - width: 72.w, - height: 72.w), + Container( + width: 1.sw, + height: 0.2.sw, + margin: EdgeInsets.symmetric(horizontal: 15.w), + padding: EdgeInsets.symmetric(horizontal: 25.w), + decoration: BoxDecoration( + image: const DecorationImage( + image: AssetImage('images/xhj_main_bg.jpg'), + fit: BoxFit.cover, + ), + borderRadius: BorderRadius.circular(20.r), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.15), + offset: const Offset(0, 0), + blurRadius: 10.r, + spreadRadius: 0, ), - action: () async { - _openModalBottomSheet(); - }, - )), - Obx(() => CommonItem( - leftTitel: TranslationLoader.lanKeys!.nickName!.tr, - rightTitle: state.mineInfoData.value.nickname != null - ? state.mineInfoData.value.nickname! - : "", - isHaveLine: true, - isHaveDirection: true, - action: () { - Navigator.pushNamed( - context, Routers.minePersonInfoEditNamePage, - arguments: {'mineInfoData': state.mineInfoData.value}) - .then((value) => logic.getUserInfoRequest()); - })), - Obx(() => CommonItem( - leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr, - rightTitle: state.mineInfoData.value.mobile != null - ? state.mineInfoData.value.mobile! - : TranslationLoader.lanKeys!.goBind!.tr, - isHaveLine: true, - isHaveDirection: true, - action: () { - //有手机号 则去修改手机号 否则去绑定新的手机号 isFrom:1 短信,2 邮箱 - if (state.mineInfoData.value.mobile!.isNotEmpty) { - Navigator.pushNamed( - context, Routers.mineUnbindPhoneOrEmailPage, - arguments: { - 'mobile': state.mineInfoData.value.mobile!, - 'isFrom': '1' - }).then((value) => logic.getUserInfoRequest()); - } else { - Navigator.pushNamed( - context, Routers.mineBindPhoneOrEmailPage, arguments: { - 'mobile': state.mineInfoData.value.mobile!, - 'isFrom': '1' - }).then((value) => logic.getUserInfoRequest()); - } - })), - Obx(() => CommonItem( - leftTitel: TranslationLoader.lanKeys!.email!.tr, - rightTitle: state.mineInfoData.value.email != null - ? state.mineInfoData.value.email! - : TranslationLoader.lanKeys!.goBind!.tr, - isHaveLine: true, - isHaveDirection: true, - action: () { - //有邮箱 则去修改邮箱 否则去绑定新的邮箱 isFrom:1 短信,2 邮箱 - if (state.mineInfoData.value.email!.isNotEmpty) { - Navigator.pushNamed( - context, Routers.mineUnbindPhoneOrEmailPage, - arguments: { - 'isFrom': '2', - 'email': state.mineInfoData.value.email! - }).then((value) => logic.getUserInfoRequest()); - } else { - Navigator.pushNamed( - context, Routers.mineBindPhoneOrEmailPage, arguments: { - 'isFrom': '2', - 'email': state.mineInfoData.value.email! - }).then((value) => logic.getUserInfoRequest()); - } - })), - CommonItem( - leftTitel: TranslationLoader.lanKeys!.resetPasswords!.tr, - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - Navigator.pushNamed( - context, Routers.minePersonInfoResetPasswordPage); - }), - Obx(() => CommonItem( - leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr, - rightTitle: - state.mineInfoData.value.haveSafeAnswer == 0 ? "去设置".tr : "", - isHaveLine: true, - isHaveDirection: true, - action: () { - if (state.mineInfoData.value.haveSafeAnswer == 0) { - Navigator.pushNamed( - context, Routers.minePersonInfoSetSafetyProblemPage) - .then((value) => logic.getUserInfoRequest()); - } else { - Navigator.pushNamed( - context, Routers.minePersonInfoViewSafetyProblemPage); - } - })), - Obx(() => CommonItem( - leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr, - rightTitle: state.mineInfoData.value.countryName != null - ? state.mineInfoData.value.countryName! - : "", - isHaveLine: true, - isHaveDirection: false)), - if (F.isLite == false && widget.showAbout) - CommonItem( - leftTitel: TranslationLoader.lanKeys!.valueAddedServices!.tr, - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.back(); - Get.toNamed(Routers.valueAddedServicesPage); - }, + ], ), - if (widget.showAbout) - CommonItem( - leftTitel: TranslationLoader.lanKeys!.set!.tr, - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.back(); - Get.toNamed(Routers.mineSetPage); - }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + '系统设置', + style: TextStyle( + color: AppColors.blackColor, + fontSize: 28.sp, + fontWeight: FontWeight.w600, + ), + ), + Text( + '系统的全局配置在此项内进行设置', + style: TextStyle( + color: AppColors.blackColor.withOpacity(0.6), + fontSize: 20.sp, + fontWeight: FontWeight.w600, + ), + ), + ], ), - if (widget.showAbout) - CommonItem( - leftTitel: TranslationLoader.lanKeys!.about!.tr, - isHaveLine: false, - isHaveDirection: true, - action: () { - Get.back(); - Get.toNamed(Routers.aboutPage); - }, + ), + SizedBox( + height: 20.h, + ), + Container( + margin: EdgeInsets.symmetric(vertical: 10.h, horizontal: 15.w), + child: ClipRRect( + borderRadius: BorderRadius.circular(20.r), + child: Column( + children: [ + Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.avatar!.tr, + rightTitle: "", + allHeight: 100.h, + isHaveLine: true, + isHaveDirection: true, + isHaveRightWidget: true, + rightWidget: ClipRRect( + borderRadius: BorderRadius.circular(36.w), + child: CustomNetworkImage( + url: state.headUrl.value, + defaultUrl: 'images/controls_user.png', + width: 72.w, + height: 72.w), + ), + action: () async { + _openModalBottomSheet(); + }, + )), + Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.nickName!.tr, + rightTitle: state.mineInfoData.value.nickname != null + ? state.mineInfoData.value.nickname! + : "", + isHaveLine: true, + isHaveDirection: true, + action: () { + Navigator.pushNamed( + context, Routers.minePersonInfoEditNamePage, + arguments: { + 'mineInfoData': state.mineInfoData.value + }).then((value) => logic.getUserInfoRequest()); + })), + Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr, + rightTitle: state.mineInfoData.value.mobile != null + ? state.mineInfoData.value.mobile! + : TranslationLoader.lanKeys!.goBind!.tr, + isHaveLine: true, + isHaveDirection: true, + action: () { + //有手机号 则去修改手机号 否则去绑定新的手机号 isFrom:1 短信,2 邮箱 + if (state.mineInfoData.value.mobile!.isNotEmpty) { + Navigator.pushNamed( + context, Routers.mineUnbindPhoneOrEmailPage, + arguments: { + 'mobile': state.mineInfoData.value.mobile!, + 'isFrom': '1' + }).then((value) => logic.getUserInfoRequest()); + } else { + Navigator.pushNamed( + context, Routers.mineBindPhoneOrEmailPage, + arguments: { + 'mobile': state.mineInfoData.value.mobile!, + 'isFrom': '1' + }).then((value) => logic.getUserInfoRequest()); + } + })), + Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.email!.tr, + rightTitle: state.mineInfoData.value.email != null + ? state.mineInfoData.value.email! + : TranslationLoader.lanKeys!.goBind!.tr, + isHaveLine: true, + isHaveDirection: true, + action: () { + //有邮箱 则去修改邮箱 否则去绑定新的邮箱 isFrom:1 短信,2 邮箱 + if (state.mineInfoData.value.email!.isNotEmpty) { + Navigator.pushNamed( + context, Routers.mineUnbindPhoneOrEmailPage, + arguments: { + 'isFrom': '2', + 'email': state.mineInfoData.value.email! + }).then((value) => logic.getUserInfoRequest()); + } else { + Navigator.pushNamed( + context, Routers.mineBindPhoneOrEmailPage, + arguments: { + 'isFrom': '2', + 'email': state.mineInfoData.value.email! + }).then((value) => logic.getUserInfoRequest()); + } + })), + CommonItem( + leftTitel: + TranslationLoader.lanKeys!.resetPasswords!.tr, + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + Navigator.pushNamed( + context, Routers.minePersonInfoResetPasswordPage); + }), + Obx(() => CommonItem( + leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr, + rightTitle: state.mineInfoData.value.haveSafeAnswer == 0 + ? "去设置".tr + : "", + isHaveLine: true, + isHaveDirection: true, + action: () { + if (state.mineInfoData.value.haveSafeAnswer == 0) { + Navigator.pushNamed(context, + Routers.minePersonInfoSetSafetyProblemPage) + .then((value) => logic.getUserInfoRequest()); + } else { + Navigator.pushNamed(context, + Routers.minePersonInfoViewSafetyProblemPage); + } + })), + Obx(() => CommonItem( + leftTitel: + TranslationLoader.lanKeys!.countryAndRegion!.tr, + rightTitle: state.mineInfoData.value.countryName != null + ? state.mineInfoData.value.countryName! + : "", + isHaveLine: true, + isHaveDirection: false)), + if (F.isLite == false && widget.showAbout) + CommonItem( + leftTitel: + TranslationLoader.lanKeys!.valueAddedServices!.tr, + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.back(); + Get.toNamed(Routers.valueAddedServicesPage); + }, + ), + if (widget.showAbout) + CommonItem( + leftTitel: TranslationLoader.lanKeys!.set!.tr, + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.back(); + Get.toNamed(Routers.mineSetPage); + }, + ), + if (widget.showAbout) + CommonItem( + leftTitel: TranslationLoader.lanKeys!.about!.tr, + isHaveLine: false, + isHaveDirection: true, + action: () { + Get.back(); + Get.toNamed(Routers.aboutPage); + }, + ), + ], + ), ), + ), ], )); } - // 显示权限被永久拒绝的提示对话框 - // void showPermissionDeniedDialog() { - // showDialog( - // context: context, - // builder: (BuildContext context) { - // return AlertDialog( - // title: const Text('权限被拒绝'), - // content: const Text('请手动在系统设置中开启相册权限以继续使用应用。'), - // actions: [ - // TextButton( - // child: const Text('去设置'), - // onPressed: () { - // Navigator.of(context).pop(); // 关闭对话框 - // openAppSettings(); // 打开系统设置页面 - // }, - // ), - // ], - // ); - // }, - // ); - // } - Future _openModalBottomSheet() async { showModalBottomSheet( context: context, diff --git a/star_lock/lib/tools/commonItem.dart b/star_lock/lib/tools/commonItem.dart index 9b785898..3cf2bf79 100644 --- a/star_lock/lib/tools/commonItem.dart +++ b/star_lock/lib/tools/commonItem.dart @@ -83,7 +83,7 @@ class CommonItem extends StatelessWidget { ), ], ), - isHaveDirection! ? SizedBox(width: 3.w) : Container(), + isHaveDirection! ? SizedBox(width: 15.w) : Container(), isHaveDirection! ? Image.asset( 'images/icon_right_grey.png', diff --git a/star_lock/lib/tools/titleAppBar.dart b/star_lock/lib/tools/titleAppBar.dart index 5d59fec9..57c8265f 100644 --- a/star_lock/lib/tools/titleAppBar.dart +++ b/star_lock/lib/tools/titleAppBar.dart @@ -40,8 +40,6 @@ class TitleAppBar extends AppBar { class _TitleAppBarState extends State { @override Widget build(BuildContext context) { - Color defaultColor = F.sw( - defaultCall: () => Colors.white, xhjCall: () => AppColors.blackColor); return AppBar( elevation: 0, leading: widget.haveOtherLeftWidget! @@ -49,7 +47,7 @@ class _TitleAppBarState extends State { : (widget.haveBack ?? false ? IconButton( icon: Icon(Icons.arrow_back_ios, - color: widget.iconColor ?? defaultColor), + color: widget.iconColor ?? Colors.white), onPressed: () { if (widget.backAction != null) { widget.backAction!(); @@ -61,14 +59,12 @@ class _TitleAppBarState extends State { } }) : Container()), - backgroundColor: F.sw( - defaultCall: () => widget.backgroundColor ?? defaultColor, - xhjCall: () => Colors.white), + backgroundColor: widget.backgroundColor ?? Colors.white, title: widget.haveTitleWidget! ? widget.titleWidget : Text(widget.barTitle ?? '', style: TextStyle( - color: widget.titleColor ?? defaultColor, + color: widget.titleColor ?? Colors.white, fontSize: 28.sp, fontWeight: FontWeight.w600)), centerTitle: true,