1、指纹卡密码人脸列表等搜索的时候,底部按钮不随着键盘弹起而弹起。2、我的里面App开锁时需手机连网的锁问题

This commit is contained in:
魏少阳 2024-06-05 18:40:35 +08:00
parent c53a60a95a
commit a0f819285c
12 changed files with 79 additions and 53 deletions

View File

@ -52,6 +52,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
resizeToAvoidBottomInset: false,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr, barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
haveBack: true, haveBack: true,

View File

@ -54,6 +54,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
resizeToAvoidBottomInset: false,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.card!.tr, barTitle: TranslationLoader.lanKeys!.card!.tr,
haveBack: true, haveBack: true,

View File

@ -51,6 +51,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
resizeToAvoidBottomInset: false,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.electronicKey!.tr, barTitle: TranslationLoader.lanKeys!.electronicKey!.tr,
haveBack: true, haveBack: true,

View File

@ -51,6 +51,7 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
resizeToAvoidBottomInset: false,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.face!.tr, barTitle: TranslationLoader.lanKeys!.face!.tr,
haveBack: true, haveBack: true,

View File

@ -55,6 +55,7 @@ class _FingerprintListPageState extends State<FingerprintListPage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
resizeToAvoidBottomInset: false,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.fingerprint!.tr, barTitle: TranslationLoader.lanKeys!.fingerprint!.tr,
haveBack: true, haveBack: true,

View File

@ -4,21 +4,21 @@ import 'package:get/get.dart';
import 'fingerprintListData_entity.dart'; import 'fingerprintListData_entity.dart';
class FingerprintListState{ class FingerprintListState{ // ,
final lockId = 0.obs;
//
var isDeletAll = false;
var deletKeyID = "0";
var deletFingerNo = 0;
final fingerprintItemListData = <FingerprintItemData>[].obs;
final TextEditingController searchController = TextEditingController();
var ifCurrentScreen = true.obs; // ,
FingerprintListState() { FingerprintListState() {
Map map = Get.arguments; Map map = Get.arguments;
lockId.value = map["lockId"]; lockId.value = map['lockId'];
} }
final RxInt lockId = 0.obs;
//
bool isDeletAll = false;
String deletKeyID = '0';
int deletFingerNo = 0;
final RxList<FingerprintItemData> fingerprintItemListData = <FingerprintItemData>[].obs;
final TextEditingController searchController = TextEditingController();
RxBool ifCurrentScreen = true.obs;
} }

View File

@ -52,6 +52,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
resizeToAvoidBottomInset: false,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.password!.tr, barTitle: TranslationLoader.lanKeys!.password!.tr,
haveBack: true, haveBack: true,

View File

@ -8,50 +8,41 @@ class AppUnlockNeedMobileNetworkingLockLogic extends BaseGetXController{
final AppUnlockNeedMobileNetworkingLockState state = AppUnlockNeedMobileNetworkingLockState(); final AppUnlockNeedMobileNetworkingLockState state = AppUnlockNeedMobileNetworkingLockState();
// //
Future<List<LockItemData>> mockNetworkDataRequest() async { Future<SelectLockListEntity> mockNetworkDataRequest() async {
SelectLockListEntity entity = await ApiRepository.to.selectLockList(); final SelectLockListEntity entity = await ApiRepository.to.selectLockList(searchStr: state.searchController.text);
List<LockItemData> dataList = []; List<LockItemData> dataList = <LockItemData>[];
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
dataList = entity.data!.list!; dataList = entity.data!.list!;
state.lockItemList.value = dataList; state.lockItemList.value = dataList;
for (int i = 0; i < dataList.length; i++) { for (int i = 0; i < dataList.length; i++) {
var itemData = dataList[i]; final LockItemData itemData = dataList[i];
if (itemData.appUnlockOnline == 1) { if (itemData.appUnlockOnline == 1) {
state.selectLockIdList.add(itemData.lockId); state.selectLockIdList.add(itemData.lockId);
} }
} }
} }
return dataList; return entity;
} }
//APP开锁时需手机联网的锁 //APP开锁时需手机联网的锁
Future<void> setAppUnlockMustOnlineRequest() async { Future<void> setAppUnlockMustOnlineRequest() async {
SelectLockListEntity entity = final SelectLockListEntity entity =
await ApiRepository.to.setAppUnlockMustOnline(state.selectLockIdList); await ApiRepository.to.setAppUnlockMustOnline(state.selectLockIdList);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("操作成功"); showToast('操作成功');
} }
} }
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
mockNetworkDataRequest(); // mockNetworkDataRequest();
} }
@override @override
void onInit() { void onInit() {
// TODO: implement onInit
super.onInit(); super.onInit();
} }
@override
void onClose() {
// TODO: implement onClose
}
} }

View File

@ -1,11 +1,14 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.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';
import 'package:star_lock/mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_state.dart';
import 'package:star_lock/mine/mineSet/appUnlockNeedMobileNetworkingLock/selectLockListEntity.dart'; import 'package:star_lock/mine/mineSet/appUnlockNeedMobileNetworkingLock/selectLockListEntity.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
import '../../../tools/commonItem.dart'; import '../../../tools/commonItem.dart';
import '../../../tools/keySearchWidget.dart';
import '../../../tools/noData.dart'; import '../../../tools/noData.dart';
import '../../../tools/storage.dart';
import '../../../tools/submitBtn.dart'; import '../../../tools/submitBtn.dart';
import '../../../tools/titleAppBar.dart'; import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart'; import '../../../translations/trans_lib.dart';
@ -20,19 +23,30 @@ class APPUnlockNeedMobileNetworkingLockPage extends StatefulWidget {
} }
class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMobileNetworkingLockPage> { class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMobileNetworkingLockPage> {
final logic = Get.put(AppUnlockNeedMobileNetworkingLockLogic()); final AppUnlockNeedMobileNetworkingLockLogic logic = Get.put(AppUnlockNeedMobileNetworkingLockLogic());
final state = Get.find<AppUnlockNeedMobileNetworkingLockLogic>().state; final AppUnlockNeedMobileNetworkingLockState state = Get.find<AppUnlockNeedMobileNetworkingLockLogic>().state;
Future<void> getHttpData() async {
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
logic.mockNetworkDataRequest().then((SelectLockListEntity value) {
setState(() {});
});
}
}
@override @override
void initState() { void initState() {
super.initState(); super.initState();
getHttpData();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
resizeToAvoidBottomInset: false,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: TranslationLoader barTitle: TranslationLoader
.lanKeys!.appUnlockRequiresMobilePhoneAccessToTheLock!.tr, .lanKeys!.appUnlockRequiresMobilePhoneAccessToTheLock!.tr,
@ -48,12 +62,19 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
// ], // ],
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Obx(() => state.lockItemList.value.isEmpty ? NoData() :Column( body: Obx(() => state.lockItemList.value.isEmpty ? NoData() :Column(
children: [ children: <Widget>[
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
state.lockItemList.value = [];
logic.mockNetworkDataRequest();
},
),
Container( Container(
padding: EdgeInsets.all(30.w), padding: EdgeInsets.all(15.w),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: <Widget>[
Expanded( Expanded(
child: Text( child: Text(
TranslationLoader.lanKeys! TranslationLoader.lanKeys!
@ -65,14 +86,14 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
), ),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.checkAll!.tr, leftTitel: TranslationLoader.lanKeys!.checkAll!.tr,
rightTitle: "", rightTitle: '',
allHeight: 70.h, allHeight: 70.h,
isHaveLine: false, isHaveLine: false,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: GestureDetector( rightWidget: GestureDetector(
onTap: () { onTap: () {
state.isCheckAll.value = !state.isCheckAll.value; state.isCheckAll.value = !state.isCheckAll.value;
for(LockItemData lockItemData in state.lockItemList.value){ for(final LockItemData lockItemData in state.lockItemList.value){
if(state.isCheckAll.value == true){ if(state.isCheckAll.value == true){
lockItemData.appUnlockOnline = 1; lockItemData.appUnlockOnline = 1;
state.selectLockIdList.add(lockItemData.lockId); state.selectLockIdList.add(lockItemData.lockId);
@ -84,7 +105,7 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
setState(() {}); setState(() {});
}, },
child: Obx(() => Row( child: Obx(() => Row(
children: [ children: <Widget>[
Image.asset( Image.asset(
state.isCheckAll.value ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', state.isCheckAll.value ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png',
width: 30.w, width: 30.w,
@ -97,8 +118,8 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
Expanded( Expanded(
child: ListView.builder( child: ListView.builder(
itemCount: state.lockItemList.value.length, itemCount: state.lockItemList.value.length,
itemBuilder: (c, index) { itemBuilder: (BuildContext c, int index) {
LockItemData itemData = state.lockItemList.value[index]; final LockItemData itemData = state.lockItemList.value[index];
// if(state.isCheckAll.value == true){ // if(state.isCheckAll.value == true){
// itemData.isCheck = true; // itemData.isCheck = true;
// }else{ // }else{
@ -113,7 +134,7 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
if (state.selectLockIdList.isNotEmpty) { if (state.selectLockIdList.isNotEmpty) {
logic.setAppUnlockMustOnlineRequest(); logic.setAppUnlockMustOnlineRequest();
} else { } else {
logic.showToast("请选择需设置的锁"); logic.showToast('请选择需设置的锁');
} }
}), }),
SizedBox( SizedBox(
@ -152,7 +173,7 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
borderRadius: BorderRadius.circular(10.w), borderRadius: BorderRadius.circular(10.w),
), ),
child: Row( child: Row(
children: [ children: <Widget>[
SizedBox( SizedBox(
width: 15.w, width: 15.w,
), ),
@ -166,10 +187,14 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
SizedBox( SizedBox(
width: 10.w, width: 10.w,
), ),
Text( Expanded(child: Text(
itemData.lockAlias ?? "", itemData.lockAlias ?? '',
style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w600), style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w600),
) )),
// Text(
// itemData.lockAlias ?? '',
// style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w600),
// )
], ],
), ),
), ),

View File

@ -1,11 +1,13 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'selectLockListEntity.dart'; import 'selectLockListEntity.dart';
class AppUnlockNeedMobileNetworkingLockState { class AppUnlockNeedMobileNetworkingLockState {
var lockItemList = <LockItemData>[].obs; RxList<LockItemData> lockItemList = <LockItemData>[].obs;
var selectLockIdList = []; List selectLockIdList = [];
var isCheckAll = false.obs; RxBool isCheckAll = false.obs;
final TextEditingController searchController = TextEditingController();
} }

View File

@ -595,8 +595,10 @@ class ApiProvider extends BaseProvider {
'lockIds': lockIds, 'lockIds': lockIds,
})); }));
Future<Response> selectLockList() => Future<Response> selectLockList(String searchStr) =>
post(selectLockListURL.toUrl, jsonEncode({})); post(selectLockListURL.toUrl, jsonEncode({
'searchStr': searchStr,
}));
//APP开锁时需手机联网的锁 //APP开锁时需手机联网的锁
Future<Response> setAppUnlockMustOnline(List lockIdList) => post( Future<Response> setAppUnlockMustOnline(List lockIdList) => post(

View File

@ -618,8 +618,8 @@ class ApiRepository {
} }
// //
Future<SelectLockListEntity> selectLockList() async { Future<SelectLockListEntity> selectLockList({String? searchStr}) async {
final res = await apiProvider.selectLockList(); final res = await apiProvider.selectLockList(searchStr ?? '');
return SelectLockListEntity.fromJson(res.body); return SelectLockListEntity.fromJson(res.body);
} }