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

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();
listeningAnimations();
state.pageController.addListener(() {
state.currentPage.value = state.pageController.page!.round();
});
}
@override
@ -94,21 +98,24 @@ class _LockDetailPageState extends State<LockDetailPage>
child: Column(
children: [
topWidget(),
Expanded(child: Obx(() => bottomWidget())),
// SingleChildScrollView(
// scrollDirection: Axis.horizontal,
SizedBox(
height: 10.h,
),
Obx(() => buildPageIndicator()),
Expanded(
child: Container(
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 30.h),
child: PageView(
scrollDirection: Axis.horizontal,
controller: state.pageController,
// child: Row(
// children: [
// bottomWidget(),
// Container(
// width: 1.sw,
// height: 200,
// color: Colors.white,
// )
// ],
// ),
children: [
Obx(() => bottomWidget()),
Obx(() => attachmentWidget()),
],
// ),
),
))
],
),
),
@ -322,10 +329,66 @@ class _LockDetailPageState extends State<LockDetailPage>
);
}
Widget bottomWidget() {
//
Widget buildPageIndicator() {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(2, (index) {
return Container(
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 40.h),
// color: Colors.blue,
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() {
return SizedBox(
width: ScreenUtil().screenWidth - 20.w,
child: GridView.count(
crossAxisCount: 4,
// 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() {
if (state.keyInfos.value.isLockOwner == 1 ||

View File

@ -1,4 +1,3 @@
import 'dart:async';
import 'package:flutter/material.dart';
@ -44,6 +43,9 @@ class LockDetailState {
var openLockBtnState = 0.obs; // 0() 1()
// var connectState = 0.obs;// 0 1
final PageController pageController = PageController();
var currentPage = 0.obs;
// LockDetailState() {
// Map map = Get.arguments;
// lockCount = map["lockCount"];

View File

@ -191,41 +191,42 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
Get.toNamed(Routers.doorMagneticPage);
// Toast.show(msg: "功能暂未开放");
}))),
// 线
Obx(() => Visibility(
visible: state.lockFeature.value.wirelessKeyboard == 1 ? true : false,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.wirelessKeyboard!.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.wirelessKeyboardPage);
// Toast.show(msg: "功能暂未开放");
}))),
//
Obx(() => Visibility(
visible: state.lockFeature.value.lightingTime == 1 ? true : false,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.illumination!.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
logic.showToast("功能暂未开放");
}))),
//by DaisyWu
// // 线
// Obx(() => Visibility(
// visible: state.lockFeature.value.wirelessKeyboard == 1 ? true : false,
// child: CommonItem(
// leftTitel: TranslationLoader.lanKeys!.wirelessKeyboard!.tr,
// rightTitle: "",
// isHaveLine: true,
// isHaveDirection: true,
// action: () {
// Get.toNamed(Routers.wirelessKeyboardPage);
// // Toast.show(msg: "功能暂未开放");
// }))),
// //
// Obx(() => Visibility(
// visible: state.lockFeature.value.lightingTime == 1 ? true : false,
// child: CommonItem(
// leftTitel: TranslationLoader.lanKeys!.illumination!.tr,
// rightTitle: "",
// isHaveLine: true,
// isHaveDirection: true,
// action: () {
// logic.showToast("功能暂未开放");
// }))),
//
Visibility(
visible: state.lockFeature.value.doorStatus == 1 ? true : false,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.doorOpener!.tr,
rightTitle: "",
isHaveLine: false,
isHaveDirection: true,
action: () {
logic.showToast("功能暂未开放");
})),
SizedBox(height: 10.h),
// Visibility(
// visible: state.lockFeature.value.doorStatus == 1 ? true : false,
// child: CommonItem(
// leftTitel: TranslationLoader.lanKeys!.doorOpener!.tr,
// rightTitle: "",
// isHaveLine: false,
// isHaveDirection: true,
// action: () {
// logic.showToast("功能暂未开放");
// })),
// SizedBox(height: 10.h),
//
Obx(() => Visibility(
visible: state.lockFeature.value.autoLock == 1 ? true : false,
@ -330,7 +331,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
}))),
//
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(
leftTitel: TranslationLoader.lanKeys!.resetButton!.tr,
rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) == 1
@ -470,7 +474,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
//
Obx(
() => 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(
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
rightTitle: "",
@ -481,7 +488,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
//
Obx(
() => 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(
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: "",
@ -492,7 +502,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// APP开锁时是否需联网
Obx(
() => 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(
leftTitel: TranslationLoader
.lanKeys!.whetherInternetRequiredWhenUnlocking!.tr,