feat:修改开锁页 ui
This commit is contained in:
parent
3238359c54
commit
f9cffeb49f
@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -60,7 +61,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
_initRefreshLockDetailInfoDataEventAction();
|
||||
logic.initReplySubscription();
|
||||
logic.initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction();
|
||||
logic.loadData(lockListInfoItemEntity: widget.lockListInfoItemEntity, isOnlyOneData: widget.isOnlyOneData);
|
||||
logic.loadData(
|
||||
lockListInfoItemEntity: widget.lockListInfoItemEntity,
|
||||
isOnlyOneData: widget.isOnlyOneData);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -95,35 +98,50 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
final String lockAlias = state.keyInfos.value.lockAlias!;
|
||||
return Stack(
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 15.h,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w),
|
||||
child: Text(
|
||||
lockAlias,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 24.sp, color: Colors.black),
|
||||
SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 15.h,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 35.h,
|
||||
),
|
||||
xhjInfoView(),
|
||||
SizedBox(
|
||||
height: 35.h,
|
||||
),
|
||||
labelText('images/icon_slider_horizontal.png', '功能'.tr, () {
|
||||
Get.to(LockDetailListPage(
|
||||
title: '功能'.tr, items: getBottomWidget()));
|
||||
}),
|
||||
labelText('images/icon_puzzlepiece_extension.png', '配件'.tr, () {
|
||||
Get.to(LockDetailListPage(
|
||||
title: '配件'.tr, items: getAttachmentWidget()));
|
||||
}),
|
||||
],
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w),
|
||||
child: Text(
|
||||
lockAlias,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 24.sp, color: Colors.black),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 35.h,
|
||||
),
|
||||
xhjInfoView(),
|
||||
SizedBox(
|
||||
height: 35.h,
|
||||
),
|
||||
labelText(
|
||||
img: 'images/icon_slider_horizontal.png',
|
||||
text: '功能'.tr,
|
||||
child: bottomWidget()),
|
||||
labelText(
|
||||
img: 'images/icon_puzzlepiece_extension.png',
|
||||
text: '配件'.tr,
|
||||
child: attachmentWidget()),
|
||||
btnText(
|
||||
img: 'images/main/icon_main_set.png',
|
||||
text: TranslationLoader.lanKeys!.set!.tr,
|
||||
onTap: () {
|
||||
if (state.openDoorBtnisUneable.value == false) {
|
||||
return;
|
||||
}
|
||||
Get.toNamed(Routers.lockSetPage,
|
||||
arguments: <String, Object?>{
|
||||
'lockId': state.keyInfos.value.lockId,
|
||||
'isOnlyOneData': state.isOnlyOneData
|
||||
});
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: state.iSClosedUnlockSuccessfulPopup.value,
|
||||
@ -139,7 +157,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
);
|
||||
}
|
||||
|
||||
Widget labelText(String img, String text, var onTap) {
|
||||
Widget btnText(
|
||||
{required String img, required String text, required var onTap}) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
@ -152,16 +171,19 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.15),
|
||||
offset: const Offset(0, 0),
|
||||
blurRadius: 10.r,
|
||||
blurRadius: 5.r,
|
||||
spreadRadius: 0,
|
||||
),
|
||||
]),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
img,
|
||||
width: 32.r,
|
||||
height: 32.r,
|
||||
FlavorsImg(
|
||||
black: true,
|
||||
child: Image.asset(
|
||||
img,
|
||||
width: 32.r,
|
||||
height: 32.r,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 15.w,
|
||||
@ -181,6 +203,49 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
);
|
||||
}
|
||||
|
||||
Widget labelText(
|
||||
{required String img, required String text, required Widget child}) {
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 0.05.sw, vertical: 15.h),
|
||||
padding: EdgeInsets.symmetric(horizontal: 0.05.sw, vertical: 20.h),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16.r),
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.15),
|
||||
offset: const Offset(0, 0),
|
||||
blurRadius: 5.r,
|
||||
spreadRadius: 0,
|
||||
),
|
||||
]),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
img,
|
||||
width: 32.r,
|
||||
height: 32.r,
|
||||
),
|
||||
SizedBox(
|
||||
width: 15.w,
|
||||
),
|
||||
Text(
|
||||
text,
|
||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 18.h,
|
||||
),
|
||||
child,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget xhjInfoView() {
|
||||
return Container(
|
||||
width: 0.9.sw,
|
||||
@ -294,7 +359,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.3),
|
||||
offset: const Offset(0, 0),
|
||||
blurRadius: 10.r,
|
||||
blurRadius: 15.r,
|
||||
spreadRadius: 0,
|
||||
),
|
||||
]),
|
||||
@ -836,6 +901,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
// childAspectRatio: 3,
|
||||
crossAxisSpacing: 20.w,
|
||||
mainAxisSpacing: 0.h,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: getAttachmentWidget()),
|
||||
);
|
||||
@ -880,7 +946,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
crossAxisCount: 4,
|
||||
// childAspectRatio: 3,
|
||||
crossAxisSpacing: 25.h,
|
||||
mainAxisSpacing: 0.h,
|
||||
mainAxisSpacing: 5.h,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: getBottomWidget()),
|
||||
);
|
||||
@ -922,13 +989,15 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
}));
|
||||
|
||||
// 设置
|
||||
showWidgetArr.add(bottomItem('images/main/icon_main_set.png',
|
||||
TranslationLoader.lanKeys!.set!.tr, true, () {
|
||||
Get.toNamed(Routers.lockSetPage, arguments: <String, Object?>{
|
||||
'lockId': state.keyInfos.value.lockId,
|
||||
'isOnlyOneData': state.isOnlyOneData
|
||||
});
|
||||
}));
|
||||
if (F.isSKY) {
|
||||
showWidgetArr.add(bottomItem('images/main/icon_main_set.png',
|
||||
TranslationLoader.lanKeys!.set!.tr, true, () {
|
||||
Get.toNamed(Routers.lockSetPage, arguments: <String, Object?>{
|
||||
'lockId': state.keyInfos.value.lockId,
|
||||
'isOnlyOneData': state.isOnlyOneData
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
return showWidgetArr;
|
||||
}
|
||||
@ -1106,17 +1175,19 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
}),
|
||||
);
|
||||
|
||||
endWiddget.add(
|
||||
// 设置
|
||||
bottomItem('images/main/icon_main_set.png',
|
||||
TranslationLoader.lanKeys!.set!.tr, true, () {
|
||||
// logic.clickItemBtnAction(10);
|
||||
Get.toNamed(Routers.lockSetPage, arguments: <String, Object?>{
|
||||
'lockId': state.keyInfos.value.lockId,
|
||||
'isOnlyOneData': state.isOnlyOneData,
|
||||
});
|
||||
}),
|
||||
);
|
||||
if (F.isSKY) {
|
||||
endWiddget.add(
|
||||
// 设置
|
||||
bottomItem('images/main/icon_main_set.png',
|
||||
TranslationLoader.lanKeys!.set!.tr, true, () {
|
||||
// logic.clickItemBtnAction(10);
|
||||
Get.toNamed(Routers.lockSetPage, arguments: <String, Object?>{
|
||||
'lockId': state.keyInfos.value.lockId,
|
||||
'isOnlyOneData': state.isOnlyOneData,
|
||||
});
|
||||
}),
|
||||
);
|
||||
}
|
||||
showWidgetArr.addAll(endWiddget);
|
||||
return showWidgetArr;
|
||||
}
|
||||
@ -1158,13 +1229,13 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
xhjCall: () => Container(
|
||||
color: Colors.white,
|
||||
margin: EdgeInsets.symmetric(vertical: 5.h),
|
||||
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w),
|
||||
child: Row(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 42.w,
|
||||
height: 42.h,
|
||||
height: 42.w,
|
||||
child: FlavorsImg(
|
||||
black: true,
|
||||
child: Image.asset(iconUrl,
|
||||
@ -1176,7 +1247,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
fit: BoxFit.fitWidth),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20.w),
|
||||
SizedBox(height: 20.h),
|
||||
Text(
|
||||
name,
|
||||
style: TextStyle(
|
||||
|
||||
@ -569,15 +569,10 @@ class LockSetLogic extends BaseGetXController {
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
BlueManage().connectDeviceMacAddress = '';
|
||||
final bool isXHJ = F.isXHJ;
|
||||
final bool isOnlyOneData = state.isOnlyOneData.value == true;
|
||||
await Future<dynamic>.delayed(const Duration(milliseconds: 200))
|
||||
.then((e) {
|
||||
if (isXHJ) {
|
||||
Get.close(3);
|
||||
} else {
|
||||
Get.close(isOnlyOneData ? 1 : 2);
|
||||
}
|
||||
Get.close(isOnlyOneData ? 1 : 2);
|
||||
});
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
@ -594,17 +589,10 @@ class LockSetLogic extends BaseGetXController {
|
||||
state.deleteAdministratorIsHaveAllData.value == true ? 1 : 0);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
BlueManage().connectDeviceMacAddress = '';
|
||||
|
||||
final bool isXHJ = F.isXHJ;
|
||||
final bool isOnlyOneData = state.isOnlyOneData.value == true;
|
||||
await Future<dynamic>.delayed(const Duration(milliseconds: 200))
|
||||
.then((e) {
|
||||
if (isXHJ) {
|
||||
Get.close(3);
|
||||
} else {
|
||||
final int onlyOneDataInt = isOnlyOneData ? 1 : 2;
|
||||
Get.close(onlyOneDataInt);
|
||||
}
|
||||
Get.close(isOnlyOneData ? 1 : 2);
|
||||
});
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user