import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/titleAppBar.dart'; import '../../entity/lockListInfo_entity.dart'; import 'demoModeLockDetail_logic.dart'; class DemoModeLockDetailPage extends StatefulWidget { const DemoModeLockDetailPage({Key? key}) : super(key: key); @override State createState() => _DemoModeLockDetailPageState(); } class _DemoModeLockDetailPageState extends State { final DemoModeLockDetailLogic logic = Get.put(DemoModeLockDetailLogic()); // final state = Get.find().state; @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( barTitle: '演示模式'.tr, haveBack: true, backgroundColor: AppColors.mainColor, ), body: ListView( children: [ Container( width: 1.sw, height: 1.sh - ScreenUtil().statusBarHeight, color: Colors.white, child: Column( children: [ topTip(), topWidget(), Expanded(child: bottomWidget()) ], ), ), ], )); } Widget topTip() { return Container( // height: 120.h, width: 1.sw, margin: EdgeInsets.all(15.w), child: Column( children: [ Row( children: [ Expanded( child: Text('提示:当前界面为展示界面,添加设备后才能继续使用'.tr, style: TextStyle( fontSize: 24.sp, color: AppColors.mainColor))), ], ), ], ), ); } Widget topWidget() { // KeyInfos keyInfo = widget.lockMainEntity.data!.keyInfos![0]; return Column( mainAxisSize: MainAxisSize.min, children: [ SizedBox(height: 30.h), Stack( alignment: Alignment.centerRight, children: [ Align( alignment: Alignment.center, child: Text( 'TMH_78f16712781a', style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400), )), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ Text( '100%', style: TextStyle( fontSize: 18.sp, color: AppColors.darkGrayTextColor), ), SizedBox(width: 2.w), Image.asset( 'images/main/icon_main_cell.png', width: 30.w, height: 24.w, ), SizedBox(width: 30.w), ], ), ], ), SizedBox(height: 30.h), Container( // width: 1.sw, color: Colors.white, height: 280.w, child: Stack( children: [ Center( child: GestureDetector( onTap: gotoLogin, child: Image.asset('images/main/icon_main_openLockBtn.png', width: 268.w, height: 268.w), )), ], ), ), SizedBox(height: 30.h), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( '门已上锁'.tr, style: TextStyle( fontSize: 26.sp, color: Colors.black, fontWeight: FontWeight.w500), ), ], ), SizedBox( height: 6.h, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( '点击开锁,长按闭锁'.tr, style: TextStyle( fontSize: 22.sp, color: AppColors.btnDisableColor, fontWeight: FontWeight.w500), ), ], ), SizedBox( height: 30.h, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( 'images/icon_electronicKey_admin.png', width: 24.w, height: 20.w, ), SizedBox( width: 6.w, ), Text( '超级管理员'.tr, style: TextStyle(fontSize: 20.sp, color: AppColors.btnDisableColor), ), SizedBox( width: 80.w, ), Image.asset( 'images/main/icon_main_remoteUnlocking_grey.png', // state.keyInfos.value.remoteEnable == 1 // ? 'images/main/icon_main_remoteUnlocking.png' // : 'images/main/icon_main_remoteUnlocking_grey.png', width: 24.w, height: 20.w, // color: state.keyInfos.value.remoteEnable == 1 // ? AppColors.btnDisableColor // : AppColors.mainColor, ), SizedBox( width: 6.w, ), Text( '网关设备英文'.tr, style: TextStyle(fontSize: 20.sp, color: AppColors.btnDisableColor), ), ], ), SizedBox( height: 20.h, ), Divider( height: 1, color: AppColors.greyLineColor, indent: 20.w, endIndent: 20.w, ) ], ); } Widget bottomWidget() { return Container( margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 40.h), // color: Colors.blue, child: SizedBox( child: GridView.count( crossAxisCount: 4, // childAspectRatio: 3, crossAxisSpacing: 20.w, mainAxisSpacing: 0.h, physics: const NeverScrollableScrollPhysics(), children: getShowWidget()), ), ); } List getShowWidget() { final List showWidgetArr = []; // 考勤 // if (state.keyInfos.value.isAttendance == 1) { showWidgetArr .add(bottomItem('images/main/icon_main_clockingIn.png', '考勤'.tr, () { // gotoLogin(); Get.toNamed(Routers.checkingInListPage, arguments: LockListInfoItemEntity()); })); // } final List defaultWidgetArr = [ // 电子钥匙 bottomItem('images/main/icon_main_electronicKey.png', '电子钥匙'.tr, () { // gotoLogin(); Get.toNamed(Routers.electronicKeyListPage, arguments: { 'keyInfo': LockListInfoItemEntity() }); }), // 密码 bottomItem('images/main/icon_main_password.png', '密码'.tr, () { // gotoLogin(); Get.toNamed(Routers.passwordKeyListPage, arguments: { 'keyInfo': LockListInfoItemEntity() }); }), // ic卡 bottomItem('images/main/icon_main_icCard.png', '卡'.tr, () { // gotoLogin(); Get.toNamed(Routers.cardListPage, arguments: {'lockId': 0}); }), // 指纹 bottomItem('images/main/icon_main_fingerprint.png', '指纹'.tr, () { // gotoLogin(); Get.toNamed(Routers.fingerprintListPage, arguments: {'lockId': 1, 'fromType': 1}); }), // 遥控 bottomItem('images/main/icon_main_remoteControl.png', '遥控'.tr, gotoLogin), ]; showWidgetArr.addAll(defaultWidgetArr); //可视对讲门锁新增->人脸 showWidgetArr.add( bottomItem('images/main/icon_face.png', '人脸'.tr, () { // gotoLogin(); Get.toNamed(Routers.faceListPage, arguments: { 'lockId': 1, }); }), ); //可视对讲门锁新增->监控 showWidgetArr.add( bottomItem('images/main/icon_catEyes.png', '监控'.tr, gotoLogin), ); final List endWiddget = [ // 授权管理员 bottomItem('images/main/icon_main_authorizedAdmin.png', '授权管理员'.tr, () { // gotoLogin(); Get.toNamed(Routers.authorizedAdminListPage, arguments: { 'keyInfo': LockListInfoItemEntity() }); }), // 操作记录 bottomItem('images/main/icon_main_operatingRecord.png', '操作记录'.tr, () { // gotoLogin(); Get.toNamed(Routers.lockOperatingRecordPage, arguments: { 'keyInfo': LockListInfoItemEntity() }); }), // 视频日志 bottomItem('images/main/icon_lockDetail_videoLog.png', '视频日志'.tr, () { //视频日志 Get.toNamed(Routers.videoLogPage); }), // 消息提醒 bottomItem('images/main/icon_lockDetail_messageReminding.png', '消息提醒'.tr, () { Get.toNamed(Routers.msgNotificationPage); }), // 设置 bottomItem('images/main/icon_main_set.png', '设置'.tr, () { Get.toNamed(Routers.demoModeLockSetPage); }), ]; showWidgetArr.addAll(endWiddget); return showWidgetArr; } Widget bottomItem(String iconUrl, String name, Function() onClick) { final double width = 42.w; final double height = 42.h; return GestureDetector( onTap: onClick, child: Container( // height: 300.h, color: Colors.white, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( width: width, height: height, child: Image.asset(iconUrl, width: width, height: height, fit: BoxFit.fitWidth), ), SizedBox(height: 10.w), Expanded( child: Text(name, style: TextStyle( fontSize: 20.sp, color: AppColors.blackColor), textAlign: TextAlign.center)) ], )), ); } void gotoLogin() { // Get.toNamed(Routers.selectLockTypePage); logic.showToast('演示模式'.tr); } }