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