diff --git a/star_lock/images/icon_main_xhj_1024.png b/star_lock/images/icon_main_xhj_1024.png new file mode 100644 index 00000000..8aa598c7 Binary files /dev/null and b/star_lock/images/icon_main_xhj_1024.png differ diff --git a/star_lock/images/lan/lan_en.json b/star_lock/images/lan/lan_en.json index f935e3b6..2c32a5fc 100644 --- a/star_lock/images/lan/lan_en.json +++ b/star_lock/images/lan/lan_en.json @@ -512,7 +512,7 @@ "未打卡":"No card punched", "钥匙将在":"The key will be in", "天后失效":"Days later invalid", - "锁更新时间:":"Lock update time:", + "锁电量更新时间:":"Lock power update time:", "新增配件":"Add accessories", "请在锁旁边完成第一次开锁":"Please complete the first unlock next to the lock", "正在开锁中...":"Unlocking...", @@ -791,5 +791,6 @@ "视频播放":"Video playback", "全选":"Select all", "请选择要删除的视频":"Please select the video you want to delete", - "请选择要下载的视频":"Please select the video you want to download" + "请选择要下载的视频":"Please select the video you want to download", + "欢迎使用":"Welcome to use" } diff --git a/star_lock/images/lan/lan_keys.json b/star_lock/images/lan/lan_keys.json index 8d7771e5..2f60d178 100644 --- a/star_lock/images/lan/lan_keys.json +++ b/star_lock/images/lan/lan_keys.json @@ -512,7 +512,7 @@ "未打卡":"未打卡", "钥匙将在":"钥匙将在", "天后失效":"天后失效", - "锁更新时间:":"锁更新时间:", + "锁电量更新时间:":"锁电量更新时间:", "新增配件":"新增配件", "请在锁旁边完成第一次开锁":"请在锁旁边完成第一次开锁", "正在开锁中...":"正在开锁中...", @@ -790,5 +790,6 @@ "视频播放":"视频播放", "全选":"全选", "请选择要删除的视频":"请选择要删除的视频", - "请选择要下载的视频":"请选择要下载的视频" + "请选择要下载的视频":"请选择要下载的视频", + "欢迎使用":"欢迎使用" } diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index b1b01fe7..622abcce 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -514,7 +514,7 @@ "早退":"早退", "钥匙将在":"钥匙将在", "天后失效":"天后失效", - "锁更新时间:":"锁更新时间:", + "锁电量更新时间:":"锁电量更新时间:", "新增配件":"新增配件", "请在锁旁边完成第一次开锁":"请在锁旁边完成第一次开锁", "正在开锁中...":"正在开锁中...", @@ -793,5 +793,6 @@ "视频播放":"视频播放", "全选":"全选", "请选择要删除的视频":"请选择要删除的视频", - "请选择要下载的视频":"请选择要下载的视频" + "请选择要下载的视频":"请选择要下载的视频", + "欢迎使用":"欢迎使用" } diff --git a/star_lock/lib/appRouters.dart b/star_lock/lib/appRouters.dart index 2a22e31a..f103b9a8 100644 --- a/star_lock/lib/appRouters.dart +++ b/star_lock/lib/appRouters.dart @@ -1,7 +1,10 @@ import 'package:get/get.dart'; import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart'; import 'package:star_lock/flavors.dart'; +import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_xhj_page.dart'; +import 'package:star_lock/login/login/starLock_login_xhj_page.dart'; import 'package:star_lock/login/register/starLock_register_binding.dart'; +import 'package:star_lock/login/register/starLock_register_xhj_page.dart'; import 'package:star_lock/main/lockDetail/accessoriesList/accessoriesList_page.dart'; import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_page.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_page.dart'; @@ -56,6 +59,7 @@ import 'login/forgetPassword/starLock_forgetPassword_page.dart'; import 'login/login/starLock_login_page.dart'; import 'login/register/starLock_register_page.dart'; import 'login/selectCountryRegion/selectCountryRegion_page.dart'; +import 'main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart'; import 'main/lockDetail/card/addCardType/addCardType_page.dart'; import 'main/lockDetail/card/addICCard/addICCard_page.dart'; import 'main/lockDetail/card/cardDetail/cardDetail_page.dart'; @@ -75,6 +79,7 @@ import 'main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checki import 'main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_page.dart'; import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyPeriodValidity/electronicKeyPeriodValidity_page.dart'; import 'main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicManageKey/massSendElectronicKeyManage_page.dart'; +import 'main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart'; import 'main/lockDetail/face/addFace/addFace_page.dart'; import 'main/lockDetail/face/addFaceType/addFaceType_page.dart'; import 'main/lockDetail/face/faceList/faceList_page.dart'; @@ -127,13 +132,11 @@ import 'main/lockMian/demoMode/demoModeLockDetail/demoModeLockDetail_page.dart'; import 'main/lockMian/demoMode/demoModeLockSet/demoModeLockSet_page.dart'; import 'mine/about/about_page.dart'; import 'mine/addLock/addLock/addLock_page.dart'; -import 'main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdminManage/authorizedAdminManage_page.dart'; import 'main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart'; import 'main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLockManage/volumeAuthorizationLockManage_page.dart'; import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart'; import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_page.dart'; import 'main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart'; -import 'main/lockDetail/electronicKey/sendElectronicKey/sendElectronicManageKey/sendElectronicKeyManage_page.dart'; import 'main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart'; import 'main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart'; import 'main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart'; @@ -206,8 +209,8 @@ abstract class Routers { static const electronicKeyDetailPage = '/ElectronicKeyDetailPage'; // 电子钥匙详情 static const electronicKeyDetailChangeDate = '/ElectronicKeyDetailChangeDate'; // 修改有效期 - static const sendElectronicKeyManagePage = - '/SendElectronicKeyManagePage'; // 发送电子钥匙 + static const sendElectronicKeyPage = + '/SendElectronicKeyPage'; // 发送电子钥匙 static const massSendElectronicKeyManagePage = '/MassSendElectronicKeyManagePage'; // 群发钥匙 static const electronicKeyPeriodValidityPage = @@ -231,8 +234,8 @@ abstract class Routers { static const authorizedAdminListPage = '/AuthorizedAdminListPage'; // 授权管理员列表 static const authorizedAdminDetailPage = '/AuthorizedAdminDetailPage'; // 授权管理员详情 - static const authorizedAdminManagePage = - '/AuthorizedAdminManagePage'; // 授权管理员 + static const authorizedAdminPage = + '/AuthorizedAdminPage'; // 授权管理员 static const volumeAuthorizationLockManagePage = '/VolumeAuthorizationLockManagePage'; // 批量授权锁 static const lockOperatingRecordPage = '/LockOperatingRecordPage'; // 操作记录 @@ -499,8 +502,8 @@ abstract class AppRouters { page: () => const ElectronicKeyDetailChangeDate(), ), GetPage( - name: Routers.sendElectronicKeyManagePage, - page: () => const SendElectronicKeyManagePage(), + name: Routers.sendElectronicKeyPage, + page: () => const SendElectronicKeyPage(), ), GetPage( name: Routers.massSendElectronicKeyManagePage, @@ -543,8 +546,8 @@ abstract class AppRouters { page: () => const AuthorizedAdminListPage(), ), GetPage( - name: Routers.authorizedAdminManagePage, - page: () => const AuthorizedAdminManagePage(), + name: Routers.authorizedAdminPage, + page: () => const AuthorizedAdminPage(), ), GetPage( name: Routers.lockOperatingRecordPage, @@ -564,15 +567,21 @@ abstract class AppRouters { ), GetPage( name: Routers.starLockLoginPage, - page: () => const StarLockLoginPage(), + page: () => F.sw( + defaultCall: () => const StarLockLoginPage(), + xhjCall: () => const StarLockLoginXHJPage()), ), GetPage( name: Routers.starLockRegisterPage, - page: () => const StarLockRegisterPage(), + page: () => F.sw( + defaultCall: () => const StarLockRegisterPage(), + xhjCall: () => const StarLockRegisterXHJPage()), binding: StarLockRegisterBinding()), GetPage( name: Routers.starLockForgetPasswordPage, - page: () => const StarLockForgetPasswordPage(), + page: () => F.sw( + defaultCall: () => const StarLockForgetPasswordPage(), + xhjCall: () => const StarLockForgetPasswordXHJPage()), ), GetPage( name: Routers.selectCountryRegionPage, @@ -1011,9 +1020,7 @@ abstract class AppRouters { // GetPage( // name: Routers.addCardTypeManagePage, // page: () => const AddCardTypeManagePage()), - GetPage( - name: Routers.addCardPage, - page: () => const AddCardPage()), + GetPage(name: Routers.addCardPage, page: () => const AddCardPage()), GetPage(name: Routers.cardDetailPage, page: () => const CardDetailPage()), GetPage( name: Routers.fingerprintListPage, @@ -1025,9 +1032,7 @@ abstract class AppRouters { name: Routers.fingerprintDetailPage, page: () => const FingerprintDetailPage()), GetPage(name: Routers.faceListPage, page: () => const FaceListPage()), - GetPage( - name: Routers.addFaceTypePage, - page: () => const AddFaceTypePage()), + GetPage(name: Routers.addFaceTypePage, page: () => const AddFaceTypePage()), GetPage( name: Routers.passwordKeyDetailChangeDatePage, page: () => const PasswordKeyDetailChangeDatePage()), diff --git a/star_lock/lib/login/forgetPassword/starLock_forgetPassword_xhj_page.dart b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_xhj_page.dart new file mode 100644 index 00000000..013aa9c2 --- /dev/null +++ b/star_lock/lib/login/forgetPassword/starLock_forgetPassword_xhj_page.dart @@ -0,0 +1,200 @@ +import 'dart:async'; + +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/appRouters.dart'; +import 'package:star_lock/app_settings/app_colors.dart'; +import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_logic.dart'; +import 'package:star_lock/tools/submitBtn.dart'; +import 'package:star_lock/tools/tf_loginInput.dart'; +import 'package:star_lock/tools/titleAppBar.dart'; +import 'package:star_lock/translations/trans_lib.dart'; + +class StarLockForgetPasswordXHJPage extends StatefulWidget { + const StarLockForgetPasswordXHJPage({Key? key}) : super(key: key); + + @override + State createState() => + _StarLockForgetPasswordPageState(); +} + +class _StarLockForgetPasswordPageState + extends State { + final logic = Get.put(StarLockForgetPasswordLogic()); + final state = Get.find().state; + + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: const Color(0xFFFFFFFF), + appBar: TitleAppBar( + barTitle: "忘记密码".tr, + haveBack: true, + iconColor: AppColors.blackColor, + titleColor: AppColors.blackColor, + backgroundColor: Colors.white), + body: ListView( + padding: EdgeInsets.only(left: 40.w, right: 40.w), + children: [ + GestureDetector( + onTap: () async { + var result = await Navigator.pushNamed( + context, Routers.selectCountryRegionPage); + if (result != null) { + result as Map; + state.countryCode.value = result['code']; + state.countryName.value = result['countryName']; + } + }, + child: SizedBox( + height: 70.h, + child: Row( + children: [ + SizedBox(width: 5.w), + Text(TranslationLoader.lanKeys!.countryAndRegion!.tr, + style: TextStyle( + fontSize: 26.sp, color: AppColors.blackColor)), + SizedBox(width: 60.w), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Obx(() => Text( + '${state.countryName} +${state.countryCode}', + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 26.sp, color: AppColors.mainColor), + )) + ], + ), + ], + ), + ), + ), + Container( + height: 0.5.h, + color: Colors.grey, + ), + LoginInput( + controller: state.phoneController, + onchangeAction: (v) { + logic.checkNext(state.phoneController); + }, + leftWidget: Padding( + padding: EdgeInsets.only( + top: 30.w, bottom: 20.w, right: 20.w, left: 5.w), + ), + label: + TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, + keyboardType: TextInputType.number, + inputFormatters: [ + LengthLimitingTextInputFormatter(30), + ]), + LoginInput( + controller: state.pwdController, + onchangeAction: (v) { + logic.checkNext(state.pwdController); + }, + isPwd: true, + leftWidget: Padding( + padding: EdgeInsets.only( + top: 30.w, bottom: 20.w, right: 20.w, left: 5.w), + ), + label: + "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}", + inputFormatters: [ + LengthLimitingTextInputFormatter(20), + ]), + Text( + TranslationLoader.lanKeys!.registerPasswordTip!.tr, + style: TextStyle( + color: AppColors.placeholderTextColor, fontSize: 20.sp), + ), + LoginInput( + controller: state.sureController, + onchangeAction: (v) { + logic.checkNext(state.sureController); + }, + isPwd: true, + leftWidget: Padding( + padding: EdgeInsets.only( + top: 30.w, bottom: 20.w, right: 20.w, left: 5.w), + ), + label: + "${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}", + inputFormatters: [ + LengthLimitingTextInputFormatter(20), + ]), + Row( + children: [ + Expanded( + child: LoginInput( + controller: state.codeController, + onchangeAction: (v) { + logic.checkNext(state.codeController); + }, + leftWidget: Padding( + padding: EdgeInsets.only(right: 10.w, left: 5.w), + ), + hintText: + "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}", + inputFormatters: [ + LengthLimitingTextInputFormatter(20), + ]), + ), + Obx(() => GestureDetector( + onTap: (state.phoneStrIsOK.value && state.canResend.value) + ? () async { + var result = await Navigator.pushNamed( + context, Routers.safetyVerificationPage, + arguments: { + "countryCode": state.countryCode.value, + "account": state.phoneStr.value + }); + logic.state.xWidth.value = + (result as Map)['xWidth']; + logic.sendValidationCode(); + } + : null, + child: Container( + width: 180.w, + padding: EdgeInsets.all(10.h), + child: Center( + child: Text(state.btnText.value, + textAlign: TextAlign.center, + style: TextStyle( + color: AppColors.mainColor, + fontSize: 24.sp, + )), + ), + ), + )), + SizedBox( + width: 10.w, + ), + ], + ), + // ], + // ), + SizedBox(height: 50.w), + Obx(() { + return SubmitBtn( + btnName: + "${TranslationLoader.lanKeys!.reset!.tr}${TranslationLoader.lanKeys!.password!.tr}", + // backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey], + fontSize: 30.sp, + borderRadius: 20.w, + padding: EdgeInsets.only(top: 25.w, bottom: 25.w), + isDisabled: state.canSub.value, + onClick: state.canSub.value + ? () { + logic.resetPassword(); + } + : null); + }), + ], + )); + } +} diff --git a/star_lock/lib/login/login/starLock_login_xhj_page.dart b/star_lock/lib/login/login/starLock_login_xhj_page.dart new file mode 100644 index 00000000..15ac2e42 --- /dev/null +++ b/star_lock/lib/login/login/starLock_login_xhj_page.dart @@ -0,0 +1,337 @@ +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 '../../appRouters.dart'; +import '../../app_settings/app_colors.dart'; +import '../../common/XSConstantMacro/XSConstantMacro.dart'; +import '../../tools/commonItem.dart'; +import '../../tools/tf_loginInput.dart'; +import '../../tools/submitBtn.dart'; +import '../../tools/titleAppBar.dart'; +import '../../translations/trans_lib.dart'; +import 'starLock_login_logic.dart'; + +class StarLockLoginXHJPage extends StatefulWidget { + const StarLockLoginXHJPage({Key? key}) : super(key: key); + + @override + State createState() => _StarLockLoginPageState(); +} + +class _StarLockLoginPageState extends State { + final logic = Get.put(StarLockLoginLogic()); + final state = Get.find().state; + + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: const Color(0xFFFFFFFF), + body: ListView( + padding: EdgeInsets.only(top: 120.h, left: 40.w, right: 40.w), + children: [ + Text( + '${"欢迎使用".tr}${F.title}', + style: TextStyle( + color: AppColors.darkGrayTextColor, + fontSize: 48.sp, + ), + ), + SizedBox(height: 30.h), + GestureDetector( + onTap: () async { + var result = await Get.toNamed(Routers.selectCountryRegionPage); + if (result != null) { + result as Map; + state.countryCode.value = result['code']; + state.countryName.value = result['countryName']; + } + }, + child: Container( + color: Colors.transparent, + child: Row( + children: [ + SizedBox( + width: 5.w, + ), + Text( + TranslationLoader.lanKeys!.countryAndRegion!.tr, + style: TextStyle( + fontSize: 22.sp, color: AppColors.darkGrayTextColor), + ), + SizedBox( + width: 40.w, + ), + Text( + '${state.countryName.value} +${state.countryCode.value}', + style: TextStyle( + fontSize: 22.sp, color: AppColors.mainColor), + ) + ], + ), + ), + ), + LoginInput( + controller: state.emailOrPhoneController, + onchangeAction: (v) { + logic.checkNext(state.emailOrPhoneController); + }, + leftWidget: Padding( + padding: EdgeInsets.only( + top: 30.w, + bottom: 20.w, + right: 20.w, + ), + ), + rightSlot: IconButton( + icon: Icon(Icons.close), + onPressed: () {}, + ), + label: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, + // keyboardType: TextInputType.number, + inputFormatters: [ + LengthLimitingTextInputFormatter(30), + ]), + LoginInput( + controller: state.pwdController, + onchangeAction: (v) { + logic.checkNext(state.pwdController); + }, + isPwd: true, + leftWidget: Padding( + padding: EdgeInsets.only( + top: 30.w, + bottom: 20.w, + right: 20.w, + ), + ), + label: + "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}", + inputFormatters: [ + LengthLimitingTextInputFormatter(20), + ]), + SizedBox(height: 30.h), + GestureDetector( + onTap: () { + state.agree.value = !state.agree.value; + logic.changeAgreeState(); + }, + child: Padding( + padding: EdgeInsets.symmetric(vertical: 10.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Obx( + () => Container( + padding: EdgeInsets.only( + left: 5.w, + right: 10.w, + ), + child: Image.asset( + state.agree.value + ? 'images/icon_round_select.png' + : 'images/icon_round_unSelect.png', + width: 20.w, + height: 20.w, + ), + ), + ), + Flexible( + child: RichText( + text: TextSpan( + text: TranslationLoader.lanKeys!.readAndAgree!.tr, + style: TextStyle( + color: const Color(0xff333333), fontSize: 20.sp), + children: [ + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: GestureDetector( + child: Text( + '《${TranslationLoader.lanKeys!.userAgreement!.tr}》', + style: TextStyle( + color: AppColors.mainColor, + fontSize: 20.sp)), + onTap: () { + Get.toNamed(Routers.webviewShowPage, + arguments: { + "url": XSConstantMacro.userAgreementURL, + "title": '用户协议'.tr + }); + }, + )), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: GestureDetector( + child: Text( + '《${TranslationLoader.lanKeys!.privacyPolicy!.tr}》', + style: TextStyle( + color: AppColors.mainColor, + fontSize: 20.sp)), + onTap: () { + Get.toNamed(Routers.webviewShowPage, + arguments: { + "url": XSConstantMacro.privacyPolicyURL, + "title": '隐私政策'.tr + }); + }, + )), + ], + )), + ) + ], + ), + ), + ), + SizedBox(height: 15.w), + Obx(() => SubmitBtn( + btnName: TranslationLoader.lanKeys!.login!.tr, + fontSize: 28.sp, + borderRadius: 20.w, + padding: EdgeInsets.only(top: 25.w, bottom: 25.w), + isDisabled: state.canNext.value, + onClick: state.canNext.value + ? () { + if (state.agree.value == false) { + logic.showToast('请先同意用户协议及隐私政策'.tr); + return; + } else { + logic.login(); + } + } + : null)), + SizedBox(height: 10.h), + ElevatedButton( + onPressed: () async { + var data = await Get.toNamed(Routers.starLockRegisterPage); + if (data != null) { + state.emailOrPhoneController.text = data['phoneOrEmailStr']; + logic.checkNext(state.emailOrPhoneController); + state.pwdController.text = data['pwd']; + logic.checkNext(state.pwdController); + } + }, + style: ElevatedButton.styleFrom( + backgroundColor: AppColors.mainColor), + child: Text( + TranslationLoader.lanKeys!.register!.tr, + style: TextStyle(fontSize: 22.sp, color: Colors.white), + ), + ), + SizedBox(height: 5.w), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + GestureDetector( + child: SizedBox( + // width: 150.w, + height: 50.h, + // color: Colors.red, + child: Center( + child: Text( + '${TranslationLoader.lanKeys!.forgetPassword!.tr}?', + style: TextStyle( + fontSize: 22.sp, color: AppColors.mainColor)), + ), + ), + onTap: () { + Navigator.pushNamed( + context, Routers.starLockForgetPasswordPage); + }, + ), + Expanded( + child: SizedBox( + width: 10.sp, + )), + F.isLite + ? Container() + : GestureDetector( + child: SizedBox( + // width: 150.w, + height: 50.h, + // color: Colors.red, + child: Center( + child: Text('演示模式'.tr, + style: TextStyle( + fontSize: 22.sp, + color: AppColors.mainColor)), + ), + ), + onTap: () { + Get.toNamed(Routers.demoModeLockDetailPage); + }, + ) + ], + ), + ], + )); + } + + Widget loginInput( + {TextEditingController? controller, + List? inputFormatters, + String? hintText, + bool? isHaveLeftWidget, + Widget? leftWidget, + String? label, + bool? isPwd, + BlockStrCallback? onchangeAction}) { + return Container( + width: 1.sp, + child: Column( + children: [ + Row( + children: [ + Container( + color: Colors.red, + child: Image.asset( + 'images/icon_login_password.png', + width: 36.w, + height: 36.w, + ), + ), + SizedBox( + width: 40.w, + ), + Expanded( + child: TextField( + //输入框一行 + maxLines: 1, + controller: controller, + onChanged: onchangeAction, + // autofocus: false, + inputFormatters: inputFormatters, + decoration: InputDecoration( + //输入里面输入文字内边距设置 + contentPadding: const EdgeInsets.only( + top: 8.0, left: -19.0, right: -15.0, bottom: 8.0), + labelText: label, + labelStyle: TextStyle(fontSize: 22.sp), + hintStyle: TextStyle(fontSize: 22.sp), + hintText: hintText, + //不需要输入框下划线 + border: InputBorder.none, + //左边图标设置 + // icon: isHaveLeftWidget == true + // ? leftWidget + // : SizedBox( + // width: 20.w, + // height: 40.w, + // ), + ), + obscureText: isPwd ?? false, + ), + ), + ], + ), + Container( + height: 0.5.h, + color: Colors.grey, + ), + ], + ), + ); + } +} diff --git a/star_lock/lib/login/register/starLock_register_xhj_page.dart b/star_lock/lib/login/register/starLock_register_xhj_page.dart new file mode 100644 index 00000000..c636f2c5 --- /dev/null +++ b/star_lock/lib/login/register/starLock_register_xhj_page.dart @@ -0,0 +1,305 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; + +import '../../appRouters.dart'; +import '../../app_settings/app_colors.dart'; +import '../../common/XSConstantMacro/XSConstantMacro.dart'; +import '../../tools/tf_loginInput.dart'; +import '../../tools/submitBtn.dart'; +import '../../tools/titleAppBar.dart'; +import '../../translations/trans_lib.dart'; +import 'starLock_register_logic.dart'; + +class StarLockRegisterXHJPage extends StatefulWidget { + const StarLockRegisterXHJPage({Key? key}) : super(key: key); + + @override + State createState() => _StarLockRegisterPageState(); +} + +class _StarLockRegisterPageState extends State { + final logic = Get.put(StarLockRegisterLogic()); + final state = Get.find().state; + + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: Colors.white, + appBar: TitleAppBar( + barTitle: TranslationLoader.lanKeys!.register!.tr, + haveBack: true, + iconColor: AppColors.blackColor, + titleColor: AppColors.blackColor, + backgroundColor: Colors.white), + body: ListView( + padding: EdgeInsets.only(left: 40.w, right: 40.w), + children: [ + topSelectCountryAndRegionWidget(), + middleTFWidget(), + _buildBottomAgreement(), + SizedBox( + height: 10.h, + ), + Obx(() { + return SubmitBtn( + btnName: TranslationLoader.lanKeys!.register!.tr, + // backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey], + fontSize: 30.sp, + borderRadius: 20.w, + padding: EdgeInsets.only(top: 25.w, bottom: 25.w), + isDisabled: state.canSub.value, + onClick: state.canSub.value + ? () { + if (state.agree.value == false) { + logic.showToast('请先同意用户协议及隐私政策'.tr); + return; + } else { + logic.register(); + } + } + : null); + }), + ], + )); + } + + Widget topSelectCountryAndRegionWidget() { + return Column( + children: [ + Container( + height: 80.h, + child: DefaultTabController( + length: 2, + child: TabBar( + onTap: (int index) { + state.isIphoneType.value = index == 0; + }, + overlayColor: MaterialStateProperty.resolveWith((states) { + return Colors.transparent; + }), + dividerHeight: 0, + indicatorSize: TabBarIndicatorSize.tab, + tabs: [ + Text(TranslationLoader.lanKeys!.iphone!.tr), + Text(TranslationLoader.lanKeys!.email!.tr) + ], + indicatorColor: AppColors.mainColor, + labelStyle: + TextStyle(color: AppColors.mainColor, fontSize: 26.sp), + unselectedLabelStyle: + TextStyle(color: AppColors.blackColor, fontSize: 22.sp), + ), + ), + ), + SizedBox( + height: 15.h, + ), + GestureDetector( + onTap: () async { + var result = await Get.toNamed(Routers.selectCountryRegionPage); + if (result != null) { + result as Map; + state.countryCode.value = result['code']; + state.countryName.value = result['countryName']; + } + Get.log("路由返回值: $result, countryCode:${logic.state.countryCode}"); + }, + child: Obx(() => Container( + color: Colors.white, + height: 70.h, + child: Row( + children: [ + SizedBox(width: 5.w), + Text(TranslationLoader.lanKeys!.countryAndRegion!.tr, + style: TextStyle( + fontSize: 26.sp, color: AppColors.blackColor)), + SizedBox(width: 50.w), + Text( + state.isIphoneType.value + ? '${state.countryName.value} +${state.countryCode.value}' + : state.countryName.value, + style: TextStyle( + fontSize: 26.sp, color: AppColors.mainColor), + ), + ], + ), + )), + ), + ], + ); + } + + Widget middleTFWidget() { + return Column( + children: [ + Obx(() => LoginInput( + controller: state.phoneOrEmailController, + onchangeAction: (v) { + logic.checkNext(state.phoneOrEmailController); + }, + leftWidget: Padding( + padding: EdgeInsets.only(right: 10.w, left: 5.w), + ), + label: + "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${state.isIphoneType.value ? "手机号".tr : TranslationLoader.lanKeys!.email!.tr}", + keyboardType: TextInputType.number, + inputFormatters: [ + LengthLimitingTextInputFormatter(30), + ])), + LoginInput( + controller: state.pwdController, + onchangeAction: (v) { + logic.checkNext(state.pwdController); + }, + isPwd: true, + leftWidget: Padding( + padding: EdgeInsets.only(right: 10.w, left: 5.w), + ), + label: + "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}", + inputFormatters: [ + LengthLimitingTextInputFormatter(20), + ]), + Text( + TranslationLoader.lanKeys!.registerPasswordTip!.tr, + style: + TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp), + ), + LoginInput( + controller: state.sureController, + onchangeAction: (v) { + logic.checkNext(state.sureController); + }, + isPwd: true, + leftWidget: Padding( + padding: EdgeInsets.only(right: 10.w, left: 5.w), + ), + label: + "${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}", + inputFormatters: [ + LengthLimitingTextInputFormatter(20), + ]), + Row( + children: [ + Expanded( + child: LoginInput( + controller: state.codeController, + onchangeAction: (v) { + logic.checkNext(state.codeController); + }, + leftWidget: Padding( + padding: EdgeInsets.only(right: 10.w, left: 5.w), + ), + label: + "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}", + inputFormatters: [ + LengthLimitingTextInputFormatter(20), + ]), + ), + Obx(() => GestureDetector( + onTap: + state.phoneOrEmailStrIsOK.value && state.canResend.value + ? () async { + // Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value}); + var result = await Navigator.pushNamed( + context, Routers.safetyVerificationPage, + arguments: { + "countryCode": state.countryCode, + "account": state.phoneOrEmailStr.value + }); + state.xWidth.value = + (result as Map)['xWidth']; + logic.sendValidationCode(); + } + : null, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(10.h), + child: Center( + child: Text(state.btnText.value, + textAlign: TextAlign.center, + style: TextStyle( + color: AppColors.mainColor, + fontSize: 22.sp, + )), + ), + ), + )), + SizedBox( + width: 20.w, + ), + ], + ), + SizedBox(height: 50.w), + ], + ); + } + + Widget _buildBottomAgreement() { + return GestureDetector( + onTap: () { + state.agree.value = !state.agree.value; + logic.changeAgreeState(); + }, + child: Padding( + padding: EdgeInsets.symmetric(vertical: 16.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Obx(() => Image.asset( + state.agree.value + ? 'images/icon_round_select.png' + : 'images/icon_round_unSelect.png', + width: 20.w, + height: 20.w, + )), + SizedBox( + width: 15.w, + ), + Flexible( + child: RichText( + text: TextSpan( + text: TranslationLoader.lanKeys!.readAndAgree!.tr, + style: + TextStyle(color: const Color(0xff333333), fontSize: 20.sp), + children: [ + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: GestureDetector( + child: Text( + '《${TranslationLoader.lanKeys!.userAgreement!.tr}》', + style: TextStyle( + color: AppColors.mainColor, fontSize: 20.sp)), + onTap: () { + Get.toNamed(Routers.webviewShowPage, arguments: { + "url": XSConstantMacro.userAgreementURL, + "title": '用户协议'.tr + }); + }, + )), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: GestureDetector( + child: Text( + '《${TranslationLoader.lanKeys!.privacyPolicy!.tr}》', + style: TextStyle( + color: AppColors.mainColor, fontSize: 20.sp)), + onTap: () { + Get.toNamed(Routers.webviewShowPage, arguments: { + "url": XSConstantMacro.privacyPolicyURL, + "title": '隐私政策'.tr + }); + }, + )), + ], + )), + ) + ], + ), + ), + ); + } +} diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdminManage/authorizedAdminManage_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdminManage/authorizedAdminManage_page.dart deleted file mode 100644 index fb3f04e0..00000000 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdminManage/authorizedAdminManage_page.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; - -import '../../../../../app_settings/app_colors.dart'; -import '../../../../../tools/titleAppBar.dart'; -import '../../../../../translations/trans_lib.dart'; -import 'authorizedAdminManage_tabbar.dart'; - -class AuthorizedAdminManagePage extends StatefulWidget { - const AuthorizedAdminManagePage({Key? key}) : super(key: key); - - @override - State createState() => - _AuthorizedAdminManagePageState(); -} - -class _AuthorizedAdminManagePageState extends State { - var index = 0; - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: AppColors.mainBackgroundColor, - appBar: TitleAppBar( - barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr, - haveBack: true, - backgroundColor: AppColors.mainColor), - body: Column( - children: [ - AuthorizedAdminManageTabbar( - initialIndex: index, - ), - ], - ), - ); - } -} diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdminManage/authorizedAdminManage_tabbar.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdminManage/authorizedAdminManage_tabbar.dart deleted file mode 100644 index 47e36caf..00000000 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdminManage/authorizedAdminManage_tabbar.dart +++ /dev/null @@ -1,118 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../../../../app_settings/app_colors.dart'; -import '../../../../../tools/CustomUnderlineTabIndicator.dart'; -import '../../../../../translations/trans_lib.dart'; -import '../../../electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart'; -import '../authorizedAdmin_page.dart'; - -class AuthorizedAdminManageTabbar extends StatefulWidget { - var initialIndex = 1; - - AuthorizedAdminManageTabbar({Key? key, required this.initialIndex}) : super(key: key); - - @override - State createState() => - _AuthorizedAdminManageTabbarState(); -} - -class _AuthorizedAdminManageTabbarState extends State with SingleTickerProviderStateMixin { - late TabController _tabController; - - final List _itemTabs = [ - ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, type: "0"), - ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: "1"), - ]; - - @override - void initState() { - // TODO: implement initState - super.initState(); - _tabController = TabController( - vsync: this, - length: _itemTabs.length, - initialIndex: widget.initialIndex); - - _tabController.addListener(() { - // print("_tabController.animation!.value:${_tabController.animation!.value} _tabController.index:${_tabController.index}"); - if (_tabController.animation!.value==_tabController.index){ - FocusScope.of(context).requestFocus(FocusNode()); - } - }); - } - - @override - Widget build(BuildContext context) { - return Expanded( - child: Column( - children: [ - _tabBar(), - _pageWidget(), - ], - )); - } - - TabBar _tabBar() { - return TabBar( - controller: _tabController, - tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(), - onTap: (index){ - FocusScope.of(context).requestFocus(FocusNode()); - }, - isScrollable: true, - indicatorColor: Colors.red, - unselectedLabelColor: Colors.black, - unselectedLabelStyle: TextStyle( - color: AppColors.mainColor, - fontSize: 24.sp, - ), - automaticIndicatorColorAdjustment: true, - labelColor: AppColors.mainColor, - labelStyle: TextStyle( - color: AppColors.mainColor, - fontSize: 24.sp, - fontWeight: FontWeight.w600), - indicator: CustomUnderlineTabIndicator( - borderSide: BorderSide(color: AppColors.mainColor, width: 4.w), - strokeCap: StrokeCap.round, - width: 30.w), - ); - } - - Tab _tab(ItemView item) { - return Tab( - // text: item.title, - child: Container( - width: 1.sw / 4, - margin: EdgeInsets.all(10.w), - // color: Colors.red, - child: Text( - item.title, - textAlign: TextAlign.center, - ), - ), - ); - } - - Widget _pageWidget() { - return Expanded( - child: TabBarView( - controller: _tabController, - children: _itemTabs - .map((ItemView item) => AuthorizedAdminPage( - type: item.type, - )) - .toList(), - ), - ); - } -} - -class ItemView { - const ItemView({required this.title, required this.type}); - - final String title; - final String type; -} diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart index 3747472d..25710563 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart @@ -1,3 +1,4 @@ + import 'dart:async'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; @@ -13,6 +14,7 @@ import '../../../../blue/io_tool/manager_event_bus.dart'; import '../../../../blue/sender_manage.dart'; import '../../../../network/api_repository.dart'; import '../../../../tools/baseGetXController.dart'; +import '../../../../tools/commonDataManage.dart'; import '../../../../tools/eventBusEventManage.dart'; import '../../../../tools/showTipView.dart'; import '../../../../tools/storage.dart'; @@ -220,10 +222,9 @@ class AuthorizedAdminLogic extends BaseGetXController { var endDate = "0"; var startTime = "0"; var endTime = "0"; - String lockID = state.keyInfo.value.lockId.toString(); - Get.log("state.type.value:${state.type.value}"); + Get.log("state.type.value:${state.seletType.value}"); String getKeyType = "1"; - if (state.type.value == '0') { + if (state.seletType.value == 0) { getKeyType = "2"; startDate = DateTool().dateToTimestamp(state.beginDate.value, 1).toString(); @@ -257,7 +258,7 @@ class AuthorizedAdminLogic extends BaseGetXController { keyNameForAdmin: state.keyNameController.text, keyRight: '1', keyType: getKeyType, - lockId: lockID, + lockId: CommonDataManage().currentKeyInfo.lockId!.toString(), operatorUid: '', receiverUsername: state.emailOrPhoneController.text, remarks: '', @@ -289,7 +290,7 @@ class AuthorizedAdminLogic extends BaseGetXController { //标记房间为已入住 isOn:已入住: 1 空闲:2 Future updateRoomCheckIn() async { var entity = await ApiRepository.to.setRoomStatusData( - lockId: state.keyInfo.value.lockId!, + lockId: CommonDataManage().currentKeyInfo.lockId!, roomStatus: 1, ); if (entity.errorCode!.codeIsSuccessful) { diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart index 00103bad..7831042c 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart @@ -6,7 +6,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/tools/dateTool.dart'; -import 'package:star_lock/tools/dateUtils.dart'; import 'package:star_lock/tools/pickers/pickers.dart'; import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart'; import 'package:star_lock/tools/showTipView.dart'; @@ -14,36 +13,59 @@ import 'package:star_lock/tools/storage.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/CustomUnderlineTabIndicator.dart'; import '../../../../tools/NativeInteractionTool.dart'; import '../../../../tools/commonItem.dart'; import '../../../../tools/submitBtn.dart'; +import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; import 'authorizedAdmin_logic.dart'; class AuthorizedAdminPage extends StatefulWidget { - final String type; - const AuthorizedAdminPage({Key? key, required this.type}) : super(key: key); + const AuthorizedAdminPage({Key? key}) : super(key: key); @override State createState() => _AuthorizedAdminPageState(); } -class _AuthorizedAdminPageState extends State { +class _AuthorizedAdminPageState extends State with SingleTickerProviderStateMixin { final logic = Get.put(AuthorizedAdminLogic()); final state = Get.find().state; @override void initState() { + // TODO: implement initState super.initState(); + + state.tabController = TabController( + vsync: this, + length: _itemTabs.length, + initialIndex: 0); + state.tabController.addListener(() { + WidgetsBinding.instance.addPostFrameCallback((_) { + state.seletType.value = state.tabController.index; + }); + + if (state.tabController.animation!.value == state.tabController.index) { + FocusScope.of(context).requestFocus(FocusNode()); + } + }); } @override Widget build(BuildContext context) { - state.type.value = widget.type; - Get.log("widget.type:${widget.type}"); - - return SingleChildScrollView( - child: Obx(() => indexChangeWidget()), + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr, + haveBack: true, + backgroundColor: AppColors.mainColor), + body: Column( + children: [ + _tabBar(), + _pageWidget(), + ], + ), ); } @@ -51,28 +73,32 @@ class _AuthorizedAdminPageState extends State { if (state.isSendSuccess.value) { return sendElectronicKeySucceed(); } else { - switch (int.parse(widget.type)) { + switch (state.seletType.value) { case 0: { // 限时 - return Column( - children: [ - keyInfoWidget(), - keyTimeWidget(), - keyRealNameWidget(), - keyBottomWidget( - TranslationLoader.lanKeys!.authorizedAdminTip!.tr) - ], + return SingleChildScrollView( + child: Column( + children: [ + keyInfoWidget(), + keyTimeWidget(), + keyRealNameWidget(), + keyBottomWidget( + TranslationLoader.lanKeys!.authorizedAdminTip!.tr) + ], + ), ); } default: // 永久 - return Column( - children: [ - keyInfoWidget(), - keyRealNameWidget(), - keyBottomWidget(TranslationLoader.lanKeys!.authorizedAdminTip!.tr) - ], + return SingleChildScrollView( + child: Column( + children: [ + keyInfoWidget(), + keyRealNameWidget(), + keyBottomWidget(TranslationLoader.lanKeys!.authorizedAdminTip!.tr) + ], + ), ); } } @@ -345,6 +371,8 @@ class _AuthorizedAdminPageState extends State { FilteringTextInputFormatter.deny('\n'), LengthLimitingTextInputFormatter(30), ], + style: TextStyle( + fontSize: 22.sp, color: AppColors.darkGrayTextColor), controller: lineIndex == 1 ? state.emailOrPhoneController : state.keyNameController, @@ -561,4 +589,67 @@ class _AuthorizedAdminPageState extends State { default: } } + + TabBar _tabBar() { + return TabBar( + controller: state.tabController, + tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(), + onTap: (index){ + FocusScope.of(context).requestFocus(FocusNode()); + }, + isScrollable: true, + indicatorColor: Colors.red, + unselectedLabelColor: Colors.black, + unselectedLabelStyle: TextStyle( + color: AppColors.mainColor, + fontSize: 24.sp, + ), + automaticIndicatorColorAdjustment: true, + labelColor: AppColors.mainColor, + labelStyle: TextStyle( + color: AppColors.mainColor, + fontSize: 24.sp, + fontWeight: FontWeight.w600), + indicator: CustomUnderlineTabIndicator( + borderSide: BorderSide(color: AppColors.mainColor, width: 4.w), + strokeCap: StrokeCap.round, + width: 30.w), + ); + } + + Tab _tab(ItemView item) { + return Tab( + // text: item.title, + child: Container( + width: 1.sw / 4, + margin: EdgeInsets.all(10.w), + // color: Colors.red, + child: Text( + item.title, + textAlign: TextAlign.center, + ), + ), + ); + } + + Widget _pageWidget() { + return Expanded( + child: TabBarView( + controller: state.tabController, + children: _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList() + ), + ); + } + + final List _itemTabs = [ + ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, type: "0"), + ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: "1"), + ]; +} + +class ItemView { + const ItemView({required this.title, required this.type}); + + final String title; + final String type; } diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart index 9886d400..1421ac32 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart @@ -6,16 +6,14 @@ import 'package:star_lock/tools/dateTool.dart'; import '../../../lockMian/entity/lockListInfo_entity.dart'; class AuthorizedAdminState { - final TextEditingController emailOrPhoneController = - TextEditingController(); //邮箱/手机号输入框 - final TextEditingController keyNameController = - TextEditingController(); //钥匙名输入框 + final TextEditingController emailOrPhoneController = TextEditingController(); //邮箱/手机号输入框 + final TextEditingController keyNameController = TextEditingController(); //钥匙名输入框 + late TabController tabController; final FlutterContactPicker contactPicker = FlutterContactPicker(); late Contact contact; - var type = ''.obs; - final keyInfo = LockListInfoItemEntity().obs; + // final keyInfo = LockListInfoItemEntity().obs; // final lockMainEntity = LockMainEntity().obs; final isAuthentication = false.obs; //是否可以实名认证 final onlyManageYouCreatesUser = false.obs; // 只能管理自己创建的用户 @@ -29,13 +27,13 @@ class AuthorizedAdminState { var weekdaysList = [].obs; var isCreateUser = false.obs; //用户未注册时传1 已注册传0 - final widgetType = 0.obs; + var seletType = 0.obs; String pwdShareStr = '您好,您的授权管理员生成成功'; var addUserId = ''.obs; - AuthorizedAdminState() { - Map map = Get.arguments; - // lockMainEntity.value = map["lockMainEntity"]; - keyInfo.value = map["keyInfo"]; - } + // AuthorizedAdminState() { + // Map map = Get.arguments; + // // lockMainEntity.value = map["lockMainEntity"]; + // keyInfo.value = map["keyInfo"]; + // } } diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart index eaac8936..dd967e4b 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart @@ -4,6 +4,7 @@ import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdminList/au import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/commonDataManage.dart'; import '../../../../tools/eventBusEventManage.dart'; @@ -14,10 +15,10 @@ class AuthorizedAdminListLogic extends BaseGetXController { Future mockNetworkDataRequest() async { ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList( endDate: '0', - keyId: state.keyInfo.value.keyId.toString(), + keyId: CommonDataManage().currentKeyInfo.keyId.toString(), keyStatus: '', keyRight: '1', - lockId: state.keyInfo.value.lockId.toString(), + lockId: CommonDataManage().currentKeyInfo.lockId.toString(), pageNo: pageNo.toString(), pageSize: pageSize.toString(), startDate: '0', diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart index 05a14171..1400711f 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart @@ -73,11 +73,7 @@ class _AuthorizedAdminListPageState extends State { AddBottomWhiteBtn( btnName: TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr, onClick: () { - Navigator.pushNamed(context, Routers.authorizedAdminManagePage, - arguments: { - // "lockMainEntity": state.lockMainEntity.value, - "keyInfo": state.keyInfo.value - }).then((val) { + Navigator.pushNamed(context, Routers.authorizedAdminPage).then((val) { if (val != null) { logic.pageNo = 1; mockRequest(); @@ -140,7 +136,6 @@ class _AuthorizedAdminListPageState extends State { child: _electronicKeyItem('images/controls_user.png', indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () { Navigator.pushNamed(context, Routers.electronicKeyDetailPage, arguments: { "itemData": indexEntity, - "keyInfo": state.keyInfo.value }).then((val) { if (val != null) { logic.mockNetworkDataRequest(); diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart index 3eaf0a74..89c703d2 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart @@ -4,15 +4,15 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity import '../../../lockMian/entity/lockListInfo_entity.dart'; class AuthorizedAdminListState { - final keyInfo = LockListInfoItemEntity().obs; + // final keyInfo = LockListInfoItemEntity().obs; // final lockMainEntity = LockMainEntity().obs; final itemDataList = [].obs; final searchStr = ''.obs; - AuthorizedAdminListState() { - Map map = Get.arguments; - // lockMainEntity.value = map["lockMainEntity"]; - keyInfo.value = map["keyInfo"]; - } + // AuthorizedAdminListState() { + // Map map = Get.arguments; + // // lockMainEntity.value = map["lockMainEntity"]; + // keyInfo.value = map["keyInfo"]; + // } } diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart index a5432bbe..4aa4707c 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart @@ -8,6 +8,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/elec import '../../../../../appRouters.dart'; import '../../../../../app_settings/app_colors.dart'; import '../../../../../common/XSConstantMacro/XSConstantMacro.dart'; +import '../../../../../tools/commonDataManage.dart'; import '../../../../../tools/commonItem.dart'; import '../../../../../tools/dateTool.dart'; import '../../../../../tools/showTFView.dart'; @@ -164,7 +165,7 @@ class _ElectronicKeyDetailPageState extends State { child: _onlyManageYouCreatesUserSwitch())), ), Visibility(// (state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false - visible: state.keyInfo.value.lockSetting!.remoteUnlock == 1 && state.itemData.value.keyRight != 1 ? true:false, + visible: CommonDataManage().currentKeyInfo.lockSetting!.remoteUnlock == 1 && state.itemData.value.keyRight != 1 ? true:false, child: CommonItem( leftTitel: "远程开锁".tr, rightTitle: "", diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart index 3bc57ed2..79e4f016 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart @@ -6,7 +6,7 @@ import '../../../../lockMian/entity/lockListInfo_entity.dart'; class ElectronicKeyDetailState { final itemData = ElectronicKeyListItem().obs; - final keyInfo = LockListInfoItemEntity().obs; + // final keyInfo = LockListInfoItemEntity().obs; final keyName = "".obs; final TextEditingController changeNameController = TextEditingController(); @@ -24,9 +24,9 @@ class ElectronicKeyDetailState { ElectronicKeyDetailState() { Map map = Get.arguments; itemData.value = map["itemData"]; - if(map["keyInfo"]!=null){ - keyInfo.value = map["keyInfo"]; - } + // if(map["keyInfo"]!=null){ + // keyInfo.value = map["keyInfo"]; + // } changeNameController.text = itemData.value.keyName!; keyName.value = itemData.value.keyName!; diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart index 947f7a2d..2da4162c 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart @@ -5,6 +5,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electr import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/commonDataManage.dart'; import 'package:star_lock/tools/showTipView.dart'; import '../../../../tools/eventBusEventManage.dart'; @@ -16,10 +17,10 @@ class ElectronicKeyListLogic extends BaseGetXController { Future mockNetworkDataRequest() async { ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList( endDate: '0', - keyId: state.keyInfo.value.keyId.toString(), + keyId: CommonDataManage().currentKeyInfo.keyId.toString(), keyStatus: '', keyRight: '0', - lockId: state.keyInfo.value.lockId.toString(), + lockId: CommonDataManage().currentKeyInfo.lockId.toString(), pageNo: pageNo.toString(), pageSize: pageSize.toString(), startDate: '0', @@ -41,7 +42,7 @@ class ElectronicKeyListLogic extends BaseGetXController { //电子钥匙重置请求 Future resetElectronicKeyListRequest() async { ElectronicKeyListEntity entity = await ApiRepository.to - .resetElectronicKey(state.keyInfo.value.lockId.toString(), '0'); + .resetElectronicKey(CommonDataManage().currentKeyInfo.lockId.toString(), '0'); if (entity.errorCode!.codeIsSuccessful) { showToast("重置成功".tr, something: (){ pageNo = 1; diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart index 9d263a66..91550e95 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart @@ -102,12 +102,7 @@ class _ElectronicKeyListPageState extends State { AddBottomWhiteBtn( btnName: TranslationLoader.lanKeys!.sendKey!.tr, onClick: () { - Navigator.pushNamed( - context, Routers.sendElectronicKeyManagePage, - arguments: { - // "lockMainEntity": state.lockMainEntity.value, - "keyInfo": state.keyInfo.value - }).then((val) { + Navigator.pushNamed(context, Routers.sendElectronicKeyPage).then((val) { if (val != null) { logic.pageNo = 1; mockRequest(); @@ -182,7 +177,6 @@ class _ElectronicKeyListPageState extends State { context, Routers.electronicKeyDetailPage, arguments: { "itemData": indexEntity, - "keyInfo": state.keyInfo.value }).then((val) { if (val != null) { logic.mockNetworkDataRequest(); diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart index b07f8f75..7d7f503e 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart @@ -6,15 +6,15 @@ import '../../../lockMian/entity/lockListInfo_entity.dart'; class ElectronicKeyListState { TextEditingController searchController = TextEditingController(); //邮箱/手机号输入框 - final keyInfo = LockListInfoItemEntity().obs; + // final keyInfo = LockListInfoItemEntity().obs; // final lockMainEntity = LockMainEntity().obs; var pageNum = 1.obs; //请求页码 final pageSize = 20.obs; //请求每页数据条数 final itemDataList = [].obs; - ElectronicKeyListState() { - Map map = Get.arguments; - // lockMainEntity.value = map["lockMainEntity"]; - keyInfo.value = map["keyInfo"]; - } + // ElectronicKeyListState() { + // Map map = Get.arguments; + // // lockMainEntity.value = map["lockMainEntity"]; + // keyInfo.value = map["keyInfo"]; + // } } diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart index 9b3352ae..d1bb5fac 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart @@ -1,15 +1,12 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.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/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import 'package:star_lock/tools/commonDataManage.dart'; import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/eventBusEventManage.dart'; -import 'package:star_lock/translations/trans_lib.dart'; import '../../../../../tools/showTipView.dart'; @@ -33,26 +30,25 @@ class SendElectronicKeyLogic extends BaseGetXController { var endDate = "0"; var startTime = "0"; var endTime = "0"; - String lockID = state.keyInfo.value.lockId.toString(); - int typeValue = int.parse(state.type.value); + int typeValue = state.seletType.value; switch (typeValue) { case 0: { + if (state.beginTime.value.isEmpty) { + showToast("请选择开始时间".tr); + return; + } + if (state.beginTime.value.isEmpty) { + showToast("请选择结束时间".tr); + return; + } + typeValue = XSConstantMacro.keyTypeTime; startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString(); endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString(); startTime = "0"; endTime = "0"; - if (startDate.isEmpty) { - showToast("请选择开始时间".tr); - return; - } - if (endDate.isEmpty) { - showToast("请选择结束时间".tr); - return; - } - // if(DateTime.now().millisecondsSinceEpoch > int.parse(state.beginTimeTimestamp.value)){ // Toast.show(msg: "生效时间要大于当前时间"); // return; @@ -100,7 +96,7 @@ class SendElectronicKeyLogic extends BaseGetXController { keyNameForAdmin: state.keyNameController.text, keyRight: '0', keyType: getKeyType, - lockId: lockID, + lockId: CommonDataManage().currentKeyInfo.lockId.toString(), operatorUid: '', receiverUsername: state.emailOrPhoneController.text, remarks: '', @@ -111,7 +107,7 @@ class SendElectronicKeyLogic extends BaseGetXController { isOnlyManageSelf: 0); if (entity.errorCode!.codeIsSuccessful) { state.isSendSuccess.value = true; - state.sendSucceedType.value = int.parse(state.type.value); + state.sendSucceedType.value = state.seletType.value; resetData(); eventBus.fire(ElectronicKeyListRefreshUI()); } else { @@ -221,7 +217,7 @@ class SendElectronicKeyLogic extends BaseGetXController { void resetData() { state.emailOrPhoneController.text = ""; state.keyNameController.text = ""; - if(state.type.value == "0"){ + if(state.seletType.value == 0){ state.beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间 state.endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());//默认为当前时间 }else{ 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 165ac986..82cccf90 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 @@ -15,102 +15,131 @@ import 'package:star_lock/tools/showTipView.dart'; import 'package:star_lock/tools/storage.dart'; import '../../../../../appRouters.dart'; +import '../../../../../tools/CustomUnderlineTabIndicator.dart'; import '../../../../../tools/NativeInteractionTool.dart'; +import '../../../../../tools/commonDataManage.dart'; import '../../../../../tools/commonItem.dart'; import '../../../../../tools/dateTool.dart'; import '../../../../../tools/submitBtn.dart'; +import '../../../../../tools/titleAppBar.dart'; import '../../../../../translations/trans_lib.dart'; class SendElectronicKeyPage extends StatefulWidget { - final String type; - - const SendElectronicKeyPage({Key? key, required this.type}) : super(key: key); + const SendElectronicKeyPage({Key? key}) : super(key: key); @override State createState() => _SendElectronicKeyPageState(); } -class _SendElectronicKeyPageState extends State { +class _SendElectronicKeyPageState extends State with SingleTickerProviderStateMixin { final logic = Get.put(SendElectronicKeyLogic()); final state = Get.find().state; - @override - initState() { - super.initState(); - getDemoMode(); - WidgetsBinding.instance.addPostFrameCallback((_) { - logic.resetData(); - }); - } - Future getDemoMode() async { state.isDemoMode = (await Storage.getBool(ifIsDemoModeOrNot))!; } @override - Widget build(BuildContext context) { - state.type.value = widget.type; - Get.log('state.type.value:${state.type.value}'); + void initState() { + // TODO: implement initState + super.initState(); - return SingleChildScrollView( - child: state.isDemoMode ? indexChangeWidget() : Obx(() => indexChangeWidget()), + getDemoMode(); + + state.tabController = TabController( + vsync: this, + length: _itemTabs.length, + initialIndex: 0); + state.tabController.addListener(() { + WidgetsBinding.instance.addPostFrameCallback((_) { + state.seletType.value = state.tabController.index; + }); + + if (state.tabController.animation!.value == state.tabController.index) { + FocusScope.of(context).requestFocus(FocusNode()); + } + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: TranslationLoader.lanKeys!.sendKey!.tr, + haveBack: true, + backgroundColor: AppColors.mainColor), + body: Column( + children: [ + _tabBar(), + _pageWidget(), + ], + ), ); } Widget indexChangeWidget() { if (state.isSendSuccess.value == true && - state.sendSucceedType.value.toString() == widget.type) { + state.sendSucceedType.value == state.seletType.value) { return sendElectronicKeySucceed(); } else { - switch (int.parse(widget.type)) { + switch (state.seletType.value) { case 0: { // 限时 - return Column( - children: [ - keyInfoWidget(), - keyTimeWidget(), - remoteUnlockingWidget(), - keyRealNameWidget(), - keyBottomWidget(state.timeLimitTips) - ], + return SingleChildScrollView( + child: Column( + children: [ + keyInfoWidget(), + keyTimeWidget(), + remoteUnlockingWidget(), + keyRealNameWidget(), + keyBottomWidget(state.timeLimitTips) + ], + ), ); } case 1: { // 永久 - return Column( - children: [ - keyInfoWidget(), - remoteUnlockingWidget(), - keyRealNameWidget(), - keyBottomWidget(state.permanentTips) - ], + return SingleChildScrollView( + child: Column( + children: [ + keyInfoWidget(), + remoteUnlockingWidget(), + keyRealNameWidget(), + keyBottomWidget(state.permanentTips) + ], + ), ); } case 2: { // 单次 - return Column( - children: [ - keyInfoWidget(), - remoteUnlockingWidget(), - keyRealNameWidget(), - keyBottomWidget(state.onceLimitTips) - ], + return SingleChildScrollView( + child: Column( + children: [ + keyInfoWidget(), + remoteUnlockingWidget(), + keyRealNameWidget(), + keyBottomWidget(state.onceLimitTips) + ], + ), ); } case 3: { // 循环 - return Column( - children: [ - keyInfoWidget(), - keyPeriodValidityWidget(), - remoteUnlockingWidget(), - keyRealNameWidget(), - keyBottomWidget(state.cycleLimitTips) - ], + return SingleChildScrollView( + child: Column( + children: [ + keyInfoWidget(), + keyPeriodValidityWidget(), + remoteUnlockingWidget(), + keyRealNameWidget(), + keyBottomWidget(state.cycleLimitTips) + ], + ), ); } default: @@ -441,7 +470,7 @@ class _SendElectronicKeyPageState extends State { // } var entity = await ApiRepository.to.setRoomStatusData( - lockId: state.keyInfo.value.lockId!, + lockId: CommonDataManage().currentKeyInfo.lockId!, roomStatus: 1, ); if (entity.errorCode!.codeIsSuccessful) { @@ -542,7 +571,7 @@ class _SendElectronicKeyPageState extends State { return Visibility( visible: state.isDemoMode ? false - : (state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false), + : (CommonDataManage().currentKeyInfo.lockSetting!.remoteUnlock == 1 ? true : false), child: Column( children: [ CommonItem( @@ -618,6 +647,65 @@ class _SendElectronicKeyPageState extends State { }); } + TabBar _tabBar() { + return TabBar( + controller: state.tabController, + onTap: (index){ + FocusScope.of(context).requestFocus(FocusNode()); + }, + tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(), + isScrollable: true, + indicatorColor: Colors.red, + unselectedLabelColor: Colors.black, + unselectedLabelStyle: TextStyle( + color: AppColors.mainColor, + fontSize: 24.sp, + ), + automaticIndicatorColorAdjustment: true, + labelColor: AppColors.mainColor, + labelStyle: TextStyle( + color: AppColors.mainColor, + fontSize: 24.sp, + fontWeight: FontWeight.w600), + indicator: CustomUnderlineTabIndicator( + borderSide: BorderSide(color: AppColors.mainColor, width: 4.w), + strokeCap: StrokeCap.round, + width: 30.w), + ); + } + + Tab _tab(ItemView item) { + return Tab( + // text: item.title, + child: Container( + // width: 1.sw / 8, + margin: EdgeInsets.all(10.w), + // color: Colors.red, + child: Text( + item.title, + textAlign: TextAlign.center, + ), + ), + ); + } + + Widget _pageWidget() { + return Expanded( + child: TabBarView( + controller: state.tabController, + children: _itemTabs + .map((ItemView item) => Obx(() => indexChangeWidget())).toList() + ), + ); + } + + final List _itemTabs = [ + ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, type: "0"), + ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: "1"), + ItemView(title: TranslationLoader.lanKeys!.once!.tr, type: "2"), + ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, type: "3"), + ]; + List initBottomSheetList() { List widgetList = []; @@ -694,3 +782,10 @@ class _SendElectronicKeyPageState extends State { } } } + +class ItemView { + const ItemView({required this.title, required this.type}); + + final String title; + final String type; +} diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart index 6529eb78..5d8d6d7a 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart @@ -9,9 +9,11 @@ class SendElectronicKeyState { TextEditingController emailOrPhoneController = TextEditingController(); //邮箱/手机号输入框 TextEditingController keyNameController = TextEditingController(); //钥匙名输入框 + late TabController tabController; + final FlutterContactPicker contactPicker = FlutterContactPicker(); late Contact contact; - final keyInfo = LockListInfoItemEntity().obs; + // final keyInfo = LockListInfoItemEntity().obs; final isRemoteUnlock = false.obs; //是否允许远程开锁 final isAuthentication = false.obs; //是否可以实名认证 @@ -22,7 +24,7 @@ class SendElectronicKeyState { var failureDateTime = "".obs;// 失效时间 var weekdaysList = [].obs; - var type = ''.obs;// 限时、永久、单次、循环 + var seletType = 0.obs;// 限时、永久、单次、循环 var isSendSuccess = false.obs; var countryName = '中国'.tr.obs; var countryCode = '86'.obs; @@ -37,9 +39,9 @@ class SendElectronicKeyState { final cycleLimitTips = '接收者可以在有效期内的固定时间段里,不限次数使用'; //循环 SendElectronicKeyState() { - Map map = Get.arguments; - if ((map["keyInfo"] != null)) { - keyInfo.value = map["keyInfo"]; - } + // Map map = Get.arguments; + // if ((map["keyInfo"] != null)) { + // keyInfo.value = map["keyInfo"]; + // } } } diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicManageKey/sendElectronicKeyManage_page.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicManageKey/sendElectronicKeyManage_page.dart deleted file mode 100644 index 17dbad60..00000000 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicManageKey/sendElectronicKeyManage_page.dart +++ /dev/null @@ -1,31 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; - -import '../../../../../app_settings/app_colors.dart'; -import '../../../../../tools/titleAppBar.dart'; -import '../../../../../translations/trans_lib.dart'; -import 'sendElectronicKeyManage_tabbar.dart'; - -class SendElectronicKeyManagePage extends StatefulWidget { - const SendElectronicKeyManagePage({Key? key}) : super(key: key); - - @override - State createState() => _SendElectronicKeyManagePageState(); -} - -class _SendElectronicKeyManagePageState extends State { - var index=0; - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: AppColors.mainBackgroundColor, - appBar: TitleAppBar(barTitle: TranslationLoader.lanKeys!.sendKey!.tr, haveBack:true, backgroundColor: AppColors.mainColor), - body: Column( - children: [ - SendElectronicKeyManageTabbar(initialIndex: index,), - ], - ), - ); - } -} diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicManageKey/sendElectronicKeyManage_tabbar.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicManageKey/sendElectronicKeyManage_tabbar.dart deleted file mode 100644 index fc4bdabd..00000000 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicManageKey/sendElectronicKeyManage_tabbar.dart +++ /dev/null @@ -1,122 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../../../../app_settings/app_colors.dart'; -import '../../../../../tools/CustomUnderlineTabIndicator.dart'; -import '../../../../../translations/trans_lib.dart'; -import '../sendElectronicKey/sendElectronicKey_page.dart'; - -class SendElectronicKeyManageTabbar extends StatefulWidget { - var initialIndex = 1; - - SendElectronicKeyManageTabbar({Key? key, required this.initialIndex}) - : super(key: key); - - @override - State createState() => - _SendElectronicKeyManageTabbarState(); -} - -class _SendElectronicKeyManageTabbarState - extends State - with SingleTickerProviderStateMixin { - late TabController _tabController; - - final List _itemTabs = [ - ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, type: "0"), - ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: "1"), - ItemView(title: TranslationLoader.lanKeys!.once!.tr, type: "2"), - ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, type: "3"), - ]; - - @override - void initState() { - // TODO: implement initState - super.initState(); - _tabController = TabController( - vsync: this, - length: _itemTabs.length, - initialIndex: widget.initialIndex); - - _tabController.addListener(() { - // print("_tabController.animation!.value:${_tabController.animation!.value} _tabController.index:${_tabController.index}"); - if (_tabController.animation!.value==_tabController.index){ - FocusScope.of(context).requestFocus(FocusNode()); - } - }); - } - - @override - Widget build(BuildContext context) { - return Expanded( - child: Column( - children: [ - _tabBar(), - _pageWidget(), - ], - )); - } - - TabBar _tabBar() { - return TabBar( - controller: _tabController, - onTap: (index){ - FocusScope.of(context).requestFocus(FocusNode()); - }, - tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(), - isScrollable: true, - indicatorColor: Colors.red, - unselectedLabelColor: Colors.black, - unselectedLabelStyle: TextStyle( - color: AppColors.mainColor, - fontSize: 24.sp, - ), - automaticIndicatorColorAdjustment: true, - labelColor: AppColors.mainColor, - labelStyle: TextStyle( - color: AppColors.mainColor, - fontSize: 24.sp, - fontWeight: FontWeight.w600), - indicator: CustomUnderlineTabIndicator( - borderSide: BorderSide(color: AppColors.mainColor, width: 4.w), - strokeCap: StrokeCap.round, - width: 30.w), - ); - } - - Tab _tab(ItemView item) { - return Tab( - // text: item.title, - child: Container( - // width: 1.sw / 8, - margin: EdgeInsets.all(10.w), - // color: Colors.red, - child: Text( - item.title, - textAlign: TextAlign.center, - ), - ), - ); - } - - Widget _pageWidget() { - return Expanded( - child: TabBarView( - controller: _tabController, - children: _itemTabs - .map((ItemView item) => SendElectronicKeyPage( - type: item.type, - )) - .toList(), - ), - ); - } -} - -class ItemView { - const ItemView({required this.title, required this.type}); - - final String title; - final String type; -} diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index 72f72823..4502a738 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -21,6 +21,7 @@ import '../../../blue/sender_manage.dart'; import '../../../network/api_repository.dart'; import '../../../permission/permission_dialog.dart'; import '../../../tools/baseGetXController.dart'; +import '../../../tools/commonDataManage.dart'; import '../../../tools/eventBusEventManage.dart'; import '../../../tools/storage.dart'; import '../../../translations/trans_lib.dart'; @@ -600,6 +601,7 @@ class LockDetailLogic extends BaseGetXController { state.keyInfos.value.lockSetting!.remoteUnlock = int.parse(event.setResult); } + CommonDataManage().currentKeyInfo = state.keyInfos.value; eventBus.fire(RefreshLockDetailInfoDataEvent()); }); } diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index 6fc08900..57d326af 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -522,7 +522,7 @@ class _LockDetailPageState extends State onTap: () { // logic.getStarLockStatus(); ShowTipView().showSureAlertDialog( - "${"锁更新时间:".tr}${DateTool().dateToYMDHNString(state.keyInfos.value.electricQuantityDate!.toString())}"); + "${"锁电量更新时间:".tr}${DateTool().dateToYMDHNString(state.keyInfos.value.electricQuantityDate!.toString())}"); }, child: Row( mainAxisAlignment: MainAxisAlignment.end, @@ -923,8 +923,7 @@ class _LockDetailPageState extends State TranslationLoader.lanKeys!.electronicKey!.tr, state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { - Get.toNamed(Routers.electronicKeyListPage, - arguments: {"keyInfo": state.keyInfos.value}); + Get.toNamed(Routers.electronicKeyListPage); })); // 密码 diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart index f793b9e5..e49c3053 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart @@ -57,6 +57,7 @@ class UploadElectricQuantityLogic extends BaseGetXController { IoSenderManage.senderGetStarLockStatuInfo( lockID: BlueManage().connectDeviceName, userID: await Storage.getUid(), + isBeforeAddUser: false, privateKey: getPrivateKeyList, ); } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { @@ -112,6 +113,7 @@ class UploadElectricQuantityLogic extends BaseGetXController { IoSenderManage.senderGetStarLockStatuInfo( lockID: BlueManage().connectDeviceName, userID: await Storage.getUid(), + isBeforeAddUser: false, privateKey: getPrivateKeyList, ); break; diff --git a/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart b/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart index bebe6310..3ec43f89 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart @@ -66,6 +66,7 @@ class LockTimeLogic extends BaseGetXController{ IoSenderManage.senderGetStarLockStatuInfo( lockID: BlueManage().connectDeviceName, userID: await Storage.getUid(), + isBeforeAddUser: false, privateKey: getPrivateKeyList, ); break; @@ -157,6 +158,7 @@ class LockTimeLogic extends BaseGetXController{ IoSenderManage.senderGetStarLockStatuInfo( lockID: BlueManage().connectDeviceName, userID: await Storage.getUid(), + isBeforeAddUser: false, privateKey: getPrivateKeyList, ); } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart index fd1a2ada..53253748 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart @@ -14,7 +14,6 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart'; import 'package:star_lock/tools/storage.dart'; import '../../../../appRouters.dart'; -import '../../../../blue/blue_manage.dart'; import '../../../../blue/io_modelVendor.dart'; import '../../../../tools/CustomUnderlineTabIndicator.dart'; import '../../../../tools/NativeInteractionTool.dart'; diff --git a/star_lock/lib/mine/about/about_page.dart b/star_lock/lib/mine/about/about_page.dart index ece9be41..e1d29e9b 100644 --- a/star_lock/lib/mine/about/about_page.dart +++ b/star_lock/lib/mine/about/about_page.dart @@ -55,8 +55,12 @@ class _AboutPageState extends State { children: [ SizedBox(height: 150.h), Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - Image.asset("images/icon_main_1024.png", - width: 160.w, height: 160.w), + Image.asset( + F.sw( + defaultCall: () => "images/icon_main_1024.png", + xhjCall: () => "images/icon_main_xhj_1024.png"), + width: 160.w, + height: 160.w), ]), SizedBox(height: 20.h), Text( @@ -95,11 +99,10 @@ class _AboutPageState extends State { isHaveLine: false, isHaveDirection: true, action: () { - Get.toNamed(Routers.webviewShowPage, - arguments: { - "url": XSConstantMacro.userAgreementURL, - "title": '用户协议'.tr - }); + Get.toNamed(Routers.webviewShowPage, arguments: { + "url": XSConstantMacro.userAgreementURL, + "title": '用户协议'.tr + }); }), Divider( height: 1, diff --git a/star_lock/lib/mine/about/webviewShow_page.dart b/star_lock/lib/mine/about/webviewShow_page.dart index 811c316b..ddc8c21f 100644 --- a/star_lock/lib/mine/about/webviewShow_page.dart +++ b/star_lock/lib/mine/about/webviewShow_page.dart @@ -1,6 +1,8 @@ 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/about/webviewShow_logic.dart'; import 'package:star_lock/tools/titleAppBar.dart'; import 'package:webview_flutter/webview_flutter.dart'; @@ -24,6 +26,10 @@ class _WebviewShowPageState extends State { @override Widget build(BuildContext context) { state.webViewController.loadRequest(Uri.parse(state.webURL)); + return F.sw(defaultCall: () => defaultView(), xhjCall: () => xhjView()); + } + + Widget defaultView() { return Scaffold( resizeToAvoidBottomInset: false, backgroundColor: const Color(0xFFFFFFFF), @@ -35,6 +41,21 @@ class _WebviewShowPageState extends State { body: WebViewWidget(controller: state.webViewController)); } + Widget xhjView() { + return SafeArea( + child: Stack( + children: [ + WebViewWidget(controller: state.webViewController), + IconButton( + onPressed: () { + Get.back(); + }, + icon: Icon(Icons.arrow_back_ios)), + ], + ), + ); + } + String getWebTitle() { String webTitleStr = state.webTitle; state.webViewController.getTitle().then((result) { diff --git a/star_lock/lib/starLockApplication/starLockApplication.dart b/star_lock/lib/starLockApplication/starLockApplication.dart index 1d32a39f..417e00f7 100644 --- a/star_lock/lib/starLockApplication/starLockApplication.dart +++ b/star_lock/lib/starLockApplication/starLockApplication.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/flavors.dart'; import 'package:star_lock/login/login/starLock_login_page.dart'; +import 'package:star_lock/login/login/starLock_login_xhj_page.dart'; import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart'; import 'package:star_lock/tools/appFirstEnterHandle.dart'; import 'package:star_lock/debug/debug_tool.dart'; @@ -44,15 +45,19 @@ class _StarLockApplicationState extends State { if (snapshot.data!) { // 如果用户已登录,返回主页面 return F.sw( - defaultCall: () => StarLockMainPage(), + defaultCall: () => StarLockMainPage(), xhjCall: () => const StarLockMainXHJPage()); } else { // 如果用户未登录,返回登录页面 - return const StarLockLoginPage(); + return F.sw( + defaultCall: () => const StarLockLoginPage(), + xhjCall: () => const StarLockLoginXHJPage()); } } else { // 如果没有数据,返回一个空白的小部件 - return const StarLockLoginPage(); + return F.sw( + defaultCall: () => const StarLockLoginPage(), + xhjCall: () => const StarLockLoginXHJPage()); } }, ); diff --git a/star_lock/lib/tools/tf_loginInput.dart b/star_lock/lib/tools/tf_loginInput.dart index 34a08940..5cb0056d 100644 --- a/star_lock/lib/tools/tf_loginInput.dart +++ b/star_lock/lib/tools/tf_loginInput.dart @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:star_lock/app_settings/app_colors.dart'; /* * 登录注册页面 input @@ -41,15 +42,13 @@ class LoginInput extends StatelessWidget { this.isHaveLeftWidget = true, this.leftWidget, this.onchangeAction, - this.onTapAction}) + this.onTapAction, + }) : super(key: key); @override Widget build(BuildContext context) { return Container( - // color: Colors.red, - // width: 1.sp, - // height: 200.h, child: Column( children: [ TextField( @@ -66,7 +65,7 @@ class LoginInput extends StatelessWidget { contentPadding: const EdgeInsets.only( top: 8.0, left: -19.0, right: -15.0, bottom: 8.0), labelText: label, - labelStyle: TextStyle(fontSize: 22.sp), + labelStyle: TextStyle(fontSize: 22.sp,color: AppColors.darkGrayTextColor), hintStyle: TextStyle(fontSize: 22.sp), hintText: hintText, //不需要输入框下划线 diff --git a/star_lock/pubspec.yaml b/star_lock/pubspec.yaml index 31a9e45f..973a4b7b 100644 --- a/star_lock/pubspec.yaml +++ b/star_lock/pubspec.yaml @@ -35,8 +35,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 1.0.27+2024041702 打包鑫锁提审华为 # 1.0.27+2024041703 打包鑫锁提审ios # 1.0.27+2024042204 打包鑫锁提审ios与 android +# 1.0.28+2024042601 打包鑫锁提审华为 -version: 1.0.27+2024042204 +version: 1.0.28+2024042601 environment: sdk: '>=2.12.0 <3.0.0'