diff --git a/star_lock/images/icon_lock_circle.png b/star_lock/images/icon_lock_circle.png new file mode 100644 index 00000000..8ff61791 Binary files /dev/null and b/star_lock/images/icon_lock_circle.png differ diff --git a/star_lock/images/lan/lan_en.json b/star_lock/images/lan/lan_en.json index 2c32a5fc..5329363d 100644 --- a/star_lock/images/lan/lan_en.json +++ b/star_lock/images/lan/lan_en.json @@ -792,5 +792,14 @@ "全选":"Select all", "请选择要删除的视频":"Please select the video you want to delete", "请选择要下载的视频":"Please select the video you want to download", - "欢迎使用":"Welcome to use" + "欢迎使用":"Welcome to use", + "用户协议和隐私政策概要": "Summary of User Agreement and Privacy Policy", + "协议概要": "Protocol Summary", + "感谢您使用本应用。我们非常重视您的个人信息和隐私保护,在使用本产品之前,请认真阅读":"Thank you for using this application. We attach great importance to your personal information and privacy protection. Before using this product, please read it carefully", + "《用户协议》":"《User Agreement》", + "和":"and", + "《隐私政策》": "《Privacy Policy》", + "的全部内容。点击“同意”即表示您同意并接受全部条款。若选择不同意,将无法使用我们的产品和服务,并会退出应用。": "The entire content of. By clicking \"Agree\", you agree and accept all terms. If you choose not to agree, you will not be able to use our products and services and will exit the application.", + "不同意":"Disagree", + "同意":"agree" } diff --git a/star_lock/images/lan/lan_keys.json b/star_lock/images/lan/lan_keys.json index 2f60d178..1e99b098 100644 --- a/star_lock/images/lan/lan_keys.json +++ b/star_lock/images/lan/lan_keys.json @@ -791,5 +791,14 @@ "全选":"全选", "请选择要删除的视频":"请选择要删除的视频", "请选择要下载的视频":"请选择要下载的视频", - "欢迎使用":"欢迎使用" + "欢迎使用":"欢迎使用", + "用户协议和隐私政策概要": "用户协议和隐私政策概要", + "协议概要": "协议概要", + "感谢您使用本应用。我们非常重视您的个人信息和隐私保护,在使用本产品之前,请认真阅读":"感谢您使用本应用。我们非常重视您的个人信息和隐私保护,在使用本产品之前,请认真阅读", + "《用户协议》":"《用户协议》", + "和":"和", + "《隐私政策》": "《隐私政策》", + "的全部内容。点击“同意”即表示您同意并接受全部条款。若选择不同意,将无法使用我们的产品和服务,并会退出应用。": "的全部内容。点击“同意”即表示您同意并接受全部条款。若选择不同意,将无法使用我们的产品和服务,并会退出应用。", + "不同意":"不同意", + "同意":"同意" } diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index 622abcce..dca1f068 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -794,5 +794,15 @@ "全选":"全选", "请选择要删除的视频":"请选择要删除的视频", "请选择要下载的视频":"请选择要下载的视频", - "欢迎使用":"欢迎使用" + "欢迎使用":"欢迎使用", + "用户协议和隐私政策概要": "用户协议和隐私政策概要", + "协议概要": "协议概要", + "感谢您使用本应用。我们非常重视您的个人信息和隐私保护,在使用本产品之前,请认真阅读":"感谢您使用本应用。我们非常重视您的个人信息和隐私保护,在使用本产品之前,请认真阅读", + "《用户协议》":"《用户协议》", + "和":"和", + "《隐私政策》": "《隐私政策》", + "的全部内容。点击“同意”即表示您同意并接受全部条款。若选择不同意,将无法使用我们的产品和服务,并会退出应用。": "的全部内容。点击“同意”即表示您同意并接受全部条款。若选择不同意,将无法使用我们的产品和服务,并会退出应用。", + "不同意":"不同意", + "同意":"同意" + } diff --git a/star_lock/images/main/icon_iris.png b/star_lock/images/main/icon_iris.png index 32272c8a..92d7c138 100644 Binary files a/star_lock/images/main/icon_iris.png and b/star_lock/images/main/icon_iris.png differ diff --git a/star_lock/images/main/icon_palm.png b/star_lock/images/main/icon_palm.png index 704186c3..8a90d41a 100644 Binary files a/star_lock/images/main/icon_palm.png and b/star_lock/images/main/icon_palm.png differ diff --git a/star_lock/images/mine/icon_mine_isPlus.png b/star_lock/images/mine/icon_mine_isPlus.png new file mode 100644 index 00000000..bbbd4138 Binary files /dev/null and b/star_lock/images/mine/icon_mine_isPlus.png differ diff --git a/star_lock/images/mine/icon_mine_noPlus.png b/star_lock/images/mine/icon_mine_noPlus.png new file mode 100644 index 00000000..a857d0b2 Binary files /dev/null and b/star_lock/images/mine/icon_mine_noPlus.png differ diff --git a/star_lock/ios/Runner/AppDelegate.m b/star_lock/ios/Runner/AppDelegate.m index 236ad0e6..87707e2d 100644 --- a/star_lock/ios/Runner/AppDelegate.m +++ b/star_lock/ios/Runner/AppDelegate.m @@ -127,25 +127,25 @@ /* * App处于启动状态时,通知打开回调 */ -- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo { - NSLog(@"Receive one notification."); - // 取得APNS通知内容 - NSDictionary *aps = [userInfo valueForKey:@"aps"]; - // 内容 - NSString *content = [aps valueForKey:@"alert"]; - // badge数量 - NSInteger badge = [[aps valueForKey:@"badge"] integerValue]; - // 播放声音 - NSString *sound = [aps valueForKey:@"sound"]; - // 取得Extras字段内容 - NSString *Extras = [userInfo valueForKey:@"Extras"]; //服务端中Extras字段,key是自己定义的 - NSLog(@"content = [%@], badge = [%ld], sound = [%@], Extras = [%@]", content, (long)badge, sound, Extras); - // iOS badge 清0 - application.applicationIconBadgeNumber = 0; - // 通知打开回执上报 - // [CloudPushSDK handleReceiveRemoteNotification:userInfo];(Deprecated from v1.8.1) - [CloudPushSDK sendNotificationAck:userInfo]; -} +//- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo { +// NSLog(@"Receive one notification."); + // 取得APNS通知内容 +// NSDictionary *aps = [userInfo valueForKey:@"aps"]; +// // 内容 +// NSString *content = [aps valueForKey:@"alert"]; +// // badge数量 +// NSInteger badge = [[aps valueForKey:@"badge"] integerValue]; +// // 播放声音 +// NSString *sound = [aps valueForKey:@"sound"]; +// // 取得Extras字段内容 +// NSString *Extras = [userInfo valueForKey:@"Extras"]; //服务端中Extras字段,key是自己定义的 +// NSLog(@"content = [%@], badge = [%ld], sound = [%@], Extras = [%@]", content, (long)badge, sound, Extras); +// // iOS badge 清0 +// application.applicationIconBadgeNumber = 0; +// // 通知打开回执上报 +// // [CloudPushSDK handleReceiveRemoteNotification:userInfo];(Deprecated from v1.8.1) +// [CloudPushSDK sendNotificationAck:userInfo]; +//} diff --git a/star_lock/lib/app_settings/app_settings.dart b/star_lock/lib/app_settings/app_settings.dart index d70682a7..e63f061c 100644 --- a/star_lock/lib/app_settings/app_settings.dart +++ b/star_lock/lib/app_settings/app_settings.dart @@ -6,7 +6,7 @@ class AppLog { static bool _onlyError = false; static showLog({required bool printLog, bool? onlyError}){ - _printLog = printLog ?? false; + _printLog = printLog; _onlyError = onlyError ?? false; } static log(String msg,{bool? error}){ diff --git a/star_lock/lib/main/lockMian/lockList/lockList_page.dart b/star_lock/lib/main/lockMian/lockList/lockList_page.dart index 2dc91e9b..66f07890 100644 --- a/star_lock/lib/main/lockMian/lockList/lockList_page.dart +++ b/star_lock/lib/main/lockMian/lockList/lockList_page.dart @@ -1,8 +1,8 @@ - import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:get/get.dart'; +import 'package:star_lock/flavors.dart'; import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; @@ -16,7 +16,8 @@ import 'lockList_logic.dart'; class LockListPage extends StatefulWidget { final LockListInfoGroupEntity lockListInfoGroupEntity; - const LockListPage({Key? key, required this.lockListInfoGroupEntity}) : super(key: key); + const LockListPage({Key? key, required this.lockListInfoGroupEntity}) + : super(key: key); @override State createState() => _LockListPageState(); @@ -30,57 +31,38 @@ class _LockListPageState extends State with RouteAware { @override Widget build(BuildContext context) { - if(widget.lockListInfoGroupEntity.pageNo == 1){ + if (widget.lockListInfoGroupEntity.pageNo == 1) { groupDataList = []; } - groupDataList.addAll(widget.lockListInfoGroupEntity.groupList as Iterable); + groupDataList.addAll( + widget.lockListInfoGroupEntity.groupList as Iterable); - return ListView.separated( - itemCount: groupDataList.length, - itemBuilder: (context, index) { - GroupList itemData = groupDataList[index]; - return _buildLockExpandedList(context, index, itemData); - }, - shrinkWrap: true, - physics:const AlwaysScrollableScrollPhysics(), - separatorBuilder: (context, index) { - return const Divider( - height: 1, - color: AppColors.greyLineColor, - ); - }); + return Scaffold( + body: ListView.separated( + itemCount: groupDataList.length, + itemBuilder: (context, index) { + GroupList itemData = groupDataList[index]; + return _buildLockExpandedList(context, index, itemData); + }, + shrinkWrap: true, + physics: const AlwaysScrollableScrollPhysics(), + separatorBuilder: (context, index) { + return const Divider( + height: 1, + color: AppColors.greyLineColor, + ); + }), + ); } - // //设备多层级列表 - // Widget _buildListView(BuildContext context, List itemList) { - // return ListView.separated( - // itemCount: itemList.length, - // itemBuilder: (context, index) { - // GroupList itemData = itemList[index]; - // return _buildLockExpandedList(context, index, itemData); - // }, - // shrinkWrap: true, - // separatorBuilder: (context, index) { - // return const Divider( - // height: 1, - // color: AppColors.greyLineColor, - // ); - // }); - // } - //设备多层级列表 Widget _buildLockExpandedList(context, index, GroupList itemData) { List lockItemList = itemData.lockList ?? []; return LockListGroupPage( onTap: () { - // selectGroupIdList.add(index); - // clickIndex = index; //是否选中组 if (itemData.isChecked) { - - }else{ - - } + } else {} setState(() {}); }, typeImgList: const [], @@ -88,25 +70,25 @@ class _LockListPageState extends State with RouteAware { child: ListView.separated( itemCount: lockItemList.length, shrinkWrap: true, - physics:const NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), separatorBuilder: (context, index) { return const Divider(height: 1, color: AppColors.greyLineColor); }, itemBuilder: (c, index) { LockListInfoItemEntity keyInfo = lockItemList[index]; bool isLast = false; - if (lockItemList.length == index+1){ + if (lockItemList.length == index + 1) { isLast = true; } return Slidable( - key:ValueKey(keyInfo.keyId), + key: ValueKey(keyInfo.keyId), endActionPane: ActionPane( extentRatio: 0.2, motion: const ScrollMotion(), children: [ SlidableAction( - onPressed: (BuildContext context){ + onPressed: (BuildContext context) { state.lockListInfoItemEntity = keyInfo; logic.deleyLockLogicOfRoles(); }, @@ -118,15 +100,22 @@ class _LockListPageState extends State with RouteAware { ], ), child: lockInfoListItem(keyInfo, isLast, () { - if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)){ + if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || + keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == + XSConstantMacro.keyStatusWaitIneffective)) { logic.showToast("您的钥匙未生效".tr); return; } - if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)){ + if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || + keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) { logic.showToast("您的钥匙已冻结".tr); return; } - if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)){ + if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || + keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) { logic.showToast("您的钥匙已过期".tr); return; } @@ -137,40 +126,28 @@ class _LockListPageState extends State with RouteAware { }); }), ); - - // return lockInfoListItem(keyInfo, isLast, () { - // if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)){ - // logic.showToast("您的钥匙未生效"); - // // return; - // } - // if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)){ - // logic.showToast("您的钥匙已冻结"); - // // return; - // } - // if((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)){ - // logic.showToast("您的钥匙已过期"); - // // return; - // } - // Get.toNamed(Routers.lockDetailMainPage, arguments: { - // // "lockMainEntity": widget.lockMainEntity, - // "keyInfo": keyInfo, - // "isOnlyOneData": false, - // }); - // }); }), ); } - Widget lockInfoListItem(LockListInfoItemEntity keyInfo, bool isLast, Function() action) { + Widget lockInfoListItem( + LockListInfoItemEntity keyInfo, bool isLast, Function() action) { return GestureDetector( onTap: action, child: Container( // height: 122.h, - margin: isLast ? EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w, bottom: 20.w) : EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), + margin: isLast + ? EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w, bottom: 20.w) + : EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), decoration: BoxDecoration( - color: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && - (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective || keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen || keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) - ? AppColors.greyBackgroundColor : Colors.white, + color: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || + keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == + XSConstantMacro.keyStatusWaitIneffective || + keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen || + keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) + ? AppColors.greyBackgroundColor + : Colors.white, borderRadius: BorderRadius.circular(20.w), ), child: Column( @@ -190,7 +167,11 @@ class _LockListPageState extends State with RouteAware { Text( keyInfo.lockAlias!, style: TextStyle( - fontSize: 24.sp, fontWeight: FontWeight.w500, color: keyInfo.passageMode == 1 ? AppColors.openPassageModeColor : AppColors.darkGrayTextColor), + fontSize: 24.sp, + fontWeight: FontWeight.w500, + color: keyInfo.passageMode == 1 + ? AppColors.openPassageModeColor + : AppColors.darkGrayTextColor), ), ], ), @@ -213,7 +194,7 @@ class _LockListPageState extends State with RouteAware { SizedBox(height: 5.h), Visibility( visible: keyInfo.passageMode == 1 ? true : false, - child:Row( + child: Row( children: [ SizedBox(width: 30.w), Container( @@ -222,42 +203,55 @@ class _LockListPageState extends State with RouteAware { borderRadius: BorderRadius.circular(5.w), color: AppColors.openPassageModeColor, ), - child: Text("常开模式开启".tr, style: TextStyle(fontSize: 18.sp, color: AppColors.appBarIconColor)), + child: Text("常开模式开启".tr, + style: TextStyle( + fontSize: 18.sp, + color: AppColors.appBarIconColor)), ), - ], )), SizedBox(height: 5.h), Visibility( visible: keyInfo.lockSetting!.remoteUnlock == 1 ? true : false, - child:Row( + child: Row( children: [ SizedBox(width: 30.w), Text( - "远程开锁".tr, style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor), + "远程开锁".tr, + style: TextStyle( + fontSize: 18.sp, color: AppColors.darkGrayTextColor), ), ], - )), + )), SizedBox(height: 20.h), Visibility( - visible: ( - (keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && - (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective || keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen || keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) + visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || + keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == + XSConstantMacro.keyStatusWaitIneffective || + keyInfo.keyStatus == + XSConstantMacro.keyStatusFrozen || + keyInfo.keyStatus == + XSConstantMacro.keyStatusExpired)) ? true : false, - // visible: true, - child:Row( + // visible: true, + child: Row( children: [ SizedBox(width: 30.w), Container( padding: EdgeInsets.only(right: 5.w, left: 5.w), decoration: BoxDecoration( borderRadius: BorderRadius.circular(5.w), - color: DateTool().compareTimeIsOvertime(keyInfo.endDate!) ? AppColors.listTimeYellowColor : AppColors.mainColor, - ), - child: Text(logic.getKeyEffective(keyInfo), style: TextStyle(fontSize: 18.sp, color: Colors.white) - // child: Text(logic.compareTimeIsOvertime(keyInfo.endDate!) ? "已过期" : "余${logic.compareTimeGetDaysFromNow(keyInfo.endDate!)}天", style: TextStyle(fontSize: 18.sp, color: Colors.white) + color: + DateTool().compareTimeIsOvertime(keyInfo.endDate!) + ? AppColors.listTimeYellowColor + : AppColors.mainColor, ), + child: Text(logic.getKeyEffective(keyInfo), + style: TextStyle(fontSize: 18.sp, color: Colors.white) + // child: Text(logic.compareTimeIsOvertime(keyInfo.endDate!) ? "已过期" : "余${logic.compareTimeGetDaysFromNow(keyInfo.endDate!)}天", style: TextStyle(fontSize: 18.sp, color: Colors.white) + ), ), ], )), @@ -329,5 +323,4 @@ class _LockListPageState extends State with RouteAware { // BlueManage().stopScan(); state.ifCurrentScreen.value = false; } - } diff --git a/star_lock/lib/main/lockMian/lockList/lockList_xhj_page.dart b/star_lock/lib/main/lockMian/lockList/lockList_xhj_page.dart new file mode 100644 index 00000000..b283e009 --- /dev/null +++ b/star_lock/lib/main/lockMian/lockList/lockList_xhj_page.dart @@ -0,0 +1,507 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_slidable/flutter_slidable.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/flavors.dart'; + +import '../../../appRouters.dart'; +import '../../../app_settings/app_colors.dart'; +import '../../../common/XSConstantMacro/XSConstantMacro.dart'; +import '../../../tools/appRouteObserver.dart'; +import '../../../tools/dateTool.dart'; +import '../entity/lockListInfo_entity.dart'; +import 'lockListGroup_page.dart'; +import 'lockList_logic.dart'; + +class LockListXHJPage extends StatefulWidget { + final LockListInfoGroupEntity lockListInfoGroupEntity; + + const LockListXHJPage({Key? key, required this.lockListInfoGroupEntity}) + : super(key: key); + + @override + State createState() => _LockListXHJPageState(); +} + +class _LockListXHJPageState extends State with RouteAware { + final logic = Get.put(LockListLogic()); + final state = Get.find().state; + + var groupDataList = []; + + @override + Widget build(BuildContext context) { + if (widget.lockListInfoGroupEntity.pageNo == 1) { + groupDataList = []; + } + groupDataList.addAll( + widget.lockListInfoGroupEntity.groupList as Iterable); + + return Scaffold( + floatingActionButton: FloatingActionButton( + shape: const CircleBorder(), + onPressed: () { + Get.toNamed(Routers.selectLockTypePage); + }, + backgroundColor: AppColors.mainColor, + child: const Icon( + Icons.add, + color: AppColors.darkGrayTextColor, + ), + ), + body: ListView.separated( + itemCount: groupDataList.length, + itemBuilder: (context, index) { + GroupList itemData = groupDataList[index]; + return _buildLockExpandedList(context, index, itemData); + }, + shrinkWrap: true, + physics: const AlwaysScrollableScrollPhysics(), + separatorBuilder: (context, index) { + return const Divider( + height: 1, + color: AppColors.greyLineColor, + ); + }), + ); + } + + //设备多层级列表 + Widget _buildLockExpandedList(context, index, GroupList itemData) { + List lockItemList = itemData.lockList ?? []; + return LockListGroupPage( + onTap: () { + //是否选中组 + if (itemData.isChecked) { + } else {} + setState(() {}); + }, + typeImgList: const [], + groupItem: itemData, + child: ListView.separated( + itemCount: lockItemList.length, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + separatorBuilder: (context, index) { + return const Divider(height: 1, color: AppColors.greyLineColor); + }, + itemBuilder: (c, index) { + LockListInfoItemEntity keyInfo = lockItemList[index]; + bool isLast = false; + if (lockItemList.length == index + 1) { + isLast = true; + } + + return Slidable( + key: ValueKey(keyInfo.keyId), + endActionPane: ActionPane( + extentRatio: 0.2, + motion: const ScrollMotion(), + children: [ + SlidableAction( + onPressed: (BuildContext context) { + state.lockListInfoItemEntity = keyInfo; + logic.deleyLockLogicOfRoles(); + }, + backgroundColor: Colors.red, + foregroundColor: Colors.white, + label: '删除'.tr, + padding: EdgeInsets.only(left: 5.w, right: 5.w), + ), + ], + ), + child: lockInfoListItem(keyInfo, isLast, () { + if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || + keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == + XSConstantMacro.keyStatusWaitIneffective)) { + logic.showToast("您的钥匙未生效".tr); + return; + } + if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || + keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) { + logic.showToast("您的钥匙已冻结".tr); + return; + } + if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || + keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) { + logic.showToast("您的钥匙已过期".tr); + return; + } + Get.toNamed(Routers.lockDetailMainPage, arguments: { + // "lockMainEntity": widget.lockMainEntity, + "keyInfo": keyInfo, + "isOnlyOneData": false, + }); + }), + ); + }), + ); + } + + Widget lockInfoListItem( + LockListInfoItemEntity keyInfo, bool isLast, Function() action) { + return F.sw( + defaultCall: () => _defaultLockInfoListItem(keyInfo, isLast, action), + xhjCall: () => _xhjLockInfoListItem(keyInfo, isLast, action)); + } + + Widget _defaultLockInfoListItem( + LockListInfoItemEntity keyInfo, bool isLast, Function() action) { + return GestureDetector( + onTap: action, + child: Container( + // height: 122.h, + margin: isLast + ? EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w, bottom: 20.w) + : EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), + decoration: BoxDecoration( + color: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || + keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == + XSConstantMacro.keyStatusWaitIneffective || + keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen || + keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) + ? AppColors.greyBackgroundColor + : Colors.white, + borderRadius: BorderRadius.circular(20.w), + ), + child: Column( + // mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 20.h, + ), + Row( + children: [ + SizedBox(width: 30.w), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + keyInfo.lockAlias!, + style: TextStyle( + fontSize: 24.sp, + fontWeight: FontWeight.w500, + color: keyInfo.passageMode == 1 + ? AppColors.openPassageModeColor + : AppColors.darkGrayTextColor), + ), + ], + ), + ), + SizedBox(width: 20.w), + Image.asset( + logic.showElectricIcon(keyInfo.electricQuantity!), + width: 30.w, + height: 24.w, + ), + SizedBox(width: 2.w), + Text( + "${keyInfo.electricQuantity!}%", + style: TextStyle( + fontSize: 18.sp, color: AppColors.darkGrayTextColor), + ), + SizedBox(width: 30.w), + ], + ), + SizedBox(height: 5.h), + Visibility( + visible: keyInfo.passageMode == 1 ? true : false, + child: Row( + children: [ + SizedBox(width: 30.w), + Container( + padding: EdgeInsets.only(right: 5.w, left: 5.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.w), + color: AppColors.openPassageModeColor, + ), + child: Text("常开模式开启".tr, + style: TextStyle( + fontSize: 18.sp, + color: AppColors.appBarIconColor)), + ), + ], + )), + SizedBox(height: 5.h), + Visibility( + visible: keyInfo.lockSetting!.remoteUnlock == 1 ? true : false, + child: Row( + children: [ + SizedBox(width: 30.w), + Text( + "远程开锁".tr, + style: TextStyle( + fontSize: 18.sp, color: AppColors.darkGrayTextColor), + ), + ], + )), + SizedBox(height: 20.h), + Visibility( + visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || + keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == + XSConstantMacro.keyStatusWaitIneffective || + keyInfo.keyStatus == + XSConstantMacro.keyStatusFrozen || + keyInfo.keyStatus == + XSConstantMacro.keyStatusExpired)) + ? true + : false, + // visible: true, + child: Row( + children: [ + SizedBox(width: 30.w), + Container( + padding: EdgeInsets.only(right: 5.w, left: 5.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.w), + color: + DateTool().compareTimeIsOvertime(keyInfo.endDate!) + ? AppColors.listTimeYellowColor + : AppColors.mainColor, + ), + child: Text(logic.getKeyEffective(keyInfo), + style: TextStyle(fontSize: 18.sp, color: Colors.white) + // child: Text(logic.compareTimeIsOvertime(keyInfo.endDate!) ? "已过期" : "余${logic.compareTimeGetDaysFromNow(keyInfo.endDate!)}天", style: TextStyle(fontSize: 18.sp, color: Colors.white) + ), + ), + ], + )), + SizedBox(height: 5.h), + Row( + children: [ + SizedBox(width: 30.w), + Text( + "${logic.getUseKeyTypeStr(keyInfo.startDate, keyInfo.endDate, keyInfo.keyType)}/${keyInfo.isLockOwner == 1 ? '超级管理员'.tr : (keyInfo.keyRight == 1 ? "授权管理员".tr : "普通用户".tr)}", + style: TextStyle( + fontSize: 18.sp, color: AppColors.darkGrayTextColor), + ), + ], + ), + SizedBox(height: 20.h), + ], + ), + ), + ); + } + + Widget _xhjLockInfoListItem( + LockListInfoItemEntity keyInfo, bool isLast, Function() action) { + return GestureDetector( + onTap: action, + child: Container( + // height: 122.h, + margin: isLast + ? EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w, bottom: 20.w) + : EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), + decoration: BoxDecoration( + color: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || + keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == + XSConstantMacro.keyStatusWaitIneffective || + keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen || + keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) + ? AppColors.greyBackgroundColor + : Colors.white, + borderRadius: BorderRadius.circular(20.w), + ), + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 30.w, vertical: 20.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Image.asset( + 'images/icon_lock_circle.png', + width: 32.r, + height: 32.r, + color: AppColors.mainColor, + ), + SizedBox( + width: 8.w, + ), + Expanded( + child: Text(keyInfo.lockAlias!, + style: TextStyle( + fontSize: 32.sp, + fontWeight: FontWeight.w500, + color: keyInfo.passageMode == 1 + ? AppColors.openPassageModeColor + : AppColors.darkGrayTextColor, + overflow: TextOverflow.ellipsis, + ), + maxLines: 1), + ), + Text( + logic.getUseKeyTypeStr( + keyInfo.startDate, keyInfo.endDate, keyInfo.keyType), + style: TextStyle( + fontSize: 18.sp, color: AppColors.darkGrayTextColor), + ) + ], + ), + Visibility( + visible: keyInfo.passageMode == 1 ? true : false, + child: Padding( + padding: EdgeInsets.only(top: 5.h), + child: Row( + children: [ + Container( + padding: EdgeInsets.only(right: 5.w, left: 5.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.w), + color: AppColors.openPassageModeColor, + ), + child: Text("常开模式开启".tr, + style: TextStyle( + fontSize: 18.sp, + color: AppColors.appBarIconColor)), + ), + ], + ), + )), + Visibility( + visible: + keyInfo.lockSetting!.remoteUnlock == 1 ? true : false, + child: Padding( + padding: EdgeInsets.only(top: 5.h), + child: Row( + children: [ + Text( + "远程开锁".tr, + style: TextStyle( + fontSize: 18.sp, + color: AppColors.darkGrayTextColor), + ), + ], + ), + )), + SizedBox(height: 20.h), + Visibility( + visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || + keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == + XSConstantMacro.keyStatusWaitIneffective || + keyInfo.keyStatus == + XSConstantMacro.keyStatusFrozen || + keyInfo.keyStatus == + XSConstantMacro.keyStatusExpired)) + ? true + : false, + child: Padding( + padding: EdgeInsets.only(top: 20.h), + child: Row( + children: [ + Container( + padding: EdgeInsets.only(right: 5.w, left: 5.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.w), + color: DateTool() + .compareTimeIsOvertime(keyInfo.endDate!) + ? AppColors.listTimeYellowColor + : AppColors.mainColor, + ), + child: Text(logic.getKeyEffective(keyInfo), + style: TextStyle( + fontSize: 18.sp, color: Colors.white) + // child: Text(logic.compareTimeIsOvertime(keyInfo.endDate!) ? "已过期" : "余${logic.compareTimeGetDaysFromNow(keyInfo.endDate!)}天", style: TextStyle(fontSize: 18.sp, color: Colors.white) + ), + ), + ], + ), + )), + SizedBox(height: 5.h), + Row( + children: [ + Expanded( + child: Text( + keyInfo.isLockOwner == 1 + ? '超级管理员'.tr + : (keyInfo.keyRight == 1 ? "授权管理员".tr : "普通用户".tr), + style: TextStyle( + fontSize: 18.sp, color: AppColors.darkGrayTextColor), + ), + ), + Image.asset( + logic.showElectricIcon(keyInfo.electricQuantity!), + width: 30.w, + height: 24.w, + ), + SizedBox(width: 2.w), + Text( + "${keyInfo.electricQuantity!}%", + style: TextStyle( + fontSize: 18.sp, color: AppColors.darkGrayTextColor), + ), + ], + ), + Text( + keyInfo.hwVersion ?? "", + style: TextStyle( + fontSize: 18.sp, color: AppColors.darkGrayTextColor), + ), + ], + ), + ), + ), + ); + } + + @override + void didChangeDependencies() { + // TODO: implement didChangeDependencies + super.didChangeDependencies(); + + /// 路由订阅 + AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!); + } + + @override + void dispose() { + // TODO: implement dispose + /// 取消路由订阅 + AppRouteObserver().routeObserver.unsubscribe(this); + super.dispose(); + } + + /// 从上级界面进入 当前界面即将出现 + @override + void didPush() { + super.didPush(); + state.ifCurrentScreen.value = true; + } + + /// 返回上一个界面 当前界面即将消失 + @override + void didPop() { + super.didPop(); + logic.cancelBlueConnetctToastTimer(); + + // BlueManage().stopScan(); + state.ifCurrentScreen.value = false; + } + + /// 从下级返回 当前界面即将出现 + @override + void didPopNext() { + super.didPopNext(); + state.ifCurrentScreen.value = true; + } + + /// 进入下级界面 当前界面即将消失 + @override + void didPushNext() { + super.didPushNext(); + logic.cancelBlueConnetctToastTimer(); + + // BlueManage().stopScan(); + state.ifCurrentScreen.value = false; + } +} diff --git a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart index 3993ee28..ec382028 100644 --- a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart +++ b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart @@ -4,6 +4,7 @@ import 'package:flutter/scheduler.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/main/lockMian/lockList/lockList_xhj_page.dart'; import 'package:star_lock/tools/noData.dart'; import 'package:star_lock/tools/submitBtn.dart'; @@ -118,6 +119,10 @@ class _StarLockMainPageState extends State with BaseWidget { Widget getDataReturnUI(int type) { Widget returnWidget; + + if (type == 1) { + type = F.sw(defaultCall: () => 1, xhjCall: () => 2); + } switch (type) { case 0: // 显示无数据模式 @@ -134,8 +139,11 @@ class _StarLockMainPageState extends State with BaseWidget { case 2: // 有多条数据 Storage.setBool(ifIsDemoModeOrNot, false); - returnWidget = LockListPage( - lockListInfoGroupEntity: state.lockListInfoGroupEntity.value); + returnWidget = F.sw( + defaultCall: () => LockListPage( + lockListInfoGroupEntity: state.lockListInfoGroupEntity.value), + xhjCall: () => LockListXHJPage( + lockListInfoGroupEntity: state.lockListInfoGroupEntity.value)); break; default: returnWidget = NoData(); 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 7eae2768..364a7f92 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 @@ -41,35 +41,31 @@ class _StarLockMainXHJPageState extends State builder: (LockMainXHJLogic logic) { return Scaffold( backgroundColor: const Color(0xFFF5F5F5), - floatingActionButton: FloatingActionButton( - shape: const CircleBorder(), - onPressed: () { - logic.openEquipment(); - }, - backgroundColor: AppColors.mainColor, - tooltip: TranslationLoader.lanKeys!.device!.tr, - child: const Icon( - Icons.key, - color: AppColors.darkGrayTextColor, - ), - ), body: SafeArea( bottom: false, child: Stack( children: [ + pageView( + widget: StarLockMainPage( + showAppBar: false, + showDrawer: false, + ), + logic: logic, + index: 0, + ), pageView( widget: LockMallPage( showAppBar: false, ), logic: logic, - index: 0, + index: 1, ), pageView( widget: MessageListPage( showAppBar: false, ), logic: logic, - index: 1, + index: 2, ), pageView( widget: MinePersonInfoPage( @@ -77,7 +73,7 @@ class _StarLockMainXHJPageState extends State showAbout: true, ), logic: logic, - index: 2, + index: 3, ), ], ), @@ -97,18 +93,25 @@ class _StarLockMainXHJPageState extends State top: false, child: Row( children: [ - navigationBarItem(Icons.shopping_cart, '商城'.tr, logic, 0, - () { + navigationBarItem( + Icons.key, + TranslationLoader.lanKeys!.device!.tr, + logic, + 0, () { logic.setIndex(0); }), - navigationBarItem(Icons.message, - TranslationLoader.lanKeys!.message!.tr, logic, 1, () { + navigationBarItem(Icons.shopping_cart, '商城'.tr, logic, 1, + () { logic.setIndex(1); }), - navigationBarItem(Icons.account_circle, '我的'.tr, logic, 2, - () { + navigationBarItem(Icons.message, + TranslationLoader.lanKeys!.message!.tr, logic, 2, () { logic.setIndex(2); }), + navigationBarItem(Icons.account_circle, '我的'.tr, logic, 3, + () { + logic.setIndex(3); + }), ], ), ), diff --git a/star_lock/lib/mine/addLock/addLock/addLock_state.dart b/star_lock/lib/mine/addLock/addLock/addLock_state.dart index 04184a8b..280ab527 100644 --- a/star_lock/lib/mine/addLock/addLock/addLock_state.dart +++ b/star_lock/lib/mine/addLock/addLock/addLock_state.dart @@ -5,8 +5,8 @@ class AddLockState { var lockTypeImg = 'images/lockType/addLock_touchScreen.png'.obs; //不同类型锁图片更换 AddLockState() { - Map map = Get.arguments; - if (map.isNotEmpty) { + Map? map = Get.arguments; + if (map is Map && map.isNotEmpty) { if (map["getLockType"] != null) { getLockType.value = map["getLockType"]; //保险箱锁 diff --git a/star_lock/lib/mine/mine/starLockMine_logic.dart b/star_lock/lib/mine/mine/starLockMine_logic.dart index 020c4097..8a345929 100644 --- a/star_lock/lib/mine/mine/starLockMine_logic.dart +++ b/star_lock/lib/mine/mine/starLockMine_logic.dart @@ -1,7 +1,9 @@ import 'dart:async'; import 'package:get/get.dart'; +import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart'; +import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart'; import 'package:star_lock/network/api_repository.dart'; import '../../tools/baseGetXController.dart'; @@ -12,6 +14,16 @@ import 'starLockMine_state.dart'; class StarLockMineLogic extends BaseGetXController { final StarLockMineState state = StarLockMineState(); + //用户信息 + Future getUserInfoRequest() async { + MinePersonInfoEntity entity = await ApiRepository.to.getUserInfo(); + if (entity.errorCode!.codeIsSuccessful) { + state.mineInfoData.value = entity.data!; + state.isVip.value = state.mineInfoData.value.isVip! == 0 ? false : true; + AppLog.log('isVip: ${state.isVip.value}'); + } + } + //删除账号请求 Future userLogoutRequest() async { LoginEntity entity = await ApiRepository.to.userLogout(deviceld: ''); @@ -22,7 +34,8 @@ class StarLockMineLogic extends BaseGetXController { StreamSubscription? _mineInfoChangeRefreshUIEvent; void _mineInfoChangeRefreshUIAction() { // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus - _mineInfoChangeRefreshUIEvent = eventBus.on().listen((event) { + _mineInfoChangeRefreshUIEvent = + eventBus.on().listen((event) { getMineInfoData(); }); } diff --git a/star_lock/lib/mine/mine/starLockMine_page.dart b/star_lock/lib/mine/mine/starLockMine_page.dart index 4bfa4f8b..9f37e9c6 100644 --- a/star_lock/lib/mine/mine/starLockMine_page.dart +++ b/star_lock/lib/mine/mine/starLockMine_page.dart @@ -24,6 +24,12 @@ class StarLockMinePageState extends State with BaseWidget { final logic = Get.put(StarLockMineLogic()); final state = Get.find().state; + @override + initState() { + super.initState(); + logic.getUserInfoRequest(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -57,19 +63,19 @@ class StarLockMinePageState extends State with BaseWidget { fit: BoxFit.fill, ), Center( - child: Column( - // crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - height: 120.h, - ), - GestureDetector( - onTap: () { - // Navigator.pushNamed(context, Routers.starLockLoginPage); - Get.back(); - Get.toNamed(Routers.minePersonInfoPage); - }, - child: Obx(() => Container( + child: Column( + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 120.h, + ), + GestureDetector( + onTap: () { + // Navigator.pushNamed(context, Routers.starLockLoginPage); + Get.back(); + Get.toNamed(Routers.minePersonInfoPage); + }, + child: Obx(() => Container( width: 105.w, height: 105.w, // decoration: BoxDecoration( @@ -78,7 +84,11 @@ class StarLockMinePageState extends State with BaseWidget { // ), child: ClipRRect( borderRadius: BorderRadius.circular(52.5.w), - child: CustomNetworkImage(url:state.userHeadUrl.value??"", defaultUrl: 'images/controls_user.png', width:105.w, height:105.h), + child: CustomNetworkImage( + url: state.userHeadUrl.value ?? "", + defaultUrl: 'images/controls_user.png', + width: 105.w, + height: 105.h), ), // state.headUrl().isNotEmpty ? // Image(image: NetworkImage(state.loginData.value.data!.headUrl!)) : @@ -87,27 +97,42 @@ class StarLockMinePageState extends State with BaseWidget { // width: 60.w, // height: 60.w) )), - ), - SizedBox( - height: 20.h, - ), - Obx(() => Text(state.userNickName.value.isNotEmpty ? state.userNickName.value : (state.userMobile.value.isNotEmpty ? state.userMobile.value : state.userEmail.value), + ), + SizedBox( + height: 20.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Obx(() => Text( + state.userNickName.value.isNotEmpty + ? state.userNickName.value + : (state.userMobile.value.isNotEmpty + ? state.userMobile.value + : state.userEmail.value), style: TextStyle( fontSize: 22.sp, color: Colors.white, ))), SizedBox( - height: 10.h, + width: 5.w, ), - Obx(() => Text( - "${TranslationLoader.lanKeys!.accountNumber!.tr}:${state.userMobile.value.isNotEmpty ? state.userMobile.value : state.userEmail.value}", - style: TextStyle( - fontSize: 18.sp, - color: Colors.white, - fontWeight: FontWeight.w500))), + Obx(() => !state.isVip.value + ? Image.asset( + 'images/mine/icon_mine_noPlus.png', + width: 20.w, + height: 20.w, + ) + : Image.asset( + 'images/mine/icon_mine_isPlus.png', + width: 20.w, + height: 20.w, + )), ], - ), - ), + ) + ], + ), + ), ], ), ); diff --git a/star_lock/lib/mine/mine/starLockMine_state.dart b/star_lock/lib/mine/mine/starLockMine_state.dart index 684fca50..bbcc9583 100644 --- a/star_lock/lib/mine/mine/starLockMine_state.dart +++ b/star_lock/lib/mine/mine/starLockMine_state.dart @@ -1,11 +1,14 @@ import 'package:get/get.dart'; +import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart'; class StarLockMineState { // final loginData = LoginData().obs; + final mineInfoData = MinePersonInfoData().obs; var userNickName = "".obs; var userMobile = "".obs; var userEmail = "".obs; var userHeadUrl = "".obs; + var isVip = false.obs; void onClose() {} } diff --git a/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart b/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart index 1307bde5..f531a7be 100644 --- a/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart +++ b/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart @@ -37,6 +37,7 @@ class MinePersonInfoData { int? countryId; String? email; String? countryName; + int? isVip; MinePersonInfoData( {this.mobile, @@ -47,7 +48,8 @@ class MinePersonInfoData { this.accountName, this.countryId, this.email, - this.countryName}); + this.countryName, + this.isVip}); MinePersonInfoData.fromJson(Map json) { mobile = json['mobile']; @@ -59,6 +61,7 @@ class MinePersonInfoData { countryId = json['countryId']; email = json['email']; countryName = json['countryName']; + isVip = json['isVip']; } Map toJson() { @@ -72,6 +75,7 @@ class MinePersonInfoData { data['countryId'] = countryId; data['email'] = email; data['countryName'] = countryName; + data['isVip'] = isVip; return data; } } diff --git a/star_lock/lib/tools/appFirstEnterHandle.dart b/star_lock/lib/tools/appFirstEnterHandle.dart index 36b59836..c48a8b2d 100644 --- a/star_lock/lib/tools/appFirstEnterHandle.dart +++ b/star_lock/lib/tools/appFirstEnterHandle.dart @@ -6,7 +6,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/appRouters.dart'; +import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; +import 'package:star_lock/flavors.dart'; import 'package:star_lock/tools/storage.dart'; import '../versionUndate/versionUndateTool.dart'; @@ -37,7 +39,6 @@ class AppFirstEnterHandle { } break; default: - break; } } @@ -49,75 +50,150 @@ class AppFirstEnterHandle { builder: (context) { return PopScope( canPop: false, - child: CupertinoAlertDialog( - title: const Text('用户协议和隐私政策概要\n'), - content: Text.rich( - TextSpan( - text: '感谢您使用本应用。我们非常重视您的个人信息和隐私保护,在使用本产品之前,请认真阅读', - style: const TextStyle(fontSize: 16.0), - children: [ - TextSpan( - text: '《用户协议》', - style: const TextStyle( - color: Colors.blue, - decoration: TextDecoration.underline), - recognizer: TapGestureRecognizer() - ..onTap = () { - // 处理用户协议点击事件 - Get.toNamed(Routers.webviewShowPage, arguments: { - "url": XSConstantMacro.userAgreementURL, - "title": '用户协议' - }); - }, - ), - const TextSpan(text: '和'), - TextSpan( - text: '《隐私政策》', - style: const TextStyle( - color: Colors.blue, - decoration: TextDecoration.underline), - recognizer: TapGestureRecognizer() - ..onTap = () { - // 处理隐私政策点击事件 - Get.toNamed(Routers.webviewShowPage, arguments: { - "url": XSConstantMacro.privacyPolicyURL, - "title": '隐私政策' - }); - }, - ), - const TextSpan( - text: - '的全部内容。点击“同意”即表示您同意并接受全部条款。若选择不同意,将无法使用我们的产品和服务,并会退出应用。'), - ], - ), - ), - actions: [ - CupertinoDialogAction( - child: const Text( - '不同意', - style: TextStyle(color: Colors.black), - ), - onPressed: () { - _exitApp(); - }, - ), - CupertinoDialogAction( - child: const Text( - '同意', - style: TextStyle(color: Colors.blue), - ), - onPressed: () { - Storage.setString(isAgreePrivacy, isAgreePrivacy); - Navigator.of(context).pop(); - getAppFirstEnter(context, isShowUpdateVersion); - }, - ), - ], - )); + child: F.sw( + defaultCall: () => _defaultPrivacyAgreementAlert(context), + xhjCall: () => _xhjPrivacyAgreementAlert(context))); }, ); } + //默认布局 + Widget _defaultPrivacyAgreementAlert(BuildContext context) { + return CupertinoAlertDialog( + title: Text('${'用户协议和隐私政策概要'.tr}\n'), + content: Text.rich( + TextSpan( + text: '感谢您使用本应用。我们非常重视您的个人信息和隐私保护,在使用本产品之前,请认真阅读'.tr, + style: const TextStyle(fontSize: 16.0), + children: [ + TextSpan( + text: '《用户协议》'.tr, + style: const TextStyle( + color: Colors.blue, decoration: TextDecoration.underline), + recognizer: TapGestureRecognizer() + ..onTap = () { + // 处理用户协议点击事件 + Get.toNamed(Routers.webviewShowPage, arguments: { + "url": XSConstantMacro.userAgreementURL, + "title": '用户协议'.tr + }); + }, + ), + TextSpan(text: '和'.tr), + TextSpan( + text: '《隐私政策》'.tr, + style: const TextStyle( + color: Colors.blue, decoration: TextDecoration.underline), + recognizer: TapGestureRecognizer() + ..onTap = () { + // 处理隐私政策点击事件 + Get.toNamed(Routers.webviewShowPage, arguments: { + "url": XSConstantMacro.privacyPolicyURL, + "title": '隐私政策'.tr + }); + }, + ), + TextSpan( + text: '的全部内容。点击“同意”即表示您同意并接受全部条款。若选择不同意,将无法使用我们的产品和服务,并会退出应用。' + .tr), + ], + ), + ), + actions: [ + CupertinoDialogAction( + child: Text( + '不同意'.tr, + style: TextStyle(color: Colors.black), + ), + onPressed: () { + _exitApp(); + }, + ), + CupertinoDialogAction( + child: Text( + '同意'.tr, + style: TextStyle(color: Colors.blue), + ), + onPressed: () { + Storage.setString(isAgreePrivacy, isAgreePrivacy); + Navigator.of(context).pop(); + getAppFirstEnter(context, isShowUpdateVersion); + }, + ), + ], + ); + } + + //xhj 布局 + Widget _xhjPrivacyAgreementAlert(BuildContext context) { + return AlertDialog( + title: Text('协议概要'.tr), + backgroundColor: Colors.white, + content: Text.rich( + TextSpan( + text: '感谢您使用本应用。我们非常重视您的个人信息和隐私保护,在使用本产品之前,请认真阅读'.tr, + style: const TextStyle(fontSize: 16.0), + children: [ + TextSpan( + text: '《用户协议》'.tr, + style: TextStyle( + color: AppColors.mainColor, + ), + recognizer: TapGestureRecognizer() + ..onTap = () { + // 处理用户协议点击事件 + Get.toNamed(Routers.webviewShowPage, arguments: { + "url": XSConstantMacro.userAgreementURL, + "title": '用户协议'.tr + }); + }, + ), + TextSpan(text: '和'.tr), + TextSpan( + text: '《隐私政策》'.tr, + style: TextStyle( + color: AppColors.mainColor, + ), + recognizer: TapGestureRecognizer() + ..onTap = () { + // 处理隐私政策点击事件 + Get.toNamed(Routers.webviewShowPage, arguments: { + "url": XSConstantMacro.privacyPolicyURL, + "title": '隐私政策'.tr + }); + }, + ), + TextSpan( + text: '的全部内容。点击“同意”即表示您同意并接受全部条款。若选择不同意,将无法使用我们的产品和服务,并会退出应用。' + .tr), + ], + ), + ), + actions: [ + CupertinoDialogAction( + child: Text( + '不同意'.tr, + style: TextStyle(color: Colors.black), + ), + onPressed: () { + _exitApp(); + }, + ), + CupertinoDialogAction( + child: Text( + '同意'.tr, + style: TextStyle(color: AppColors.mainColor), + ), + onPressed: () { + Storage.setString(isAgreePrivacy, isAgreePrivacy); + Navigator.of(context).pop(); + getAppFirstEnter(context, isShowUpdateVersion); + }, + ), + ], + ); + } + //位置权限弹窗 void showPositionAlert(BuildContext widgetContext) { showCupertinoDialog(