fix:去除 xhj 首页列表白边

This commit is contained in:
anfe 2024-05-28 17:36:48 +08:00
parent fbd1adf4e1
commit fea93bdf1e
2 changed files with 35 additions and 60 deletions

View File

@ -1,36 +1,20 @@
import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_state.dart'; import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_state.dart';
import 'package:star_lock/tools/showTipView.dart';
import 'package:star_lock/tools/titleAppBar.dart'; import 'package:star_lock/tools/titleAppBar.dart';
import 'package:star_lock/widget/flavors_img.dart';
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
import '../../../blue/blue_manage.dart';
import '../../../blue/io_tool/io_tool.dart';
import '../../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../../tools/appRouteObserver.dart';
import '../../../tools/commonDataManage.dart';
import '../../../tools/dateTool.dart';
import '../../../tools/eventBusEventManage.dart';
import '../../../tools/storage.dart';
import '../../../translations/trans_lib.dart';
import '../../lockMian/entity/lockListInfo_entity.dart';
import 'lockDetail_logic.dart'; import 'lockDetail_logic.dart';
class LockDetailListPage extends StatefulWidget { class LockDetailListPage extends StatefulWidget {
const LockDetailListPage({required this.title, required this.items, Key? key})
: super(key: key);
final String title; final String title;
final List<Widget> items; final List<Widget> items;
const LockDetailListPage({Key? key, required this.title, required this.items})
: super(key: key);
@override @override
State<LockDetailListPage> createState() => _LockDetailListPageState(); State<LockDetailListPage> createState() => _LockDetailListPageState();
} }
@ -59,7 +43,7 @@ class _LockDetailListPageState extends State<LockDetailListPage>
body: ListView.builder( body: ListView.builder(
padding: EdgeInsets.only(top: 15.h), padding: EdgeInsets.only(top: 15.h),
itemCount: widget.items.length, itemCount: widget.items.length,
itemBuilder: (context, index) => widget.items[index]), itemBuilder: (BuildContext context, int index) => widget.items[index]),
); );
} }
} }

View File

@ -65,20 +65,15 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
), ),
), ),
Expanded( Expanded(
child: ListView.separated( child: ListView.builder(
itemCount: logic.groupDataList.length, itemCount: logic.groupDataList.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
final GroupList itemData = logic.groupDataList[index]; final GroupList itemData = logic.groupDataList[index];
return _buildLockExpandedList(context, index, itemData); return _buildLockExpandedList(context, index, itemData);
}, },
shrinkWrap: true, shrinkWrap: true,
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
separatorBuilder: (BuildContext context, int index) { ),
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
}),
), ),
], ],
), ),
@ -87,7 +82,8 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
} }
// //
Widget _buildLockExpandedList(context, index, GroupList itemData) { Widget _buildLockExpandedList(
BuildContext context, int index, GroupList itemData) {
final List<LockListInfoItemEntity> lockItemList = final List<LockListInfoItemEntity> lockItemList =
itemData.lockList ?? <LockListInfoItemEntity>[]; itemData.lockList ?? <LockListInfoItemEntity>[];
return LockListGroupView( return LockListGroupView(
@ -110,7 +106,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
)); ));
} }
List<Widget> forItems(List lockItemList) { List<Widget> forItems(List<LockListInfoItemEntity> lockItemList) {
final List<Widget> list = <Widget>[]; final List<Widget> list = <Widget>[];
for (int i = 0, j = 0; i < lockItemList.length; i++, j++) { for (int i = 0, j = 0; i < lockItemList.length; i++, j++) {
final LockListInfoItemEntity keyInfo = lockItemList[i]; final LockListInfoItemEntity keyInfo = lockItemList[i];
@ -141,24 +137,24 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) && keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
(keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)) { (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)) {
logic.showToast("您的钥匙未生效".tr); logic.showToast('您的钥匙未生效'.tr);
return; return;
} }
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) && keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
(keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) { (keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) {
logic.showToast("您的钥匙已冻结".tr); logic.showToast('您的钥匙已冻结'.tr);
return; return;
} }
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) && keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
(keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) { (keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) {
logic.showToast("您的钥匙已过期".tr); logic.showToast('您的钥匙已过期'.tr);
return; return;
} }
Get.toNamed(Routers.lockDetailMainPage, arguments: <String, Object>{ Get.toNamed(Routers.lockDetailMainPage, arguments: <String, Object>{
"keyInfo": keyInfo, 'keyInfo': keyInfo,
"isOnlyOneData": false, 'isOnlyOneData': false,
}); });
}), }),
)); ));
@ -217,7 +213,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
), ),
maxLines: 1), maxLines: 1),
Visibility( Visibility(
visible: keyInfo.passageMode == 1 ? true : false, visible: keyInfo.passageMode == 1,
child: Padding( child: Padding(
padding: EdgeInsets.only(top: 5.h), padding: EdgeInsets.only(top: 5.h),
child: Row( child: Row(
@ -228,7 +224,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
borderRadius: BorderRadius.circular(5.w), borderRadius: BorderRadius.circular(5.w),
color: AppColors.openPassageModeColor, color: AppColors.openPassageModeColor,
), ),
child: Text("常开模式开启".tr, child: Text('常开模式开启'.tr,
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
color: AppColors.appBarIconColor)), color: AppColors.appBarIconColor)),
@ -237,14 +233,13 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
), ),
)), )),
Visibility( Visibility(
visible: visible: keyInfo.lockSetting!.remoteUnlock == 1,
keyInfo.lockSetting!.remoteUnlock == 1 ? true : false,
child: Padding( child: Padding(
padding: EdgeInsets.only(top: 5.h), padding: EdgeInsets.only(top: 5.h),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Text( Text(
"远程开锁".tr, '远程开锁'.tr,
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
color: AppColors.darkGrayTextColor), color: AppColors.darkGrayTextColor),
@ -253,16 +248,14 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
), ),
)), )),
Visibility( Visibility(
visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || visible: (keyInfo.keyType == XSConstantMacro.keyTypeTime ||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) && keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
(keyInfo.keyStatus == (keyInfo.keyStatus ==
XSConstantMacro.keyStatusWaitIneffective || XSConstantMacro.keyStatusWaitIneffective ||
keyInfo.keyStatus == keyInfo.keyStatus ==
XSConstantMacro.keyStatusFrozen || XSConstantMacro.keyStatusFrozen ||
keyInfo.keyStatus == keyInfo.keyStatus ==
XSConstantMacro.keyStatusExpired)) XSConstantMacro.keyStatusExpired),
? true
: false,
child: Padding( child: Padding(
padding: EdgeInsets.only(top: 20.h), padding: EdgeInsets.only(top: 20.h),
child: Row( child: Row(
@ -292,7 +285,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
child: Text( child: Text(
keyInfo.isLockOwner == 1 keyInfo.isLockOwner == 1
? '超级管理员'.tr ? '超级管理员'.tr
: (keyInfo.keyRight == 1 ? "授权管理员".tr : "普通用户".tr), : (keyInfo.keyRight == 1 ? '授权管理员'.tr : '普通用户'.tr),
style: TextStyle( style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor), fontSize: 18.sp, color: AppColors.darkGrayTextColor),
), ),
@ -304,7 +297,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
), ),
SizedBox(width: 2.w), SizedBox(width: 2.w),
Text( Text(
"${keyInfo.electricQuantity!}%", '${keyInfo.electricQuantity!}%',
style: TextStyle( style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor), fontSize: 18.sp, color: AppColors.darkGrayTextColor),
), ),
@ -326,7 +319,6 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
@override @override
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies(); super.didChangeDependencies();
/// ///
@ -335,7 +327,6 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
@override @override
void dispose() { void dispose() {
// TODO: implement dispose
/// ///
AppRouteObserver().routeObserver.unsubscribe(this); AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose(); super.dispose();