From 3a38b1e2916d7ec2ee956661f3fdd513cb728dc8 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Thu, 24 Mar 2022 10:06:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E5=88=97=E8=A1=A8=E5=8F=82?= =?UTF-8?q?=E4=B8=8E=E4=BA=BA=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/models/home/home_activity_model.dart | 23 ++++++++++-- lib/models/home/home_activity_model.g.dart | 3 ++ .../work_order/work_order_detail_model.dart | 35 ++++++++++--------- .../work_order/work_order_detail_model.g.dart | 3 ++ lib/ui/community/activity/activity_card.dart | 5 +-- lib/ui/community/activity/activity_func.dart | 2 +- .../work_order/work_order_detail_page.dart | 2 +- lib/ui/market/search/good_detail_page.dart | 8 ++--- .../search/submit_order_page_normal.dart | 2 +- lib/widget/others/stack_avatar.dart | 2 +- 10 files changed, 57 insertions(+), 28 deletions(-) diff --git a/lib/models/home/home_activity_model.dart b/lib/models/home/home_activity_model.dart index 7febb34b..93bbe807 100644 --- a/lib/models/home/home_activity_model.dart +++ b/lib/models/home/home_activity_model.dart @@ -1,13 +1,14 @@ import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/model/common/img_model.dart'; import 'package:common_utils/common_utils.dart'; +import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; import 'package:json_annotation/json_annotation.dart'; part 'home_activity_model.g.dart'; @JsonSerializable() -class HomeActivityModel { +class HomeActivityModel extends Equatable { final int id; final String title; final int status; @@ -17,12 +18,15 @@ class HomeActivityModel { final String activityEndTime; final List? imgList; final int? registrationNum; + final List? avatarImgList; + factory HomeActivityModel.fromJson(Map json) => _$HomeActivityModelFromJson(json); DateTime? get begin => DateUtil.getDateTime(registrationStartTime); DateTime? get end => DateUtil.getDateTime(registrationEndTime); + String get statusString { switch (this.status) { case 1: @@ -53,6 +57,20 @@ class HomeActivityModel { } } + @override + List get props => [ + id, + title, + status, + registrationStartTime, + registrationEndTime, + activityStartTime, + activityEndTime, + imgList, + registrationNum, + avatarImgList, + ]; + const HomeActivityModel({ required this.id, required this.title, @@ -62,6 +80,7 @@ class HomeActivityModel { required this.activityStartTime, required this.activityEndTime, this.imgList, - this.registrationNum, + required this.registrationNum, + this.avatarImgList, }); } diff --git a/lib/models/home/home_activity_model.g.dart b/lib/models/home/home_activity_model.g.dart index cf1783e8..623fba25 100644 --- a/lib/models/home/home_activity_model.g.dart +++ b/lib/models/home/home_activity_model.g.dart @@ -19,4 +19,7 @@ HomeActivityModel _$HomeActivityModelFromJson(Map json) => ?.map((e) => ImgModel.fromJson(e as Map)) .toList(), registrationNum: json['registrationNum'] as int?, + avatarImgList: (json['avatarImgList'] as List?) + ?.map((e) => ImgModel.fromJson(e as Map)) + .toList(), ); diff --git a/lib/models/work_order/work_order_detail_model.dart b/lib/models/work_order/work_order_detail_model.dart index 92eca55f..37b98ec9 100644 --- a/lib/models/work_order/work_order_detail_model.dart +++ b/lib/models/work_order/work_order_detail_model.dart @@ -14,6 +14,7 @@ class WorkOrderDetailModel extends Equatable { final String reserveDate; final String content; final String createDate; + final List? imgList; final List? servicePersonnelImgList; final int newReportNum; final int? evaluateLevel; @@ -23,22 +24,6 @@ class WorkOrderDetailModel extends Equatable { factory WorkOrderDetailModel.fromJson(Map json) => _$WorkOrderDetailModelFromJson(json); - const WorkOrderDetailModel({ - required this.id, - required this.code, - required this.status, - required this.workOrderTypeName, - required this.reserveAddress, - required this.reserveDate, - required this.content, - required this.createDate, - this.servicePersonnelImgList, - required this.newReportNum, - this.evaluateLevel, - this.evaluateContent, - this.evaluateDate, - }); - @override List get props => [ id, @@ -54,5 +39,23 @@ class WorkOrderDetailModel extends Equatable { evaluateLevel, evaluateContent, evaluateDate, + imgList ]; + + const WorkOrderDetailModel({ + required this.id, + required this.code, + required this.status, + required this.workOrderTypeName, + required this.reserveAddress, + required this.reserveDate, + required this.content, + required this.createDate, + this.imgList, + this.servicePersonnelImgList, + required this.newReportNum, + this.evaluateLevel, + this.evaluateContent, + this.evaluateDate, + }); } diff --git a/lib/models/work_order/work_order_detail_model.g.dart b/lib/models/work_order/work_order_detail_model.g.dart index 6ba23bb3..e8dcb16d 100644 --- a/lib/models/work_order/work_order_detail_model.g.dart +++ b/lib/models/work_order/work_order_detail_model.g.dart @@ -17,6 +17,9 @@ WorkOrderDetailModel _$WorkOrderDetailModelFromJson( reserveDate: json['reserveDate'] as String, content: json['content'] as String, createDate: json['createDate'] as String, + imgList: (json['imgList'] as List?) + ?.map((e) => ImgModel.fromJson(e as Map)) + .toList(), servicePersonnelImgList: (json['servicePersonnelImgList'] as List?) ?.map((e) => ImgModel.fromJson(e as Map)) diff --git a/lib/ui/community/activity/activity_card.dart b/lib/ui/community/activity/activity_card.dart index 7f52e94f..5330b2f3 100644 --- a/lib/ui/community/activity/activity_card.dart +++ b/lib/ui/community/activity/activity_card.dart @@ -18,7 +18,7 @@ class ActivityCard extends StatelessWidget { this.home = false, }) : super(key: key); - bool get outdate => model!.end!.compareTo(DateTime.now()) == -1; + bool get outdate => ActivityFunc.dateCheck(model!.end) == ''; Widget build(BuildContext context) { return ConstrainedBox( @@ -109,7 +109,8 @@ class ActivityCard extends StatelessWidget { [ Flexible( child: AvatarsParticipate( - avatars: (model?.imgList?.map((e) => e.url).toList() ?? []), + avatars: + (model?.avatarImgList?.map((e) => e.url).toList() ?? []), pNum: model?.registrationNum ?? 0, hasIcon: false, ), diff --git a/lib/ui/community/activity/activity_func.dart b/lib/ui/community/activity/activity_func.dart index 00a3ee54..9521c6ea 100644 --- a/lib/ui/community/activity/activity_func.dart +++ b/lib/ui/community/activity/activity_func.dart @@ -5,7 +5,7 @@ class ActivityFunc { } var nowDate = DateTime.now(); if (date.isBefore(nowDate)) { - return '已结束'; + return ''; } else { var days = date.difference(nowDate).inDays; if (days > 0) { diff --git a/lib/ui/function_and_service/work_order/work_order_detail_page.dart b/lib/ui/function_and_service/work_order/work_order_detail_page.dart index 12901424..a9d363b4 100644 --- a/lib/ui/function_and_service/work_order/work_order_detail_page.dart +++ b/lib/ui/function_and_service/work_order/work_order_detail_page.dart @@ -429,7 +429,7 @@ class _WorkOrderDetailPageState extends State { .make(), 24.hb, BeeGridImageView( - urls: [], + urls: (_model!.imgList ?? []).map((e) => e.url).toList(), ), 24.hb, ], diff --git a/lib/ui/market/search/good_detail_page.dart b/lib/ui/market/search/good_detail_page.dart index 4b3e1a65..02846d74 100644 --- a/lib/ui/market/search/good_detail_page.dart +++ b/lib/ui/market/search/good_detail_page.dart @@ -257,7 +257,7 @@ class _GoodDetailPageState extends State { height: 100.w, width: double.infinity, child: Text( - (_goodDetail!.skuName ?? ''), + (_goodDetail!.skuName), style: TextStyle( fontSize: 36.sp, fontWeight: FontWeight.bold, @@ -266,7 +266,7 @@ class _GoodDetailPageState extends State { overflow: TextOverflow.ellipsis, ), ), - _getIcon(_goodDetail!.kind ?? 0), + _getIcon(_goodDetail!.kind), 24.hb, Row( crossAxisAlignment: CrossAxisAlignment.center, @@ -325,13 +325,13 @@ class _GoodDetailPageState extends State { height: 80.w, width: double.infinity, child: Text( - (_goodDetail!.skuName ?? ''), + (_goodDetail!.skuName), style: TextStyle(fontSize: 28.sp, color: ktextPrimary), maxLines: 2, overflow: TextOverflow.ellipsis, ), ), - _getIcon(_goodDetail!.kind ?? 0), + _getIcon(_goodDetail!.kind), Spacer(), Row( crossAxisAlignment: CrossAxisAlignment.center, diff --git a/lib/ui/market/search/submit_order_page_normal.dart b/lib/ui/market/search/submit_order_page_normal.dart index 77b3611d..77814120 100644 --- a/lib/ui/market/search/submit_order_page_normal.dart +++ b/lib/ui/market/search/submit_order_page_normal.dart @@ -439,7 +439,7 @@ class _SubmitOrderNormalPageState extends State { var top = RichText( text: TextSpan(children: [ WidgetSpan( - child: _getKindWd(model.kind ?? 0), + child: _getKindWd(model.kind), ), TextSpan( text: model.skuName, diff --git a/lib/widget/others/stack_avatar.dart b/lib/widget/others/stack_avatar.dart index 3e186509..8f921a4b 100644 --- a/lib/widget/others/stack_avatar.dart +++ b/lib/widget/others/stack_avatar.dart @@ -26,7 +26,7 @@ class StackAvatar extends StatelessWidget { decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(22.w + 2.w), - border: Border.all(color: Color(0xFF999999)), + // border: Border.all(color: Color(0xFF999999)), ), clipBehavior: Clip.antiAlias, child: BeeImageNetwork(