锁详情页面新增配件区配置(未完善)

This commit is contained in:
Daisy 2024-01-30 11:18:27 +08:00
parent 1a5823964e
commit ca20145ca3
3 changed files with 141 additions and 131 deletions

View File

@ -80,6 +80,10 @@ class _LockDetailPageState extends State<LockDetailPage>
// logic.startScanAction(); // logic.startScanAction();
listeningAnimations(); listeningAnimations();
state.pageController.addListener(() {
state.currentPage.value = state.pageController.page!.round();
});
} }
@override @override
@ -94,21 +98,24 @@ class _LockDetailPageState extends State<LockDetailPage>
child: Column( child: Column(
children: [ children: [
topWidget(), topWidget(),
Expanded(child: Obx(() => bottomWidget())), SizedBox(
height: 10.h,
// SingleChildScrollView( ),
// scrollDirection: Axis.horizontal, Obx(() => buildPageIndicator()),
// child: Row( Expanded(
// children: [ child: Container(
// bottomWidget(), margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 30.h),
// Container( child: PageView(
// width: 1.sw, scrollDirection: Axis.horizontal,
// height: 200, controller: state.pageController,
// color: Colors.white, // child: Row(
// ) children: [
// ], Obx(() => bottomWidget()),
// ), Obx(() => attachmentWidget()),
// ), ],
// ),
),
))
], ],
), ),
), ),
@ -322,10 +329,66 @@ class _LockDetailPageState extends State<LockDetailPage>
); );
} }
//
Widget buildPageIndicator() {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(2, (index) {
return Container(
width: 10.0.w,
height: 10.0.w,
margin: EdgeInsets.symmetric(vertical: 10.0.w, horizontal: 6.0.w),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: state.currentPage.value == index
? AppColors.mainColor
: Colors.grey,
),
);
}),
);
}
//
Widget attachmentWidget() {
return SizedBox(
width: ScreenUtil().screenWidth - 20.w,
child: GridView.count(
crossAxisCount: 4,
// childAspectRatio: 3,
crossAxisSpacing: 20.w,
mainAxisSpacing: 0.h,
physics: const NeverScrollableScrollPhysics(),
children: getAttachmentWidget()),
);
}
//
List<Widget> getAttachmentWidget() {
var showWidgetArr = <Widget>[];
// 线
if (state.isAttendance.value == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png',
'无线键盘', state.bottomBtnisUneable.value, () {}));
}
//
showWidgetArr.add(bottomItem('images/main/icon_main_operatingRecord.png',
'照明', state.bottomBtnisUneable.value, () {}));
//
showWidgetArr.add(bottomItem('images/main/icon_main_operatingRecord.png',
'开门器', state.bottomBtnisUneable.value, () {}));
//
showWidgetArr.add(bottomItem('images/main/icon_main_set.png', '新增配件',
state.bottomBtnisUneable.value, () {}));
return showWidgetArr;
}
Widget bottomWidget() { Widget bottomWidget() {
return Container( return SizedBox(
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 40.h), width: ScreenUtil().screenWidth - 20.w,
// color: Colors.blue,
child: GridView.count( child: GridView.count(
crossAxisCount: 4, crossAxisCount: 4,
// childAspectRatio: 3, // childAspectRatio: 3,
@ -336,74 +399,6 @@ class _LockDetailPageState extends State<LockDetailPage>
); );
} }
//
Widget partSectionWidget() {
return SliverToBoxAdapter(
child: SizedBox(
height: 400.0, // Adjust the height as needed
width: ScreenUtil().screenWidth,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
Container(
margin: EdgeInsets.all(10.0),
color: Colors.red,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('GridView 1'),
SizedBox(height: 10.0),
Container(
height: 200.0,
width: 200.0,
child: GridView.count(
crossAxisCount: 2,
children: List.generate(6, (index) {
return Center(
child: Text(
'Item ${index + 6}',
style: TextStyle(fontSize: 20.0),
),
);
}),
),
),
],
),
),
Container(
margin: EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('GridView 2'),
SizedBox(height: 10.0),
Container(
height: 200.0,
width: 200.0,
child: GridView.count(
crossAxisCount: 2,
children: List.generate(6, (index) {
return Center(
child: Text(
'Item ${index + 6}',
style: TextStyle(fontSize: 20.0),
),
);
}),
),
),
],
),
),
],
),
),
),
);
}
// //
List<Widget> getBottomWidget() { List<Widget> getBottomWidget() {
if (state.keyInfos.value.isLockOwner == 1 || if (state.keyInfos.value.isLockOwner == 1 ||

View File

@ -1,4 +1,3 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -23,13 +22,13 @@ class LockDetailState {
var senderUserId = 0; var senderUserId = 0;
var isOnlyOneData = false; var isOnlyOneData = false;
var isAttendance = 0.obs;// var isAttendance = 0.obs; //
var isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网 var isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
var electricQuantity = 0.obs; // var electricQuantity = 0.obs; //
var isOpenPassageMode = 0.obs; // var isOpenPassageMode = 0.obs; //
var lockAlias = "".obs; // var lockAlias = "".obs; //
var currentDeviceUUid = "".obs;// uuid var currentDeviceUUid = "".obs; // uuid
var ifCurrentScreen = true.obs; // , var ifCurrentScreen = true.obs; // ,
var iSClosedUnlockSuccessfulPopup = false.obs; // var iSClosedUnlockSuccessfulPopup = false.obs; //
@ -41,9 +40,12 @@ class LockDetailState {
// //
late AnimationController animationController; late AnimationController animationController;
// var lockState = 0.obs;// 0 1() 2 3 4 5 // var lockState = 0.obs;// 0 1() 2 3 4 5
var openLockBtnState = 0.obs;// 0() 1() var openLockBtnState = 0.obs; // 0() 1()
// var connectState = 0.obs;// 0 1 // var connectState = 0.obs;// 0 1
final PageController pageController = PageController();
var currentPage = 0.obs;
// LockDetailState() { // LockDetailState() {
// Map map = Get.arguments; // Map map = Get.arguments;
// lockCount = map["lockCount"]; // lockCount = map["lockCount"];

View File

@ -30,7 +30,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
final state = Get.find<LockSetLogic>().state; final state = Get.find<LockSetLogic>().state;
Future<void> getHttpData() async { Future<void> getHttpData() async {
logic.getLockSettingInfoData().then((LockSetInfoEntity value){ logic.getLockSettingInfoData().then((LockSetInfoEntity value) {
setState(() {}); setState(() {});
}); });
} }
@ -56,7 +56,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: EasyRefreshTool( body: EasyRefreshTool(
onRefresh: (){ onRefresh: () {
getHttpData(); getHttpData();
}, },
child: Column( child: Column(
@ -191,41 +191,42 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
Get.toNamed(Routers.doorMagneticPage); Get.toNamed(Routers.doorMagneticPage);
// Toast.show(msg: "功能暂未开放"); // Toast.show(msg: "功能暂未开放");
}))), }))),
// 线 //by DaisyWu
Obx(() => Visibility( // // 线
visible: state.lockFeature.value.wirelessKeyboard == 1 ? true : false, // Obx(() => Visibility(
child: CommonItem( // visible: state.lockFeature.value.wirelessKeyboard == 1 ? true : false,
leftTitel: TranslationLoader.lanKeys!.wirelessKeyboard!.tr, // child: CommonItem(
rightTitle: "", // leftTitel: TranslationLoader.lanKeys!.wirelessKeyboard!.tr,
isHaveLine: true, // rightTitle: "",
isHaveDirection: true, // isHaveLine: true,
action: () { // isHaveDirection: true,
Get.toNamed(Routers.wirelessKeyboardPage); // action: () {
// Toast.show(msg: "功能暂未开放"); // Get.toNamed(Routers.wirelessKeyboardPage);
}))), // // Toast.show(msg: "功能暂未开放");
// // }))),
Obx(() => Visibility( // //
visible: state.lockFeature.value.lightingTime == 1 ? true : false, // Obx(() => Visibility(
child: CommonItem( // visible: state.lockFeature.value.lightingTime == 1 ? true : false,
leftTitel: TranslationLoader.lanKeys!.illumination!.tr, // child: CommonItem(
rightTitle: "", // leftTitel: TranslationLoader.lanKeys!.illumination!.tr,
isHaveLine: true, // rightTitle: "",
isHaveDirection: true, // isHaveLine: true,
action: () { // isHaveDirection: true,
logic.showToast("功能暂未开放"); // action: () {
}))), // logic.showToast("功能暂未开放");
// }))),
// //
Visibility( // Visibility(
visible: state.lockFeature.value.doorStatus == 1 ? true : false, // visible: state.lockFeature.value.doorStatus == 1 ? true : false,
child: CommonItem( // child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.doorOpener!.tr, // leftTitel: TranslationLoader.lanKeys!.doorOpener!.tr,
rightTitle: "", // rightTitle: "",
isHaveLine: false, // isHaveLine: false,
isHaveDirection: true, // isHaveDirection: true,
action: () { // action: () {
logic.showToast("功能暂未开放"); // logic.showToast("功能暂未开放");
})), // })),
SizedBox(height: 10.h), // SizedBox(height: 10.h),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: state.lockFeature.value.autoLock == 1 ? true : false, visible: state.lockFeature.value.autoLock == 1 ? true : false,
@ -330,7 +331,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
}))), }))),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: (state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.resetSwitch == 1) ? true : false, visible: (state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.resetSwitch == 1)
? true
: false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetButton!.tr, leftTitel: TranslationLoader.lanKeys!.resetButton!.tr,
rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) == 1 rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) == 1
@ -470,7 +474,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// //
Obx( Obx(
() => Visibility( () => Visibility(
visible: (state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.attendance == 1) ? true : false, visible: (state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.attendance == 1)
? true
: false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr, leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
rightTitle: "", rightTitle: "",
@ -481,7 +488,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// //
Obx( Obx(
() => Visibility( () => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.unlockReminder == 1 ? true : false, visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.unlockReminder == 1
? true
: false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr, leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: "", rightTitle: "",
@ -492,7 +502,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// APP开锁时是否需联网 // APP开锁时是否需联网
Obx( Obx(
() => Visibility( () => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.appUnlockOnline == 1 ? true : false, visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.appUnlockOnline == 1
? true
: false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader leftTitel: TranslationLoader
.lanKeys!.whetherInternetRequiredWhenUnlocking!.tr, .lanKeys!.whetherInternetRequiredWhenUnlocking!.tr,