From 5655a770770c1413a5350b5478fd4f2426f9f03f Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Fri, 14 May 2021 17:48:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=B3=BB=E7=BB=9F=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=8E=A5=E5=8F=A3=20=E4=BF=AE=E5=A4=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/models/message/system_message_item_model.dart | 10 +++++++++- lib/ui/home/messages/system_message.dart | 2 +- lib/ui/home/messages/systen_message_card.dart | 14 ++++++++++---- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/models/message/system_message_item_model.dart b/lib/models/message/system_message_item_model.dart index ea8a53e..261911f 100644 --- a/lib/models/message/system_message_item_model.dart +++ b/lib/models/message/system_message_item_model.dart @@ -1,14 +1,18 @@ +import 'package:common_utils/common_utils.dart'; + class SystemMessageItemModel { int id; int type; int relationId; + String sendDate; - SystemMessageItemModel({this.id, this.type, this.relationId}); + SystemMessageItemModel({this.id, this.type, this.relationId, this.sendDate}); SystemMessageItemModel.fromJson(Map json) { id = json['id']; type = json['type']; relationId = json['relationId']; + sendDate = json['sendDate']; } Map toJson() { @@ -16,6 +20,10 @@ class SystemMessageItemModel { data['id'] = this.id; data['type'] = this.type; data['relationId'] = this.relationId; + data['sendDate'] = this.sendDate; return data; } + + String get sendDateString => + DateUtil.formatDateStr(this.sendDate, format: 'yyyy-MM-dd HH:mm'); } diff --git a/lib/ui/home/messages/system_message.dart b/lib/ui/home/messages/system_message.dart index 5a783c2..2653b98 100644 --- a/lib/ui/home/messages/system_message.dart +++ b/lib/ui/home/messages/system_message.dart @@ -35,7 +35,7 @@ class _SystemMessageState extends State { return ListView.separated( padding: EdgeInsets.symmetric(horizontal: 32.w), itemBuilder: (context, index) { - return SystemMessageCard(model: items[index]); + return SystemMessageCard(model: items[index],); }, separatorBuilder: (context, index) { return 10.w.heightBox; diff --git a/lib/ui/home/messages/systen_message_card.dart b/lib/ui/home/messages/systen_message_card.dart index 513eabe..778d014 100644 --- a/lib/ui/home/messages/systen_message_card.dart +++ b/lib/ui/home/messages/systen_message_card.dart @@ -2,17 +2,22 @@ import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/models/message/system_message_detail_model.dart'; import 'package:aku_community_manager/models/message/system_message_item_model.dart'; import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_page.dart'; import 'package:aku_community_manager/utils/network/base_model.dart'; import 'package:aku_community_manager/utils/network/net_util.dart'; import 'package:aku_ui/aku_ui.dart'; import 'package:flutter/material.dart'; +import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:shimmer/shimmer.dart'; class SystemMessageCard extends StatefulWidget { final SystemMessageItemModel model; - SystemMessageCard({Key key, this.model}) : super(key: key); + SystemMessageCard({ + Key key, + this.model, + }) : super(key: key); @override _SystemMessageCardState createState() => _SystemMessageCardState(); @@ -180,7 +185,7 @@ class _SystemMessageCardState extends State { alignment: Alignment.center, width: double.infinity, child: Text( - 'date', + widget.model.sendDate, style: TextStyle( color: AppStyle.minorTextColor, fontSize: 24.sp), ), @@ -292,11 +297,12 @@ class _SystemMessageCardState extends State { height: 1.w, ), AkuButton( - onPressed: () {}, + onPressed: () { + Get.to(() => BusinessAndFixPage()); + }, child: Container( height: 88.w, alignment: Alignment.center, - padding: EdgeInsets.only(left: 24.w), child: Row( children: [ Text(