fix:修复 无网络状态可以点击设备删除,卡/密码/指纹等清除操作

This commit is contained in:
anfe 2024-06-24 17:38:34 +08:00
parent 103570a97b
commit 3de600acda
14 changed files with 318 additions and 240 deletions

View File

@ -7,6 +7,7 @@ import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_logic.dart';
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_state.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import '../../appRouters.dart';
import '../../app_settings/app_colors.dart';
@ -23,9 +24,12 @@ class StarLockForgetPasswordPage extends StatefulWidget {
_StarLockForgetPasswordPageState();
}
class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage> {
final StarLockForgetPasswordLogic logic = Get.put(StarLockForgetPasswordLogic());
final StarLockForgetPasswordState state = Get.find<StarLockForgetPasswordLogic>().state;
class _StarLockForgetPasswordPageState
extends State<StarLockForgetPasswordPage> {
final StarLockForgetPasswordLogic logic =
Get.put(StarLockForgetPasswordLogic());
final StarLockForgetPasswordState state =
Get.find<StarLockForgetPasswordLogic>().state;
@override
Widget build(BuildContext context) {
@ -57,7 +61,8 @@ class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage>
children: <Widget>[
SizedBox(width: 5.w),
Expanded(
child: Text(TranslationLoader.lanKeys!.countryAndRegion!.tr,
child: Text(
TranslationLoader.lanKeys!.countryAndRegion!.tr,
style: TextStyle(
fontSize: 26.sp, color: AppColors.blackColor))),
SizedBox(width: 20.w),
@ -65,14 +70,14 @@ class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage>
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Obx(() => Text(
'${state.countryName} +${state.countryCode}',
// state.isIphoneType.value
// ? '${state.countryName} +${state.countryCode}'
// : "${state.countryName}",
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 26.sp, color: AppColors.blackColor),
))
'${state.countryName} +${state.countryCode}',
// state.isIphoneType.value
// ? '${state.countryName} +${state.countryCode}'
// : "${state.countryName}",
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 26.sp, color: AppColors.blackColor),
))
],
),
SizedBox(width: 5.w),
@ -95,14 +100,16 @@ class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage>
logic.checkNext(state.phoneController);
},
leftWidget: Padding(
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, right: 5.w, left: 5.w),
padding: EdgeInsets.only(
top: 30.w, bottom: 20.w, right: 5.w, left: 5.w),
child: Image.asset(
'images/icon_login_account.png',
width: 36.w,
height: 36.w,
),
),
hintText:TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
hintText:
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(30),
@ -232,6 +239,11 @@ class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage>
isDisabled: state.canSub.value,
onClick: state.canSub.value
? () {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
logic.resetPassword();
}
: null);

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -7,6 +6,7 @@ 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/login/forgetPassword/starLock_forgetPassword_state.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import 'package:star_lock/tools/submitBtn.dart';
import 'package:star_lock/tools/tf_loginInput.dart';
import 'package:star_lock/tools/titleAppBar.dart';
@ -22,8 +22,10 @@ class StarLockForgetPasswordXHJPage extends StatefulWidget {
class _StarLockForgetPasswordPageState
extends State<StarLockForgetPasswordXHJPage> {
final StarLockForgetPasswordLogic logic = Get.put(StarLockForgetPasswordLogic());
final StarLockForgetPasswordState state = Get.find<StarLockForgetPasswordLogic>().state;
final StarLockForgetPasswordLogic logic =
Get.put(StarLockForgetPasswordLogic());
final StarLockForgetPasswordState state =
Get.find<StarLockForgetPasswordLogic>().state;
@override
Widget build(BuildContext context) {
@ -102,7 +104,7 @@ class _StarLockForgetPasswordPageState
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, left: 5.w),
),
label:
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}',
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}',
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
@ -122,7 +124,7 @@ class _StarLockForgetPasswordPageState
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, left: 5.w),
),
label:
'${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}',
'${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}',
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
@ -136,7 +138,7 @@ class _StarLockForgetPasswordPageState
},
leftWidget: SizedBox(),
hintText:
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}',
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}',
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
@ -179,14 +181,21 @@ class _StarLockForgetPasswordPageState
Obx(() {
return SubmitBtn(
btnName:
'${TranslationLoader.lanKeys!.reset!.tr}${TranslationLoader.lanKeys!.password!.tr}',
'${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
? () {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
logic.resetPassword();
}
: null);
}),
],

View File

@ -33,10 +33,12 @@ FutureOr<void> main() async {
final bool isLogin = await getLoginStatus();
if (isLogin) {
await privacySDKInitialization();
Future<void>.delayed(const Duration(milliseconds: 500), () async{
Future<void>.delayed(const Duration(milliseconds: 500), () async {
final GetAppInfo entity = await ApiRepository.to.getAppInfo();
CustomerTool.init(entity.data?.wechatServiceUrl ?? '');
WxPayTool.setAssociationUrl(entity.data!.appSiteUrl!);
if (entity.data?.appSiteUrl != null) {
WxPayTool.setAssociationUrl(entity.data!.appSiteUrl!);
}
});
}

View File

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/card/cardList/cardList_state.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -68,6 +69,11 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
onPressed: () async {
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
ShowTipView().showIosTipWithContentDialog(
'重置后,该锁的卡都将被删除哦,确认要重置吗?'.tr, () async {
state.isDeletAll = true;

View File

@ -6,6 +6,7 @@ import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import 'package:star_lock/tools/noData.dart';
import 'package:star_lock/tools/storage.dart';
@ -67,6 +68,11 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
ShowTipView().showIosTipWithContentDialog(
'该锁的电子钥匙都将被删除'.tr, logic.resetElectronicKeyListRequest);
} else {

View File

@ -3,6 +3,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import 'package:star_lock/tools/keySearchWidget.dart';
import 'package:star_lock/tools/left_slide/left_slide_actions.dart';
import 'package:star_lock/tools/showTipView.dart';
@ -63,6 +64,11 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
// showDeletAlertDialog(context);
ShowTipView().showIosTipWithContentDialog(
"重置后,该锁的人脸都将被删除哦,确认要重置吗?", () async {

View File

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintList_state.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -69,6 +70,11 @@ class _FingerprintListPageState extends State<FingerprintListPage>
onPressed: () async {
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
ShowTipView().showIosTipWithContentDialog(
'重置后,该锁的指纹都将被删除哦,确认要重置吗?'.tr, () async {
state.isDeletAll = true;

View File

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
import 'package:star_lock/main/lockDetail/iris/irisList/irisList_logic.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import 'package:star_lock/tools/keySearchWidget.dart';
import 'package:star_lock/tools/left_slide/left_slide_actions.dart';
@ -44,6 +45,11 @@ class _IrisListPageState extends State<IrisListPage> {
onPressed: () async {
final isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
showDeletAlertDialog(context);
} else {
// Get.toNamed(Routers.selectLockTypePage);

View File

@ -5,6 +5,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/checkingInInfoData_entity.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSet_state.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -28,9 +29,7 @@ class LockSetPage extends StatefulWidget {
class _LockSetPageState extends State<LockSetPage> with RouteAware {
final LockSetLogic logic = Get.put(LockSetLogic());
final LockSetState state = Get
.find<LockSetLogic>()
.state;
final LockSetState state = Get.find<LockSetLogic>().state;
Future<void> getHttpData() async {
logic.getLockSettingInfoData().then((LockSetInfoEntity value) {
@ -65,8 +64,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
child: Column(
children: <Widget>[
Expanded(
child: Obx(() =>
ListView(
child: Obx(() => ListView(
children: getListWidget(),
)),
),
@ -104,47 +102,43 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
}),
SizedBox(height: 10.h),
//
Obx(() =>
Visibility(
visible: state.lockFeature.value.autoLock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: (state.lockSettingInfo.value.autoLock ?? 0) > 0
? '${state.lockSetInfoData.value.lockSettingInfo!
.autoLockSecond ?? 0}s'
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
// isHaveRightWidget: true,
// rightWidget: rightText((state.lockSetInfoData.value.lockSetting!.autoLock ?? 0) > 0
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () {
Get.toNamed(Routers.automaticBlockingPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value,
// 'lockBasicInfo': state.lockBasicInfo.value
});
}))),
Obx(() => Visibility(
visible: state.lockFeature.value.autoLock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: (state.lockSettingInfo.value.autoLock ?? 0) > 0
? '${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond ?? 0}s'
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
// isHaveRightWidget: true,
// rightWidget: rightText((state.lockSetInfoData.value.lockSetting!.autoLock ?? 0) > 0
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () {
Get.toNamed(Routers.automaticBlockingPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value,
// 'lockBasicInfo': state.lockBasicInfo.value
});
}))),
//
Obx(() =>
Visibility(
visible: state.lockFeature.value.passageMode == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) ==
1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage,
arguments: <String, Object>{
'lockSetInfoData': state.lockSetInfoData.value,
'lockBasicInfo': state.lockBasicInfo.value
});
}))),
Obx(() => Visibility(
visible: state.lockFeature.value.passageMode == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage,
arguments: <String, Object>{
'lockSetInfoData': state.lockSetInfoData.value,
'lockBasicInfo': state.lockBasicInfo.value
});
}))),
Visibility(
visible: true,
child: CommonItem(
@ -153,10 +147,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(
Routers.lockTimePage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
Get.toNamed(Routers.lockTimePage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
})),
SizedBox(height: 30.h),
Container(
@ -166,10 +160,14 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isDelete: true,
onClick: () {
// logic.deletUserAction();
// logic.deletLockInfoData();
// showDeletAlertDialog(context);
// showDeletPasswordAlertDialog(context);
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
logic.deleyLockLogicOfRoles();
}),
),
@ -242,27 +240,25 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// })),
// SizedBox(height: 10.h),
//
Obx(() =>
Visibility(
visible: state.lockFeature.value.autoLock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: state.lockSettingInfo.value.autoLock! > 0
? '${state.lockSetInfoData.value.lockSettingInfo!
.autoLockSecond}s'
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
// isHaveRightWidget: true,
// rightWidget: rightText((state.lockSetInfoData.value.lockSetting!.autoLock ?? 0) > 0
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () {
Get.toNamed(Routers.automaticBlockingPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() => Visibility(
visible: state.lockFeature.value.autoLock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: state.lockSettingInfo.value.autoLock! > 0
? '${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond}s'
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
// isHaveRightWidget: true,
// rightWidget: rightText((state.lockSetInfoData.value.lockSetting!.autoLock ?? 0) > 0
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () {
Get.toNamed(Routers.automaticBlockingPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
//
Obx(() {
String titleStr = '';
@ -302,80 +298,72 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
}));
}),
//
Obx(() =>
Visibility(
visible: state.lockFeature.value.antiPrySwitch == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.burglarAlarm!.tr,
rightTitle: (state.lockSettingInfo.value.antiPrySwitch ??
0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.burglarAlarmPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() => Visibility(
visible: state.lockFeature.value.antiPrySwitch == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.burglarAlarm!.tr,
rightTitle: (state.lockSettingInfo.value.antiPrySwitch ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.burglarAlarmPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
SizedBox(height: 10.h),
//
Obx(() =>
Visibility(
visible: state.lockFeature.value.passageMode == 1,
// visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) ==
1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() => Visibility(
visible: state.lockFeature.value.passageMode == 1,
// visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
//
Obx(() =>
Visibility(
visible: state.lockFeature.value.remoteUnlock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr,
rightTitle: (state.lockSettingInfo.value.remoteUnlock ?? 0) ==
1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.remoteUnlockingPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() => Visibility(
visible: state.lockFeature.value.remoteUnlock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr,
rightTitle: (state.lockSettingInfo.value.remoteUnlock ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.remoteUnlockingPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
//
Obx(() =>
Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.resetSwitch == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetButton!.tr,
rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) ==
1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.resetButtonPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.resetSwitch == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetButton!.tr,
rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.resetButtonPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
SizedBox(height: 10.h),
//---
// Obx(() =>
@ -409,20 +397,19 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
});
})),
//
Obx(() =>
Visibility(
visible: state.lockFeature.value.isSupportCatEye == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.catEyeSet!.tr,
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.catEyeSetPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() => Visibility(
visible: state.lockFeature.value.isSupportCatEye == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.catEyeSet!.tr,
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.catEyeSetPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
// Obx(() =>
//
// Visibility(
@ -477,7 +464,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// 广使
/* 2024-01-12 广 by DaisyWu
Obx(() => Visibility(
visible: true,
visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.bluetoothBroadcast!.tr,
rightTitle: "",
@ -511,66 +498,62 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// }),
//
Obx(
() =>
Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.attendance == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _openCheckInSwitch())),
() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.attendance == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _openCheckInSwitch())),
),
//
Obx(
() =>
Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.unlockReminder == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _lockRemindSwitch())),
() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.unlockReminder == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _lockRemindSwitch())),
),
// APP开锁时是否需联网
Obx(
() =>
Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.appUnlockOnline == 1,
child: CommonItem(
leftTitel: TranslationLoader
.lanKeys!.whetherInternetRequiredWhenUnlocking!.tr,
rightTitle: '',
isHaveLine: false,
isHaveRightWidget: true,
rightWidget: _openLockNeedOnlineSwitch()),
),
() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.appUnlockOnline == 1,
child: CommonItem(
leftTitel: TranslationLoader
.lanKeys!.whetherInternetRequiredWhenUnlocking!.tr,
rightTitle: '',
isHaveLine: false,
isHaveRightWidget: true,
rightWidget: _openLockNeedOnlineSwitch()),
),
),
SizedBox(height: 10.h),
// wifi配网
Obx(
() =>
Visibility(
visible: state.lockFeature.value.wifi == 1,
child: CommonItem(
leftTitel:
() => Visibility(
visible: state.lockFeature.value.wifi == 1,
child: CommonItem(
leftTitel:
TranslationLoader.lanKeys!.wifiDistributionNetwork!.tr,
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.wifiListPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
// Get.toNamed(Routers.configuringWifiPage, arguments: {
// 'lockSetInfoData': state.lockSetInfoData.value
// });
})),
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.wifiListPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
// Get.toNamed(Routers.configuringWifiPage, arguments: {
// 'lockSetInfoData': state.lockSetInfoData.value
// });
})),
),
// Obx(() =>
//
@ -582,10 +565,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(
Routers.lockTimePage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
Get.toNamed(Routers.lockTimePage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
})),
// ),
// Obx(() =>
@ -676,12 +659,11 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
thumbColor: CupertinoColors.white,
value: state.isAttendance.value == 1,
onChanged: (bool value) {
logic.openCheckingInData((
CheckingInInfoDataEntity checkingInInfoDataEntity) {
logic.openCheckingInData(
(CheckingInInfoDataEntity checkingInInfoDataEntity) {
if (checkingInInfoDataEntity.data!.companyId == 0) {
// logic.showCupertinoAlertDialog(context);
ShowTipView().showIosTipWithContentDialog(
'创建公司后,考勤功能才能使用'.tr, () {
ShowTipView().showIosTipWithContentDialog('创建公司后,考勤功能才能使用'.tr, () {
//
Get.toNamed(Routers.checkInCreatCompanyPage,
arguments: <String, LockSetInfoData>{

View File

@ -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/main/lockMian/lockMain/lockMain_logic.dart';
import 'package:star_lock/tools/noData.dart';
import '../../../../../appRouters.dart';
@ -19,6 +20,7 @@ class WirelessKeyboardPage extends StatefulWidget {
class _WirelessKeyboardPageState extends State<WirelessKeyboardPage> {
List dataList = [];
@override
Widget build(BuildContext context) {
return Scaffold(
@ -34,6 +36,11 @@ class _WirelessKeyboardPageState extends State<WirelessKeyboardPage> {
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
_showDialog(context);
},
),

View File

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
import 'package:star_lock/main/lockDetail/palm/palmList/palmList_logic.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import 'package:star_lock/tools/keySearchWidget.dart';
import 'package:star_lock/tools/left_slide/left_slide_actions.dart';
@ -44,6 +45,11 @@ class _PalmListPageState extends State<PalmListPage> {
onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
showDeletAlertDialog(context);
} else {
// Get.toNamed(Routers.selectLockTypePage);

View File

@ -6,6 +6,7 @@ import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKe
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart';
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import 'package:star_lock/tools/noData.dart';
import 'package:star_lock/tools/storage.dart';
import '../../../../appRouters.dart';
@ -67,6 +68,11 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
if (state.itemDataList.isEmpty) {
logic.showToast('暂无密码,无需重置'.tr);
return;
@ -227,7 +233,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
Row(
children: <Widget>[
SizedBox(
width: passwordKeyListItem.keyboardPwdStatus == 2 || passwordKeyListItem.keyboardPwdStatus == 3
width: passwordKeyListItem.keyboardPwdStatus == 2 ||
passwordKeyListItem.keyboardPwdStatus == 3
? 1.sw - 110.w - 100.w
: 1.sw - 110.w - 50.w,
child: Row(children: <Widget>[
@ -247,7 +254,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
'已过期'.tr,
style: TextStyle(color: Colors.red, fontSize: 20.sp),
)
else if (passwordKeyListItem.keyboardPwdStatus == 3)
else if (passwordKeyListItem.keyboardPwdStatus == 3)
Text(
'未生效'.tr,
style: TextStyle(color: Colors.red, fontSize: 20.sp),

View File

@ -3,6 +3,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/main/lockMian/lockMain/lockMain_logic.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -44,6 +45,11 @@ class _RemoteControlListPageState extends State<RemoteControlListPage> {
onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
showDeletAlertDialog(context);
} else {
// Get.toNamed(Routers.selectLockTypePage);

View File

@ -109,11 +109,20 @@ class LockMainLogic extends BaseGetXController {
result != ConnectivityResult.none) {
//
state.networkConnectionStatus.value = 1;
getStarLockInfo();
getStarLockInfo(isUnShowLoading: true);
}
});
}
///
bool judgeTheNetwork() {
final bool isNetwork = state.networkConnectionStatus.value == 1;
if (!isNetwork) {
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr);
}
return isNetwork;
}
///
Future<void> checkWhetherPushIsEnabled() async {
bool notificationEnabled = false;
@ -261,6 +270,7 @@ class LockMainLogic extends BaseGetXController {
super.onInit();
checkWhetherPushIsEnabled();
_initSubscription();
connectListener();
}
@override
@ -270,4 +280,11 @@ class LockMainLogic extends BaseGetXController {
});
super.onClose();
}
static LockMainLogic? to() {
if (Get.isRegistered<LockMainLogic>()) {
return Get.find<LockMainLogic>();
}
return null;
}
}