diff --git a/star_lock/lib/login/login/starLock_login_logic.dart b/star_lock/lib/login/login/starLock_login_logic.dart index ccc133e6..6099423f 100644 --- a/star_lock/lib/login/login/starLock_login_logic.dart +++ b/star_lock/lib/login/login/starLock_login_logic.dart @@ -45,8 +45,7 @@ class StarLockLoginLogic extends BaseGetXController { } void _resetCanNext() { - state.canNext.value = - state.pwdIsOK && state.isEmailOrPhone && state.agree.value; + state.canNext.value = state.pwdIsOK && state.isEmailOrPhone; } @override diff --git a/star_lock/lib/login/login/starLock_login_page.dart b/star_lock/lib/login/login/starLock_login_page.dart index 1f55f7f3..8b5d8438 100644 --- a/star_lock/lib/login/login/starLock_login_page.dart +++ b/star_lock/lib/login/login/starLock_login_page.dart @@ -1,7 +1,11 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/flavors.dart'; +import 'package:star_lock/tools/appFirstEnterHandle.dart'; +import 'package:star_lock/tools/storage.dart'; import '../../appRouters.dart'; import '../../app_settings/app_colors.dart'; @@ -165,7 +169,12 @@ class _StarLockLoginPageState extends State { isDisabled: state.canNext.value, onClick: state.canNext.value ? () { - logic.login(); + if (state.agree.value == false) { + logic.showToast('请先同意用户协议及隐私政策'); + return; + } else { + logic.login(); + } } : null)), SizedBox(height: 50.w), @@ -193,21 +202,25 @@ class _StarLockLoginPageState extends State { child: SizedBox( width: 10.sp, )), - GestureDetector( - child: SizedBox( - // width: 150.w, - height: 50.h, - // color: Colors.red, - child: Center( - child: Text('演示模式', - style: TextStyle( - fontSize: 22.sp, color: AppColors.mainColor)), - ), - ), - onTap: () { - Get.toNamed(Routers.demoModeLockDetailPage); - }, - ) + //上架审核注释 提交Google暂时屏蔽 + F.appFlavor == Flavor.sky + ? Container() + : GestureDetector( + child: SizedBox( + // width: 150.w, + height: 50.h, + // color: Colors.red, + child: Center( + child: Text('演示模式', + style: TextStyle( + fontSize: 22.sp, + color: AppColors.mainColor)), + ), + ), + onTap: () { + Get.toNamed(Routers.demoModeLockDetailPage); + }, + ) ], ), ], diff --git a/star_lock/lib/login/login/starLock_login_state.dart b/star_lock/lib/login/login/starLock_login_state.dart index ddd026a4..37d65040 100644 --- a/star_lock/lib/login/login/starLock_login_state.dart +++ b/star_lock/lib/login/login/starLock_login_state.dart @@ -1,8 +1,6 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import '../../tools/store_service.dart'; - class StarLockLoginState { var passwordShow = true.obs; var agree = false.obs; diff --git a/star_lock/lib/login/register/starLock_register_logic.dart b/star_lock/lib/login/register/starLock_register_logic.dart index a5073aab..051cd906 100644 --- a/star_lock/lib/login/register/starLock_register_logic.dart +++ b/star_lock/lib/login/register/starLock_register_logic.dart @@ -30,11 +30,11 @@ class StarLockRegisterLogic extends BaseGetXController { void register() async { var entity = await ApiRepository.to.register( - receiverType:state.isIphoneType.value == true ? 1 : 2, - countryCode:state.countryCode.value, - account:state.phoneOrEmailStr.value, - password:state.pwd.value, - verificationCode:state.verificationCode.value); + receiverType: state.isIphoneType.value == true ? 1 : 2, + countryCode: state.countryCode.value, + account: state.phoneOrEmailStr.value, + password: state.pwd.value, + verificationCode: state.verificationCode.value); if (entity.errorCode!.codeIsSuccessful) { // await loginSuccess(loginEntity: entity); // Toast.show(msg: "注册成功"); @@ -46,16 +46,18 @@ class StarLockRegisterLogic extends BaseGetXController { void sendValidationCode() async { var entity = await ApiRepository.to.sendValidationCode( // state.countryCode.value, - countryCode:state.countryCode.value.toString(), - account:state.phoneOrEmailStr.value, - channel:state.isIphoneType.value ? "1" : "2", - codeType:'1', - xWidth:state.xWidth.value.toString()); + countryCode: state.countryCode.value.toString(), + account: state.phoneOrEmailStr.value, + channel: state.isIphoneType.value ? "1" : "2", + codeType: '1', + xWidth: state.xWidth.value.toString()); if (entity.errorCode!.codeIsSuccessful) { _startTimer(); - } else { + } else {} + } - } + void changeAgreeState() { + _resetCanSub(); } void checkNext(TextEditingController controller) { diff --git a/star_lock/lib/login/register/starLock_register_page.dart b/star_lock/lib/login/register/starLock_register_page.dart index 24c6e7f5..0f7c57ac 100644 --- a/star_lock/lib/login/register/starLock_register_page.dart +++ b/star_lock/lib/login/register/starLock_register_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -51,7 +50,12 @@ class _StarLockRegisterPageState extends State { isDisabled: state.canSub.value, onClick: state.canSub.value ? () { - logic.register(); + if (state.agree.value == false) { + logic.showToast('请先同意用户协议及隐私政策'); + return; + } else { + logic.register(); + } } : null); }), @@ -294,7 +298,8 @@ class _StarLockRegisterPageState extends State { "countryCode": state.countryCode, "account": state.phoneOrEmailStr.value }); - state.xWidth.value = (result as Map)['xWidth']; + state.xWidth.value = + (result as Map)['xWidth']; logic.sendValidationCode(); } : null, @@ -303,7 +308,9 @@ class _StarLockRegisterPageState extends State { height: 60.h, padding: EdgeInsets.all(5.h), decoration: BoxDecoration( - color: state.phoneOrEmailStrIsOK.value ? AppColors.mainColor : Colors.grey, + color: state.phoneOrEmailStrIsOK.value + ? AppColors.mainColor + : Colors.grey, borderRadius: BorderRadius.circular(5)), child: Center( child: Text(state.btnText.value, @@ -326,15 +333,18 @@ class _StarLockRegisterPageState extends State { return Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - Image.asset( - 'images/icon_select_circle.png', - width: 28.w, - height: 28.w, - ), - // SizedBox( - // height: 20.h, - // width: 26.w, - // child: Checkbox(value: false, onChanged: (value) {})), + Obx(() => GestureDetector( + onTap: () { + state.agree.value = !state.agree.value; + logic.changeAgreeState(); + }, + child: Image.asset( + state.agree.value + ? 'images/icon_round_select.png' + : 'images/icon_round_unSelect.png', + width: 30.w, + height: 30.w, + ))), SizedBox( width: 15.w, ), @@ -352,11 +362,10 @@ class _StarLockRegisterPageState extends State { style: TextStyle( color: AppColors.mainColor, fontSize: 20.sp)), onTap: () { - Get.toNamed(Routers.webviewShowPage, - arguments: { - "url": XSConstantMacro.userAgreementURL, - "title": '用户协议' - }); + Get.toNamed(Routers.webviewShowPage, arguments: { + "url": XSConstantMacro.userAgreementURL, + "title": '用户协议' + }); }, )), WidgetSpan( @@ -368,9 +377,9 @@ class _StarLockRegisterPageState extends State { color: AppColors.mainColor, fontSize: 20.sp)), onTap: () { Get.toNamed(Routers.webviewShowPage, arguments: { - "url": XSConstantMacro.privacyPolicyURL, - "title": '隐私政策' - }); + "url": XSConstantMacro.privacyPolicyURL, + "title": '隐私政策' + }); }, )), ], diff --git a/star_lock/lib/login/register/starLock_register_state.dart b/star_lock/lib/login/register/starLock_register_state.dart index 253aba4f..8ba411a5 100644 --- a/star_lock/lib/login/register/starLock_register_state.dart +++ b/star_lock/lib/login/register/starLock_register_state.dart @@ -21,6 +21,7 @@ class StarLockRegisterState { var xWidth = ''.obs; // 滑动验证码滑动位置 var isIphoneType = true.obs; var canSub = false.obs; + var agree = false.obs; bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value); bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value); diff --git a/star_lock/lib/main.dart b/star_lock/lib/main.dart index 66b92028..652ef00a 100644 --- a/star_lock/lib/main.dart +++ b/star_lock/lib/main.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:star_lock/flavors.dart'; import 'package:star_lock/translations/trans_lib.dart'; import 'app.dart'; import 'package:star_lock/tools/device_info_service.dart'; @@ -20,22 +21,27 @@ FutureOr main() async { if (AppPlatform.isAndroid) { SystemUiOverlayStyle systemUiOverlayStyle = - const SystemUiOverlayStyle(statusBarColor: Colors.transparent); + const SystemUiOverlayStyle(statusBarColor: Colors.transparent); SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); } } // 设置国际化信息 Future _initTranslation() async => TranslationLoader.loadTranslation( - zhSource: "images/lan/lan_zh.json", - enSource: "images/lan/lan_en.json", - keySource: "images/lan/lan_keys.json", -); + zhSource: "images/lan/lan_zh.json", + enSource: "images/lan/lan_en.json", + keySource: "images/lan/lan_keys.json", + ); // 设置包名服务设备信息 Future _setCommonServices() async { await Get.putAsync(() => StoreService().init()); await Get.putAsync(() => PlatformInfoService().init()); - await Get.putAsync(() => DeviceInfoService().init()); + if (F.appFlavor == Flavor.sky) { + //上架审核注释 获取设备信息 + // await Get.putAsync(() => DeviceInfoService().init()); + } else { + await Get.putAsync(() => DeviceInfoService().init()); + } // Get.log(PlatformInfoService.to.info.version); } diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart index 604c0954..73e0e881 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart @@ -397,12 +397,13 @@ class _SendElectronicKeyPageState extends State { // SizedBox( // height: 10.h, // ), - OutLineBtn( - btnName: '标记为已入住', - onClick: () { - updateRoomCheckIn(); - }, - ), + //田总说不要标记为已入住 + // OutLineBtn( + // btnName: '标记为已入住', + // onClick: () { + // updateRoomCheckIn(); + // }, + // ), ], ); } diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_main_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_main_page.dart index 4ff182c1..b830bb89 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_main_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_main_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -21,7 +20,6 @@ class _LockDetailMainPageState extends State { void initState() { // TODO: implement initState super.initState(); - } @override @@ -45,8 +43,9 @@ class _LockDetailMainPageState extends State { barTitle: F.navTitle, haveBack: true, backgroundColor: AppColors.mainColor), - body: LockDetailPage(isOnlyOneData:isOnlyOneData, lockListInfoItemEntity: keyInfos), - // body: Container(), + body: LockDetailPage( + isOnlyOneData: isOnlyOneData, lockListInfoItemEntity: keyInfos), + // body: Container(), ); } } diff --git a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart index 5a4cf587..eeea218e 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart @@ -74,7 +74,8 @@ class _LockSetPageState extends State with RouteAware { // 根据权限显示不同的列表 List getListWidget() { // print("state.lockBasicInfo.value.isLockOwner:${state.lockBasicInfo.value.isLockOwner} state.lockBasicInfo.value.keyRight:${state.lockBasicInfo.value.keyRight}"); - if (state.lockBasicInfo.value.isLockOwner == 1 || state.lockBasicInfo.value.keyRight == 1) { + if (state.lockBasicInfo.value.isLockOwner == 1 || + state.lockBasicInfo.value.keyRight == 1) { // 超级管理员、授权管理员 return getAllWidget(); } else { @@ -449,26 +450,26 @@ class _LockSetPageState extends State with RouteAware { //-----新增至此 SizedBox(height: 10.h), // 标记房态 - Obx(() { - var title = ""; - if (state.lockStatus.value.roomStatus == 1) { - title = TranslationLoader.lanKeys!.checkedIn!.tr; - } else if (state.lockStatus.value.roomStatus == 0) { - title = TranslationLoader.lanKeys!.leisure!.tr; - } - return Visibility( - visible: state.lockStatus.value.roomStatus == 1 ? true : false, - child: CommonItem( - leftTitel: TranslationLoader.lanKeys!.markedHouseState!.tr, - rightTitle: title, - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.toNamed(Routers.markedHouseStatePage, arguments: { - 'lockSetInfoData': state.lockSetInfoData.value - }); - })); - }), + // Obx(() { + // var title = ""; + // if (state.lockStatus.value.roomStatus == 1) { + // title = TranslationLoader.lanKeys!.checkedIn!.tr; + // } else if (state.lockStatus.value.roomStatus == 0) { + // title = TranslationLoader.lanKeys!.leisure!.tr; + // } + // return Visibility( + // visible: state.lockStatus.value.roomStatus == 1 ? true : false, + // child: CommonItem( + // leftTitel: TranslationLoader.lanKeys!.markedHouseState!.tr, + // rightTitle: title, + // isHaveLine: true, + // isHaveDirection: true, + // action: () { + // Get.toNamed(Routers.markedHouseStatePage, arguments: { + // 'lockSetInfoData': state.lockSetInfoData.value + // }); + // })); + // }), // 考勤 Obx( () => Visibility( diff --git a/star_lock/lib/main/lockMian/demoMode/demoModeLockSet/demoModeLockSet_page.dart b/star_lock/lib/main/lockMian/demoMode/demoModeLockSet/demoModeLockSet_page.dart index befc6a56..6c42dcf8 100644 --- a/star_lock/lib/main/lockMian/demoMode/demoModeLockSet/demoModeLockSet_page.dart +++ b/star_lock/lib/main/lockMian/demoMode/demoModeLockSet/demoModeLockSet_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; @@ -19,12 +18,10 @@ class DemoModeLockSetPage extends StatefulWidget { } class _DemoModeLockSetPageState extends State { - @override void initState() { // TODO: implement initState super.initState(); - } @override @@ -43,7 +40,7 @@ class _DemoModeLockSetPageState extends State { // 基本信息 CommonItem( leftTitel: - TranslationLoader.lanKeys!.basicInformation!.tr, + TranslationLoader.lanKeys!.basicInformation!.tr, rightTitle: "", isHaveLine: false, isHaveDirection: true, @@ -53,7 +50,9 @@ class _DemoModeLockSetPageState extends State { // 'keyInfo': state.getKeyInfosData.value // }); }), - SizedBox(height: 10.h,), + SizedBox( + height: 10.h, + ), // 门磁 CommonItem( leftTitel: TranslationLoader.lanKeys!.doorMagnetic!.tr, @@ -68,7 +67,7 @@ class _DemoModeLockSetPageState extends State { // 无线键盘 CommonItem( leftTitel: - TranslationLoader.lanKeys!.wirelessKeyboard!.tr, + TranslationLoader.lanKeys!.wirelessKeyboard!.tr, rightTitle: "", isHaveLine: false, isHaveDirection: true, @@ -99,7 +98,7 @@ class _DemoModeLockSetPageState extends State { // 自动闭锁 CommonItem( leftTitel: - TranslationLoader.lanKeys!.automaticBlocking!.tr, + TranslationLoader.lanKeys!.automaticBlocking!.tr, rightTitle: TranslationLoader.lanKeys!.closed!.tr, isHaveLine: true, isHaveDirection: true, @@ -133,7 +132,7 @@ class _DemoModeLockSetPageState extends State { // 常开模式 CommonItem( leftTitel: - TranslationLoader.lanKeys!.normallyOpenMode!.tr, + TranslationLoader.lanKeys!.normallyOpenMode!.tr, rightTitle: TranslationLoader.lanKeys!.closed!.tr, isHaveLine: true, isHaveDirection: true, @@ -216,23 +215,22 @@ class _DemoModeLockSetPageState extends State { SizedBox(height: 10.h), //-----新增至此 // 标记房态 - CommonItem( - leftTitel: - TranslationLoader.lanKeys!.markedHouseState!.tr, - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - gotoAddLock(); - }), + // CommonItem( + // leftTitel: + // TranslationLoader.lanKeys!.markedHouseState!.tr, + // rightTitle: "", + // isHaveLine: true, + // isHaveDirection: true, + // action: () { + // gotoAddLock(); + // }), // 考勤 CommonItem( leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr, rightTitle: "", isHaveLine: true, isHaveRightWidget: true, - rightWidget: _openCheckInSwitch() - ), + rightWidget: _openCheckInSwitch()), // 开锁提醒 CommonItem( leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr, @@ -304,7 +302,8 @@ class _DemoModeLockSetPageState extends State { }), SizedBox(height: 30.h), Container( - padding: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 30.h), + padding: + EdgeInsets.only(left: 20.w, right: 20.w, bottom: 30.h), child: SubmitBtn( btnName: "退出演示模式", isDelete: true, @@ -343,9 +342,8 @@ class _DemoModeLockSetPageState extends State { ); } - void gotoAddLock(){ + void gotoAddLock() { // Get.toNamed(Routers.selectLockTypePage); - EasyLoading.showToast("演示模式",duration: 2000.milliseconds); + EasyLoading.showToast("演示模式", duration: 2000.milliseconds); } - } diff --git a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart index 8975132a..0774a669 100644 --- a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart +++ b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart @@ -205,12 +205,15 @@ class _StarLockMainPageState extends State with BaseWidget { SizedBox( height: 160.h, ), - SubmitBtn( - btnName: '演示模式', - onClick: () { - Get.toNamed(Routers.demoModeLockDetailPage); - }, - ) + //上架审核注释 提交Google暂时屏蔽 + F.appFlavor == Flavor.sky + ? Container() + : SubmitBtn( + btnName: '演示模式', + onClick: () { + Get.toNamed(Routers.demoModeLockDetailPage); + }, + ) ], ), ], diff --git a/star_lock/lib/mine/mine/starLockMine_page.dart b/star_lock/lib/mine/mine/starLockMine_page.dart index 34f423e4..c9611f05 100644 --- a/star_lock/lib/mine/mine/starLockMine_page.dart +++ b/star_lock/lib/mine/mine/starLockMine_page.dart @@ -13,12 +13,12 @@ class StarLockMinePage extends StatefulWidget { const StarLockMinePage({Key? key}) : super(key: key); @override - State createState() => _StarLockMinePageState(); + State createState() => StarLockMinePageState(); } -GlobalKey<_StarLockMinePageState> starLockMineKey = GlobalKey(); +GlobalKey starLockMineKey = GlobalKey(); -class _StarLockMinePageState extends State with BaseWidget { +class StarLockMinePageState extends State with BaseWidget { final logic = Get.put(StarLockMineLogic()); final state = Get.find().state; diff --git a/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart b/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart index ac26b9b7..266ff343 100644 --- a/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart +++ b/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:image_picker/image_picker.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart'; import 'package:star_lock/tools/custom_bottom_sheet.dart'; @@ -69,7 +70,7 @@ class _MinePersonInfoPageState extends State { ), ), action: () { - _openModalBottomSheet(); + requestCameraPermission(); }, )), Obx(() => CommonItem( @@ -169,6 +170,51 @@ class _MinePersonInfoPageState extends State { )); } + Future requestCameraPermission() async { + // 检查是否已经授予相机权限 + PermissionStatus status = await Permission.camera.status; + + if (status.isGranted) { + // 如果权限已经被授予,执行您的相机操作 + // 这里可以调用打开相机的方法或者跳转到相机页面等 + _openModalBottomSheet(); + } else { + // 如果权限尚未被授予,请求相机权限 + // 此处会显示系统权限请求对话框 + status = await Permission.camera.request(); + + if (status.isGranted) { + // 如果用户授予了相机权限,执行您的相机操作 + _openModalBottomSheet(); + } else { + // 如果用户拒绝了相机权限,您可以提供适当的提示 + // 或者引导用户手动授予权限 + _showPermissinDialog(); + } + } + } + + Future _showPermissinDialog() async { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Permission Required'), + content: const Text( + 'You need to grant camera permission to use this feature.'), + actions: [ + TextButton( + child: const Text('OK'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); + } + Future _openModalBottomSheet() async { showModalBottomSheet( context: context, diff --git a/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart b/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart index dbc30f22..2c429680 100644 --- a/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart +++ b/star_lock/lib/mine/mineSet/mineSet/mineSet_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/flavors.dart'; import 'package:star_lock/mine/mineSet/mineSet/mineSet_logic.dart'; import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; @@ -184,30 +185,37 @@ class _MineSetPageState extends State { SizedBox( height: 10.h, ), - CommonItem( - leftTitel: "Amazon Alexa", - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - logic.showToast("功能暂未开放"); - }), - CommonItem( - leftTitel: "Google Home", - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - logic.showToast("功能暂未开放"); - }), - CommonItem( - leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr, - rightTitle: "", - isHaveLine: false, - isHaveDirection: true, - action: () { - logic.showToast("功能暂未开放"); - }), + //上架审核注释 + F.appFlavor == Flavor.sky + ? Container() + : CommonItem( + leftTitel: "Amazon Alexa", + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + logic.showToast("功能暂未开放"); + }), + F.appFlavor == Flavor.sky + ? Container() + : CommonItem( + leftTitel: "Google Home", + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + logic.showToast("功能暂未开放"); + }), + F.appFlavor == Flavor.sky + ? Container() + : CommonItem( + leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr, + rightTitle: "", + isHaveLine: false, + isHaveDirection: true, + action: () { + logic.showToast("功能暂未开放"); + }), // CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){ // // }), diff --git a/star_lock/lib/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_logic.dart b/star_lock/lib/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_logic.dart new file mode 100644 index 00000000..3ce45d61 --- /dev/null +++ b/star_lock/lib/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_logic.dart @@ -0,0 +1,24 @@ +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class ValueAddedServicesBuyLogic extends BaseGetXController { + final ValueAddedServicesBuyState state = ValueAddedServicesBuyState(); + + @override + Future onReady() async { + print("ready home"); + super.onReady(); + } + + @override + void onInit() { + print("init home"); + super.onInit(); + } + + @override + void onClose() { + print("close home"); + super.onClose(); + } +} diff --git a/star_lock/lib/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_page.dart b/star_lock/lib/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_page.dart index ac7453a2..b95a0db0 100644 --- a/star_lock/lib/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_page.dart +++ b/star_lock/lib/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_page.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_logic.dart'; -import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; import '../../../tools/titleAppBar.dart'; import '../../../translations/trans_lib.dart'; @@ -16,17 +16,13 @@ class ValueAddedServicesBuyPage extends StatefulWidget { } class _ValueAddedServicesBuyPageState extends State { - final data = [ - "1", - "2", - "3", - "4", - ]; - @override Widget build(BuildContext context) { var type = ModalRoute.of(context)?.settings.arguments as int; + final logic = Get.put(ValueAddedServicesBuyLogic()); + final state = Get.find().state; + return Scaffold( backgroundColor: AppColors.greyBackgroundColor, appBar: TitleAppBar( @@ -59,7 +55,9 @@ class _ValueAddedServicesBuyPageState extends State { mainAxisSpacing: 10.h, crossAxisSpacing: 10.w, childAspectRatio: 1 / 0.5, - children: data.map((title) => _buildItem(title)).toList(), + children: state.topData.value + .map((title) => _buildItem(title)) + .toList(), ), ), ), @@ -123,16 +121,21 @@ class _ValueAddedServicesBuyPageState extends State { color: AppColors.mainColor, fontWeight: FontWeight.w500))), SizedBox(width: 5.w), - Container( - width: 180.w, - height: 100.h, - color: AppColors.mainColor, - child: Center( - child: Text(TranslationLoader.lanKeys!.goToPay!.tr, - style: TextStyle( - fontSize: 24.sp, - color: Colors.white, - fontWeight: FontWeight.w500)))) + GestureDetector( + onTap: () { + logic.showToast("支付成功"); + }, + child: Container( + width: 180.w, + height: 100.h, + color: AppColors.mainColor, + child: Center( + child: Text(TranslationLoader.lanKeys!.goToPay!.tr, + style: TextStyle( + fontSize: 24.sp, + color: Colors.white, + fontWeight: FontWeight.w500)))), + ) ], ), ), diff --git a/star_lock/lib/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_state.dart b/star_lock/lib/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_state.dart new file mode 100644 index 00000000..47be7926 --- /dev/null +++ b/star_lock/lib/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_state.dart @@ -0,0 +1,12 @@ +import 'package:get/get.dart'; + +class ValueAddedServicesBuyState { + final topData = [ + "1", + "2", + "3", + "4", + ].obs; + + void onClose() {} +} diff --git a/star_lock/lib/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart b/star_lock/lib/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart index 2384e41a..7fbbedd2 100644 --- a/star_lock/lib/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart +++ b/star_lock/lib/mine/valueAddedServices/valueAddedServicesHighFunction/valueAddedServicesHighFunction_page.dart @@ -152,8 +152,8 @@ class _ValueAddedServicesHighFunctionPageState TranslationLoader.lanKeys!.lockGroup!.tr), _buildItem("images/mine/icon_mine_highFunctionContent_bjft.png", TranslationLoader.lanKeys!.sendGroupKey!.tr), - _buildItem("images/mine/icon_mine_highFunctionContent_bjft.png", - TranslationLoader.lanKeys!.markedHouseState!.tr), + // _buildItem("images/mine/icon_mine_highFunctionContent_bjft.png", + // TranslationLoader.lanKeys!.markedHouseState!.tr), _buildItem("images/mine/icon_mine_highFunctionContent_fkgj.png", TranslationLoader.lanKeys!.cardIssuingtool!.tr), _buildItem( diff --git a/star_lock/lib/mine/valueAddedServices/valueAddedServicesRealName/valueAddedServicesRealName_page.dart b/star_lock/lib/mine/valueAddedServices/valueAddedServicesRealName/valueAddedServicesRealName_page.dart index 5a5c495b..0b3a8dec 100644 --- a/star_lock/lib/mine/valueAddedServices/valueAddedServicesRealName/valueAddedServicesRealName_page.dart +++ b/star_lock/lib/mine/valueAddedServices/valueAddedServicesRealName/valueAddedServicesRealName_page.dart @@ -1,8 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; - -import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; import '../../../tools/commonItem.dart'; import '../../../tools/titleAppBar.dart'; @@ -92,9 +90,9 @@ class _ValueAddedServicesRealNamePageState ), GestureDetector( onTap: () { - Navigator.pushNamed( - context, Routers.valueAddedServicesBuyPage, - arguments: 3); + // Navigator.pushNamed( + // context, Routers.valueAddedServicesBuyPage, + // arguments: 3); }, child: Container( width: 200.w, @@ -103,7 +101,8 @@ class _ValueAddedServicesRealNamePageState child: Center( child: Text(TranslationLoader.lanKeys!.buy!.tr, style: TextStyle( - color: AppColors.mainColor, + // color: AppColors.mainColor, + color: AppColors.blackColor, fontSize: 24.sp)))), ), ], diff --git a/star_lock/lib/network/request_interceptor.dart b/star_lock/lib/network/request_interceptor.dart index a5fd6cef..17d6db8e 100644 --- a/star_lock/lib/network/request_interceptor.dart +++ b/star_lock/lib/network/request_interceptor.dart @@ -4,16 +4,13 @@ import 'package:get/get.dart'; import 'package:get/get_connect/http/src/request/request.dart'; import 'package:star_lock/login/login/entity/LoginData.dart'; -import '../login/login/entity/LoginData.dart'; -import '../login/login/entity/LoginEntity.dart'; import '../tools/platform_info_services.dart'; import '../tools/storage.dart'; -import '../tools/store_service.dart'; FutureOr requestInterceptor(Request request) async { request.headers['User-Agent'] = 'StarLock/${PlatformInfoService.to.info.version}/${PlatformInfoService.to.info.buildNumber}/${GetPlatform.isAndroid ? 'Android' : 'iOS'}'; - request.headers['Accept-Language'] = 'zh_CN'; + request.headers['Accept-Language'] = 'zh-CN'; // request.headers['Content-Type'] = 'application/json'; // request.headers['token'] = StoreService.to.userToken!; // print("11111${StoreService.to.userToken}"); diff --git a/star_lock/lib/starLockApplication/starLockApplication.dart b/star_lock/lib/starLockApplication/starLockApplication.dart index 5f0c3ae4..e05ae1ea 100644 --- a/star_lock/lib/starLockApplication/starLockApplication.dart +++ b/star_lock/lib/starLockApplication/starLockApplication.dart @@ -1,9 +1,10 @@ - import 'package:flutter/material.dart'; +import 'package:star_lock/login/login/starLock_login_page.dart'; +import 'package:star_lock/tools/appFirstEnterHandle.dart'; +import 'package:star_lock/tools/storage.dart'; import '../main/lockMian/lockMain/lockMain_page.dart'; - class StarLockApplication extends StatefulWidget { const StarLockApplication({Key? key}) : super(key: key); @@ -12,11 +13,37 @@ class StarLockApplication extends StatefulWidget { } class _StarLockApplicationState extends State { - - @override Widget build(BuildContext context) { - // return NavPages(); - return const StarLockMainPage(); + AppFirstEnterHandle().getAppFirstEnter(context); + + return FutureBuilder( + future: getLoginStatus(), + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + // 如果异步操作尚未完成,返回一个加载指示器或其他等待状态的小部件 + return const CircularProgressIndicator(); + } else if (snapshot.hasData) { + if (snapshot.data!) { + // 如果用户已登录,返回主页面 + return const StarLockMainPage(); + } else { + // 如果用户未登录,返回登录页面 + return const StarLockLoginPage(); + } + } else { + // 如果没有数据,返回一个空白的小部件 + return const StarLockLoginPage(); + } + }, + ); + } + + Future getLoginStatus() async { + final data = await Storage.getString(saveUserLoginData); + if (data != null && data.isNotEmpty) { + return true; + } + return false; } } diff --git a/star_lock/lib/tools/appFirstEnterHandle.dart b/star_lock/lib/tools/appFirstEnterHandle.dart new file mode 100644 index 00000000..65f6fc91 --- /dev/null +++ b/star_lock/lib/tools/appFirstEnterHandle.dart @@ -0,0 +1,94 @@ +import 'dart:io'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; +import 'package:star_lock/tools/storage.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class AppFirstEnterHandle { + Future getAppFirstEnter(BuildContext widgetContext) async { + var isFirstTime = await Storage.getString(isFirstEnter); + if (isFirstTime != isFirstEnter) { + showPrivacyAgreementAlert(widgetContext); + } + } + + //隐私协议弹窗 + void showPrivacyAgreementAlert(BuildContext widgetContext) { + showCupertinoDialog( + context: widgetContext, + builder: (context) { + return 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 = () { + // 处理用户协议点击事件 + _launchURL(XSConstantMacro.userAgreementURL); + }, + ), + const TextSpan(text: '和'), + TextSpan( + text: '《隐私政策》', + style: const TextStyle( + color: Colors.blue, decoration: TextDecoration.underline), + recognizer: TapGestureRecognizer() + ..onTap = () { + // 处理隐私政策点击事件 + _launchURL(XSConstantMacro.privacyPolicyURL); + }, + ), + 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(isFirstEnter, isFirstEnter); + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); + } + + _launchURL(String url) async { + if (await canLaunchUrl(Uri.parse(url))) { + await launchUrl(Uri.parse(url)); + } else { + throw '无法打开链接 $url'; + } + } + + void _exitApp() { + exit(0); // 退出应用程序 + } +} diff --git a/star_lock/lib/tools/storage.dart b/star_lock/lib/tools/storage.dart index bbbab709..4d42487d 100644 --- a/star_lock/lib/tools/storage.dart +++ b/star_lock/lib/tools/storage.dart @@ -15,6 +15,7 @@ const saveBlueToken = "BlueGetToken"; const currentConnectionLockId = "CurrentConnectionLockId"; const currentConnectionMacAddress = "CurrentConnectionMacAddress"; const ifIsDemoModeOrNot = "IfIsDemoModeOrNot"; +const isFirstEnter = "isFirstEnter"; //是否首次进入应用 const saveUserLoginData = "userLoginData"; @@ -182,5 +183,4 @@ class Storage { static Future saveLoginData(LoginData? data) async { await Storage.setString(saveUserLoginData, jsonEncode(data)); } - } diff --git a/star_lock/pubspec.yaml b/star_lock/pubspec.yaml index ce765f7e..35f3889b 100644 --- a/star_lock/pubspec.yaml +++ b/star_lock/pubspec.yaml @@ -125,7 +125,7 @@ dependencies: image_gallery_saver: ^2.0.3 convert: ^3.1.1 just_audio: ^0.9.36 - flutter_sound: ^9.2.13 + # flutter_sound: ^9.2.13 # ffmpeg_kit_flutter: 5.1.0-LTS fast_gbk: ^1.0.0 flutter_pcm_sound: ^1.1.0