1,解决N天未开门点击无效问题

2,修复实名认证使用记录页面bug
This commit is contained in:
Daisy 2024-05-22 09:16:25 +08:00
parent d5b2642efc
commit 4e81381b37
8 changed files with 235 additions and 260 deletions

View File

@ -11,15 +11,28 @@ class AddFamilyLogic extends BaseGetXController {
// //
Future<void> addLockNoticeSetting() async { Future<void> addLockNoticeSetting() async {
final Map<String, Object?> settingValue = <String, Object?>{
'openDoorId': state.lockUserKeys.value.currentOpenDoorID,
'openDoorType': state.lockUserKeys.value.currentKeyType,
'remark': state.lockUserKeys.value.currentKeyName ?? '',
'noticeWay': getNoticeWayList(),
};
final MsgNotificationEntity entity = final MsgNotificationEntity entity =
await ApiRepository.to.addLockNoticeSetting( await ApiRepository.to.addLockNoticeSetting(
lockId: state.getLockId.value, lockId: state.getLockId.value,
noticeType: 10, noticeType: 10,
settingValue: { settingValue: settingValue,
'openDoorId': state.lockUserKeys.value.currentOpenDoorID, );
'openDoorType': state.lockUserKeys.value.currentKeyType,
'remark': state.lockUserKeys.value.currentKeyName ?? '', if (entity.errorCode!.codeIsSuccessful) {
'noticeWay': <Map<String, Object>>[ showToast('添加成功'.tr);
Get.back(result: true);
}
}
List<Map<String, Object>> getNoticeWayList() {
return <Map<String, Object>>[
<String, Object>{ <String, Object>{
'type': 'mail', 'type': 'mail',
'accounts': getEmailAndSMSAccountList(true) 'accounts': getEmailAndSMSAccountList(true)
@ -27,14 +40,8 @@ class AddFamilyLogic extends BaseGetXController {
<String, Object>{ <String, Object>{
'type': 'sms', 'type': 'sms',
'accounts': getEmailAndSMSAccountList(false) 'accounts': getEmailAndSMSAccountList(false)
}
]
}, },
); ];
if (entity.errorCode!.codeIsSuccessful) {
showToast('添加成功'.tr);
Get.back(result: true);
}
} }
// //
@ -122,14 +129,14 @@ class AddFamilyLogic extends BaseGetXController {
// //
bool checkBtnDisable() { bool checkBtnDisable() {
if ((state.emailListStr.value.isEmpty || final String? keyTypeStr = state.lockUserKeys.value.currentKeyTypeStr;
state.phontListStr.value.isEmpty) || final String? keyName = state.lockUserKeys.value.currentKeyName;
state.lockUserKeys.value.currentKeyTypeStr!.isEmpty ||
state.lockUserKeys.value.currentKeyName!.isEmpty) { if (keyTypeStr == null || keyName == null) {
return false; return false;
} else {
return true;
} }
return keyTypeStr.isNotEmpty && keyName.isNotEmpty;
} }
// 1: 2: 3: 4: 5: // 1: 2: 3: 4: 5:
@ -156,29 +163,27 @@ class AddFamilyLogic extends BaseGetXController {
final List<MsgNoticeModeData> mailAccounts = <MsgNoticeModeData>[]; final List<MsgNoticeModeData> mailAccounts = <MsgNoticeModeData>[];
final List<MsgNoticeModeData> smsAccounts = <MsgNoticeModeData>[]; final List<MsgNoticeModeData> smsAccounts = <MsgNoticeModeData>[];
if (state.familyData.value.settingValue != null) { state.familyData.value.settingValue?.noticeWayList
for (final NoticeWay item ?.forEach((NoticeWay item) {
in state.familyData.value.settingValue!.noticeWayList!) { if (item.type == 'mail') {
if (item.type == 'mail' && item.accounts != null) { item.accounts?.forEach((Accounts account) {
for (final Accounts account in item.accounts!) {
if (account.account != null) { if (account.account != null) {
final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData(); final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
msgNoticeModeData.receiveEmail = account.account!; msgNoticeModeData.receiveEmail = account.account!;
mailAccounts.add(msgNoticeModeData); mailAccounts.add(msgNoticeModeData);
} }
} });
} else if (item.type == 'sms' && item.accounts != null) { } else if (item.type == 'sms') {
for (final Accounts account in item.accounts!) { item.accounts?.forEach((Accounts account) {
if (account.account != null && account.countryCode != null) { if (account.account != null && account.countryCode != null) {
final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData(); final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
msgNoticeModeData.receivePhone = account.account!; msgNoticeModeData.receivePhone = account.account!;
msgNoticeModeData.countryCode = account.countryCode!; msgNoticeModeData.countryCode = account.countryCode!;
smsAccounts.add(msgNoticeModeData); smsAccounts.add(msgNoticeModeData);
} }
});
} }
} });
}
}
return <String, List<MsgNoticeModeData>>{ return <String, List<MsgNoticeModeData>>{
'emailReceiverList': mailAccounts, 'emailReceiverList': mailAccounts,

View File

@ -120,7 +120,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
: logic.checkBtnDisable(), : logic.checkBtnDisable(),
isDelete: state.isDetail.value, isDelete: state.isDetail.value,
onClick: () async { onClick: () async {
bool? isVip = await Storage.getBool(saveIsVip); final bool? isVip = await Storage.getBool(saveIsVip);
if (isVip == true) { if (isVip == true) {
if (state.isDetail.value) { if (state.isDetail.value) {
logic.deleteLockNoticeSetting(); logic.deleteLockNoticeSetting();

View File

@ -5,9 +5,9 @@ import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNo
class AddFamilyState { class AddFamilyState {
final TextEditingController changeNameController = TextEditingController(); final TextEditingController changeNameController = TextEditingController();
var getLockId = 0.obs; RxInt getLockId = 0.obs;
var lockUserKeys = LockUserListKeys().obs; Rx<LockUserListKeys> lockUserKeys = LockUserListKeys().obs;
var emailReceiverList = [].obs; RxList emailReceiverList = [].obs;
var phoneReceiverList = [].obs; var phoneReceiverList = [].obs;
var emailListStr = ''.obs; var emailListStr = ''.obs;
var phontListStr = ''.obs; var phontListStr = ''.obs;

View File

@ -3,6 +3,7 @@ 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:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart'; import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/nDaysUnopened/nDaysUnopened_state.dart'; import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/nDaysUnopened/nDaysUnopened_state.dart';
import 'package:star_lock/tools/commonItem.dart'; import 'package:star_lock/tools/commonItem.dart';
@ -34,9 +35,11 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: 'N天未开门'.tr, barTitle: 'N天未开门'.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor,
body: ListView( ),
body: Padding(
padding: EdgeInsets.all(30.w), padding: EdgeInsets.all(30.w),
child: Column(
children: <Widget>[ children: <Widget>[
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -46,29 +49,25 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
'经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网'.tr, '经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网'.tr,
style: TextStyle( style: TextStyle(
fontSize: 20.sp, color: AppColors.darkGrayTextColor), fontSize: 20.sp, color: AppColors.darkGrayTextColor),
)), ),
),
], ],
), ),
SizedBox( SizedBox(height: 20.h),
height: 20.h,
),
CommonItem( CommonItem(
leftTitel: 'N天未开门提醒'.tr, leftTitel: 'N天未开门提醒'.tr,
rightTitle: '', rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: false, isHaveDirection: false,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: _unOpenDoorSwitch(), rightWidget: Obx(_unOpenDoorSwitch),
action: () {}), ),
_buildOpenNoticeWidget(), Obx(_buildOpenNoticeWidget),
Expanded( Expanded(child: Container()),
child: SizedBox(
height: 20.h,
)),
SubmitBtn( SubmitBtn(
btnName: '保存'.tr, btnName: '保存'.tr,
onClick: () async { onClick: () async {
bool? isVip = await Storage.getBool(saveIsVip); final bool? isVip = await Storage.getBool(saveIsVip);
if (isVip == false) { if (isVip == false) {
ShowCupertinoAlertView().advancedFeatureAlert(); ShowCupertinoAlertView().advancedFeatureAlert();
} else { } else {
@ -76,11 +75,10 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
} }
}, },
), ),
SizedBox( SizedBox(height: 60.h),
height: 60.h,
)
], ],
), ),
),
); );
} }
@ -89,7 +87,7 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
visible: state.isUnOpenNotice.value, visible: state.isUnOpenNotice.value,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Obx(() => CommonItem( CommonItem(
leftTitel: '门未开时间'.tr, leftTitel: '门未开时间'.tr,
rightTitle: '${state.unOpenDoorTime.value}', rightTitle: '${state.unOpenDoorTime.value}',
isHaveLine: true, isHaveLine: true,
@ -98,10 +96,8 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
action: () { action: () {
_openBottomItemSheet(context, state.unopenDoorTimeList); _openBottomItemSheet(context, state.unopenDoorTimeList);
}, },
)),
SizedBox(
height: 20.h,
), ),
SizedBox(height: 20.h),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Get.toNamed(Routers.notificationModePage, Get.toNamed(Routers.notificationModePage,
@ -127,27 +123,23 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
isHaveDirection: true, isHaveDirection: true,
), ),
_buildNotifyContain('APP推送'.tr, '管理员'.tr), _buildNotifyContain('APP推送'.tr, '管理员'.tr),
Obx(() => state.emailListStr.value.isNotEmpty if (state.emailListStr.value.isNotEmpty)
? _buildNotifyContain( _buildNotifyContain('邮件提醒'.tr, state.emailListStr.value),
'邮件提醒'.tr, state.emailListStr.value) if (state.phontListStr.value.isNotEmpty)
: Container()), _buildNotifyContain('短信提醒'.tr, state.phontListStr.value),
Obx(() => state.phontListStr.value.isNotEmpty
? _buildNotifyContain(
'短信提醒'.tr, state.phontListStr.value)
: Container()),
], ],
), ),
), ),
), ),
], ],
)); ),
);
} }
Widget _buildNotifyContain(String notifyTitle, String notifyContent) { Widget _buildNotifyContain(String notifyTitle, String notifyContent) {
return Container( return Container(
padding: padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 12.h),
EdgeInsets.only(left: 10.w, right: 10.w, top: 12.h, bottom: 12.h), margin: EdgeInsets.symmetric(vertical: 10.h, horizontal: 20.w),
margin: EdgeInsets.only(bottom: 20.h, top: 10.h, left: 20.w, right: 20.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColors.mainBackgroundColor, color: AppColors.mainBackgroundColor,
borderRadius: BorderRadius.circular(6.0.w), borderRadius: BorderRadius.circular(6.0.w),
@ -158,14 +150,13 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
notifyTitle, notifyTitle,
style: TextStyle(color: Colors.black, fontSize: 20.sp), style: TextStyle(color: Colors.black, fontSize: 20.sp),
), ),
Expanded( Expanded(child: Container()),
child: SizedBox( Text(
width: 20.w, notifyContent,
)),
Text(notifyContent,
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: TextStyle( style: TextStyle(
color: AppColors.placeholderTextColor, fontSize: 20.sp)), color: AppColors.placeholderTextColor, fontSize: 20.sp),
),
], ],
), ),
); );
@ -178,12 +169,10 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isUnOpenNotice.value, value: state.isUnOpenNotice.value,
onChanged: (bool value) { onChanged: (bool value) {
setState(() {
state.isUnOpenNotice.value = value; state.isUnOpenNotice.value = value;
if (!state.isUnOpenNotice.value) { if (!state.isUnOpenNotice.value) {
state.msgNoticeInfo.value = MsgNoticeData(); state.msgNoticeInfo.value = MsgNoticeData();
} }
});
}, },
); );
} }
@ -195,6 +184,6 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
pickerStyle: DefaultPickerStyle(), onConfirm: (p, int position) { pickerStyle: DefaultPickerStyle(), onConfirm: (p, int position) {
state.unOpenDoorTime.value = state.unOpenDoorTime.value =
int.parse(state.unopenDoorTimeList[position].replaceAll('', '')); int.parse(state.unopenDoorTimeList[position].replaceAll('', ''));
}, onChanged: (p, int position) {}); });
} }
} }

View File

@ -72,6 +72,7 @@ class RecordItem {
String? amount; String? amount;
String? createdAt; String? createdAt;
String? updatedAt; String? updatedAt;
String? useDate;
RecordItem( RecordItem(
{this.id, {this.id,
@ -86,7 +87,8 @@ class RecordItem {
this.vipYear, this.vipYear,
this.amount, this.amount,
this.createdAt, this.createdAt,
this.updatedAt}); this.updatedAt,
this.useDate});
RecordItem.fromJson(Map<String, dynamic> json) { RecordItem.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
@ -102,6 +104,7 @@ class RecordItem {
amount = json['amount']; amount = json['amount'];
createdAt = json['created_at']; createdAt = json['created_at'];
updatedAt = json['updated_at']; updatedAt = json['updated_at'];
useDate = json['useDate'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -119,6 +122,7 @@ class RecordItem {
data['amount'] = amount; data['amount'] = amount;
data['created_at'] = createdAt; data['created_at'] = createdAt;
data['updated_at'] = updatedAt; data['updated_at'] = updatedAt;
data['useDate'] = useDate;
return data; return data;
} }
} }

View File

@ -70,6 +70,7 @@ class UseItemData {
int? consCount; int? consCount;
String? createdAt; String? createdAt;
String? updatedAt; String? updatedAt;
String? useDate;
UseItemData( UseItemData(
{this.id, {this.id,
@ -96,6 +97,7 @@ class UseItemData {
consCount = json['cons_count']; consCount = json['cons_count'];
createdAt = json['created_at']; createdAt = json['created_at'];
updatedAt = json['updated_at']; updatedAt = json['updated_at'];
useDate = json['useDate'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -111,6 +113,7 @@ class UseItemData {
data['cons_count'] = consCount; data['cons_count'] = consCount;
data['created_at'] = createdAt; data['created_at'] = createdAt;
data['updated_at'] = updatedAt; data['updated_at'] = updatedAt;
data['useDate'] = useDate;
return data; return data;
} }
} }

View File

@ -18,7 +18,7 @@ class ValueAddedServicesRecordLogic extends BaseGetXController {
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
dynamic data = Get.arguments; final dynamic data = Get.arguments;
if (data is! Map || data['type'] is! String) { if (data is! Map || data['type'] is! String) {
Get.back(); Get.back();
return; return;
@ -31,7 +31,7 @@ class ValueAddedServicesRecordLogic extends BaseGetXController {
if (!load) { if (!load) {
buyPageNo = 1; buyPageNo = 1;
} }
AdvancedFunctionRecordEntity entity = final AdvancedFunctionRecordEntity entity =
await ApiRepository.to.getBuyRecordList( await ApiRepository.to.getBuyRecordList(
type: type, type: type,
recordType: 10, recordType: 10,
@ -48,7 +48,7 @@ class ValueAddedServicesRecordLogic extends BaseGetXController {
if (!load) { if (!load) {
usePageNo = 1; usePageNo = 1;
} }
UseRecordListEntity entity = await ApiRepository.to.getUseRecordList( final UseRecordListEntity entity = await ApiRepository.to.getUseRecordList(
type: type, type: type,
pageNo: buyPageNo, pageNo: buyPageNo,
); );
@ -62,7 +62,7 @@ class ValueAddedServicesRecordLogic extends BaseGetXController {
void onReady() { void onReady() {
super.onReady(); super.onReady();
loadBuyRecordList(true); loadBuyRecordList(false);
loadUseRecordList(true); loadUseRecordList(false);
} }
} }

View File

@ -10,16 +10,14 @@ import '../../../app_settings/app_colors.dart';
import '../../../tools/titleAppBar.dart'; import '../../../tools/titleAppBar.dart';
class ValueAddedServicesRecordPage extends StatefulWidget { class ValueAddedServicesRecordPage extends StatefulWidget {
const ValueAddedServicesRecordPage({ const ValueAddedServicesRecordPage({Key? key}) : super(key: key);
Key? key,
}) : super(key: key);
@override @override
State<ValueAddedServicesRecordPage> createState() => State<ValueAddedServicesRecordPage> createState() =>
_ValueAddedServicesRealNamePageState(); _ValueAddedServicesRecordPageState();
} }
class _ValueAddedServicesRealNamePageState class _ValueAddedServicesRecordPageState
extends State<ValueAddedServicesRecordPage> { extends State<ValueAddedServicesRecordPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -43,16 +41,16 @@ class _ValueAddedServicesRealNamePageState
labelColor: AppColors.mainColor, labelColor: AppColors.mainColor,
unselectedLabelColor: AppColors.darkGrayTextColor, unselectedLabelColor: AppColors.darkGrayTextColor,
), ),
Obx(() => Expanded( Expanded(
child: TabBarView(children: [ child: Obx(() => TabBarView(children: [
_PurchaseRecords( _PurchaseRecords(
buyRecordList: logic.state.buyRecordList.value, buyRecordList: logic.state.buyRecordList.value,
), ),
_UseRecordsTable( _UseRecordsTable(
useRecordList: logic.state.useRecordList.value, useRecordList: logic.state.useRecordList.value,
), ),
]), ])),
)), ),
], ],
), ),
), ),
@ -63,7 +61,7 @@ class _ValueAddedServicesRealNamePageState
Widget tabTextItem(String tabText) { Widget tabTextItem(String tabText) {
return Container( return Container(
margin: EdgeInsets.only(top: 16.h, bottom: 16.h), margin: EdgeInsets.symmetric(vertical: 16.h),
child: Text( child: Text(
tabText, tabText,
style: TextStyle(fontSize: 24.sp), style: TextStyle(fontSize: 24.sp),
@ -72,28 +70,26 @@ Widget tabTextItem(String tabText) {
} }
// //
class _PurchaseRecords extends StatefulWidget { class _PurchaseRecords extends StatelessWidget {
const _PurchaseRecords({required this.buyRecordList});
final List buyRecordList; final List buyRecordList;
const _PurchaseRecords({required this.buyRecordList});
@override
State<_PurchaseRecords> createState() => _PurchaseRecordsState();
}
class _PurchaseRecordsState extends State<_PurchaseRecords> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetBuilder<ValueAddedServicesRecordLogic>( return GetBuilder<ValueAddedServicesRecordLogic>(
builder: (ValueAddedServicesRecordLogic logic) { builder: (ValueAddedServicesRecordLogic logic) {
return EasyRefresh( return EasyRefresh(
onRefresh: () async {}, onRefresh: () async {
onLoad: () async {}, logic.loadBuyRecordList(false);
child: widget.buyRecordList.isNotEmpty },
onLoad: () async {
logic.loadBuyRecordList(true);
},
child: buyRecordList.isNotEmpty
? ListView.builder( ? ListView.builder(
itemCount: widget.buyRecordList.length, itemCount: buyRecordList.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return _recordKeyItem(widget.buyRecordList[index]); return _recordKeyItem(buyRecordList[index]);
}) })
: NoData(), : NoData(),
); );
@ -103,17 +99,15 @@ class _PurchaseRecordsState extends State<_PurchaseRecords> {
Widget _recordKeyItem(RecordItem itemData) { Widget _recordKeyItem(RecordItem itemData) {
return Container( return Container(
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h), margin: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h),
padding: padding: EdgeInsets.all(20.w),
EdgeInsets.only(left: 20.w, right: 20.w, top: 16.h, bottom: 16.h),
child: Column( child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row( Row(
children: [ children: <Widget>[
Text( Text(
itemData.createdAt!.length > 10 itemData.createdAt?.substring(0, 10) ?? '',
? itemData.createdAt!.substring(0, 10)
: itemData.createdAt!,
style: TextStyle( style: TextStyle(
fontSize: 24.sp, fontSize: 24.sp,
color: AppColors.blackColor, color: AppColors.blackColor,
@ -127,18 +121,10 @@ class _PurchaseRecordsState extends State<_PurchaseRecords> {
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
], ],
), ),
SizedBox( SizedBox(height: 8.h),
height: 8.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text('实名认证/${itemData.cloudauthCount}', Text('实名认证/${itemData.cloudauthCount}',
textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor)) fontSize: 22.sp, color: AppColors.darkGrayTextColor)),
],
),
], ],
), ),
); );
@ -146,41 +132,42 @@ class _PurchaseRecordsState extends State<_PurchaseRecords> {
} }
// 使 // 使
class _UseRecordsTable extends StatefulWidget { class _UseRecordsTable extends StatelessWidget {
const _UseRecordsTable({required this.useRecordList});
final List useRecordList; final List useRecordList;
const _UseRecordsTable({required this.useRecordList});
@override
State<_UseRecordsTable> createState() => _UseRecordsTableState();
}
class _UseRecordsTableState extends State<_UseRecordsTable> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetBuilder<ValueAddedServicesRecordLogic>(
builder: (ValueAddedServicesRecordLogic logic) {
return EasyRefresh( return EasyRefresh(
onRefresh: () async {}, onRefresh: () async {
onLoad: () async {}, logic.loadUseRecordList(false);
child: widget.useRecordList.isNotEmpty },
onLoad: () async {
logic.loadUseRecordList(true);
},
child: useRecordList.isNotEmpty
? ListView.builder( ? ListView.builder(
itemCount: widget.useRecordList.length, itemCount: useRecordList.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return _recordKeyItem(widget.useRecordList[index]); return _recordKeyItem(useRecordList[index]);
}) })
: NoData(), : NoData(),
); );
});
} }
Widget _recordKeyItem(UseItemData itemData) { Widget _recordKeyItem(UseItemData itemData) {
return Container( return Container(
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h), margin: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h),
padding: padding: EdgeInsets.all(20.w),
EdgeInsets.only(left: 20.w, right: 20.w, top: 16.h, bottom: 16.h),
child: Column( child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row( Row(
children: [ children: <Widget>[
Text( Text(
'${itemData.lockName ?? ""} ${itemData.realName ?? ""}', '${itemData.lockName ?? ""} ${itemData.realName ?? ""}',
style: TextStyle( style: TextStyle(
@ -189,35 +176,22 @@ class _UseRecordsTableState extends State<_UseRecordsTable> {
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
Expanded(child: Container()), Expanded(child: Container()),
itemData.authStatus == 0 if (itemData.authStatus == 0)
? Container( Container(
padding: EdgeInsets.only( padding: EdgeInsets.symmetric(horizontal: 6.w, vertical: 2.h),
right: 6.w, left: 6.w, top: 2.h, bottom: 2.h),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.w), borderRadius: BorderRadius.circular(5.w),
color: AppColors.toBeReceiveBgColor, color: AppColors.toBeReceiveBgColor,
), ),
child: Text('失败', child: Text('失败',
style: TextStyle(fontSize: 16.sp, color: Colors.red)), style: TextStyle(fontSize: 16.sp, color: Colors.red)),
) ),
: Container()
], ],
), ),
SizedBox( SizedBox(height: 8.h),
height: 8.h, Text(itemData.useDate ?? '',
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
itemData.createdAt!.length > 10
? itemData.createdAt!.substring(0, 10)
: itemData.createdAt!,
textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor)) fontSize: 22.sp, color: AppColors.darkGrayTextColor)),
],
),
], ],
), ),
); );