From 289b78849c70f398dd8f17f148af33b1a953f1a0 Mon Sep 17 00:00:00 2001 From: datang Date: Thu, 5 May 2022 15:45:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BE=E5=8C=BA=E6=B4=BB=E5=8A=A8=E6=8A=A5?= =?UTF-8?q?=E5=90=8D=E6=8C=89=E9=92=AE=E7=8A=B6=E6=80=81=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=EF=BC=9B=E7=A4=BE=E5=8C=BA=E8=AF=9D=E9=A2=98=E7=82=B9=E8=B5=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ui/community/activity/activity_detail_page.dart | 12 +++++++++++- .../community/community_views/widgets/chat_card.dart | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/ui/community/activity/activity_detail_page.dart b/lib/ui/community/activity/activity_detail_page.dart index b077444c..3e5c4dce 100644 --- a/lib/ui/community/activity/activity_detail_page.dart +++ b/lib/ui/community/activity/activity_detail_page.dart @@ -152,7 +152,7 @@ class _ActivityDetailPageState extends State { ), ), bottomNavi: BottomButton( - child: '立即报名'.text.size(32.sp).bold.make(), + child: btnText, onPressed: !canTap ? null : () async { @@ -166,6 +166,16 @@ class _ActivityDetailPageState extends State { ); } + Widget get btnText{ + if (_model?.regisEndTime?.isBefore(DateTime.now()) ?? true) { + return '报名截止'.text.size(32.sp).bold.make(); + }else if(_model!.isRegistration==1){ + return '已报名'.text.size(32.sp).bold.make(); + }else{ + return '立即报名'.text.size(32.sp).bold.make(); + } + } + bool get canTap { if ((_model?.regisEndTime?.isBefore(DateTime.now()) ?? true) ||_model!.isRegistration==1) { return false; diff --git a/lib/ui/community/community_views/widgets/chat_card.dart b/lib/ui/community/community_views/widgets/chat_card.dart index 1d4b96b4..609115e2 100644 --- a/lib/ui/community/community_views/widgets/chat_card.dart +++ b/lib/ui/community/community_views/widgets/chat_card.dart @@ -174,6 +174,13 @@ class _ChatCardState extends State { super.initState(); } + @override + void didUpdateWidget(covariant ChatCard oldWidget) { + _isLiked = widget.model.isLike; + _likeNum = widget.model.likes; + super.didUpdateWidget(oldWidget); + } + @override Widget build(BuildContext context) { return DecoratedBox(