锁详情页面新增配件区配置(未完善)
This commit is contained in:
parent
1a5823964e
commit
ca20145ca3
@ -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,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// bottomWidget(),
|
||||
// Container(
|
||||
// width: 1.sw,
|
||||
// height: 200,
|
||||
// color: Colors.white,
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
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: [
|
||||
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() {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 40.h),
|
||||
// color: Colors.blue,
|
||||
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 ||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
@ -23,13 +22,13 @@ class LockDetailState {
|
||||
var senderUserId = 0;
|
||||
var isOnlyOneData = false;
|
||||
|
||||
var isAttendance = 0.obs;// 是否开启考勤
|
||||
var isAttendance = 0.obs; // 是否开启考勤
|
||||
var isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
|
||||
var electricQuantity = 0.obs; // 电量
|
||||
var isOpenPassageMode = 0.obs; // 是否开启了常开模式
|
||||
var lockAlias = "".obs; // 锁名字
|
||||
|
||||
var currentDeviceUUid = "".obs;// 当前设备的uuid
|
||||
var currentDeviceUUid = "".obs; // 当前设备的uuid
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var iSClosedUnlockSuccessfulPopup = false.obs; // 是否关闭了开锁成功弹窗
|
||||
@ -41,11 +40,14 @@ class LockDetailState {
|
||||
//过渡动画控制器
|
||||
late AnimationController animationController;
|
||||
// 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连接
|
||||
|
||||
final PageController pageController = PageController();
|
||||
var currentPage = 0.obs;
|
||||
|
||||
// LockDetailState() {
|
||||
// Map map = Get.arguments;
|
||||
// lockCount = map["lockCount"];
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
final state = Get.find<LockSetLogic>().state;
|
||||
|
||||
Future<void> getHttpData() async {
|
||||
logic.getLockSettingInfoData().then((LockSetInfoEntity value){
|
||||
logic.getLockSettingInfoData().then((LockSetInfoEntity value) {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
@ -56,7 +56,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: EasyRefreshTool(
|
||||
onRefresh: (){
|
||||
onRefresh: () {
|
||||
getHttpData();
|
||||
},
|
||||
child: Column(
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user