修改自动闭锁模块功能问题

This commit is contained in:
魏少阳 2024-07-25 11:36:54 +08:00
parent e22d3fbe99
commit 8401514838
2 changed files with 6 additions and 2 deletions

View File

@ -27,7 +27,7 @@ class AutomaticBlockingLogic extends BaseGetXController {
if (state.isCustomLockTime.value == true) { if (state.isCustomLockTime.value == true) {
autoTime = state.timeController.text; autoTime = state.timeController.text;
if (int.parse(autoTime) > 60) { if (int.parse(autoTime) > 60) {
showToast('请输入小于或等于60的'.tr); showToast('请输入小于或等于60的'.tr);
return; return;
} }
} else { } else {
@ -37,7 +37,7 @@ class AutomaticBlockingLogic extends BaseGetXController {
final LoginEntity entity = await ApiRepository.to.setAutoUnlock( final LoginEntity entity = await ApiRepository.to.setAutoUnlock(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
autoLock: state.isOpen.value == true ? 1 : 0, autoLock: state.isOpen.value == true ? (int.parse(state.autoLockTime.value) > 0 ? 1 : 0) : 0,
autoLockSecond: int.parse(autoTime), autoLockSecond: int.parse(autoTime),
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {

View File

@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -150,6 +151,9 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage>
state.autoLockTime.value = value; state.autoLockTime.value = value;
logic.ifCanNext(); logic.ifCanNext();
}, },
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
],
decoration: InputDecoration( decoration: InputDecoration(
// //
contentPadding: const EdgeInsets.only( contentPadding: const EdgeInsets.only(