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) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
resizeToAvoidBottomInset: false,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
haveBack: true,

View File

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

View File

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

View File

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

View File

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

View File

@ -4,21 +4,21 @@ import 'package:get/get.dart';
import 'fingerprintListData_entity.dart';
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; // ,
class FingerprintListState{ // ,
FingerprintListState() {
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) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
resizeToAvoidBottomInset: false,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.password!.tr,
haveBack: true,

View File

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

View File

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

View File

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

View File

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