From 89710381935ea6089d606bd06373e95a1ef072d0 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Thu, 31 Mar 2022 20:27:58 +0800 Subject: [PATCH] fix bugs --- .../activity/activity_detail_page.dart | 30 +++++++++++-------- .../community_views/community_page.dart | 12 +++++--- .../topic/topic_search_page.dart | 10 +++++++ lib/widget/buttons/bottom_button.dart | 6 ++-- 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/lib/ui/community/activity/activity_detail_page.dart b/lib/ui/community/activity/activity_detail_page.dart index 53e2b512..01eeefb9 100644 --- a/lib/ui/community/activity/activity_detail_page.dart +++ b/lib/ui/community/activity/activity_detail_page.dart @@ -9,7 +9,6 @@ import 'package:aku_new_community/widget/bee_divider.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/buttons/bottom_button.dart'; import 'package:aku_new_community/widget/others/stack_avatar.dart'; -import 'package:bot_toast/bot_toast.dart'; import 'package:common_utils/common_utils.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -150,22 +149,27 @@ class _ActivityDetailPageState extends State { ), ), bottomNavi: BottomButton( - child: '立即报名'.text.size(32.sp).color(Colors.black).bold.make(), - onPressed: () async { - if (_model!.regisEndTime?.isBefore(DateTime.now()) ?? false) { - BotToast.showText(text: '报名时间已结束'); - return; - } - var re = await NetUtil().get(SAASAPI.activity.registration, - params: {'activityId': _model!.id}, showMessage: true); - if (re.success) { - _refreshController.callRefresh(); - } - }, + child: '立即报名'.text.size(32.sp).bold.make(), + onPressed: !canTap + ? null + : () async { + var re = await NetUtil().get(SAASAPI.activity.registration, + params: {'activityId': _model!.id}, showMessage: true); + if (re.success) { + _refreshController.callRefresh(); + } + }, ), ); } + bool get canTap { + if (_model?.regisEndTime?.isBefore(DateTime.now()) ?? true) { + return false; + } + return true; + } + Container _headWidget() { return Container( color: Colors.white, diff --git a/lib/ui/community/community_views/community_page.dart b/lib/ui/community/community_views/community_page.dart index 567414f4..88eede1d 100644 --- a/lib/ui/community/community_views/community_page.dart +++ b/lib/ui/community/community_views/community_page.dart @@ -15,6 +15,7 @@ import 'package:aku_new_community/ui/community/community_views/add_new_event_pag import 'package:aku_new_community/ui/community/community_views/my_community_view.dart'; import 'package:aku_new_community/ui/community/community_views/new_community_view.dart'; import 'package:aku_new_community/ui/community/community_views/topic/topic_community_view.dart'; +import 'package:aku_new_community/ui/community/community_views/topic/topic_detail_page.dart'; import 'package:aku_new_community/ui/community/community_views/widgets/chat_card.dart'; import 'package:aku_new_community/ui/home/public_infomation/public_infomation_card.dart'; import 'package:aku_new_community/ui/home/public_infomation/public_infomation_page.dart'; @@ -398,7 +399,7 @@ class _CommunityPageState extends State }, '全部'), ), 32.hb, - _searchHistoryWidget() + _newTopicListWidget() ], ), ); @@ -416,7 +417,7 @@ class _CommunityPageState extends State minWidth: double.infinity, color: Color(0xFFF3F3F3), onPressed: () { - //Get.to(() => SearchGoodsPage()); + // Get.to(() => TopicSearchPage()); }, child: Row( children: [ @@ -433,7 +434,8 @@ class _CommunityPageState extends State ); } - _searchHistoryWidget() { + ///新鲜话题列表 + _newTopicListWidget() { return Container( alignment: Alignment.centerLeft, padding: EdgeInsets.only(left: 32.w, right: 32.w), @@ -464,7 +466,9 @@ class _CommunityPageState extends State labelPadding: EdgeInsets.only(right: 12.w, left: 12.w), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, onSelected: (bool value) { - // Get.to(() => TopicDetailPage(model: item)); + Get.to(() => TopicDetailPage( + topicId: item.id, + )); }, label: Row( mainAxisSize: MainAxisSize.min, diff --git a/lib/ui/community/community_views/topic/topic_search_page.dart b/lib/ui/community/community_views/topic/topic_search_page.dart index 4770509b..d6e57bda 100644 --- a/lib/ui/community/community_views/topic/topic_search_page.dart +++ b/lib/ui/community/community_views/topic/topic_search_page.dart @@ -22,11 +22,13 @@ class TopicSearchPage extends StatefulWidget { class _TopicSearchPageState extends State { List _models = []; bool isHot = true; + TextEditingController _textEditingController = TextEditingController(); Future _getModels() async { var re = await NetUtil().get(SAASAPI.community.topicList, params: { 'pageNum': 1, 'size': 10, + 'title': _textEditingController.text }); if (re.success) { _models = (re.data['rows'] as List) @@ -42,6 +44,12 @@ class _TopicSearchPageState extends State { super.initState(); } + @override + void dispose() { + _textEditingController.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { var appbar = PreferredSize( @@ -80,6 +88,7 @@ class _TopicSearchPageState extends State { .get(SAASAPI.community.topicList, params: { 'pageNum': 1, 'size': 20, + 'title': _textEditingController.text, }); if (re.success) { _models = (re.data['rows'] as List) @@ -88,6 +97,7 @@ class _TopicSearchPageState extends State { setState(() {}); } }, + controller: _textEditingController, decoration: InputDecoration( border: InputBorder.none, contentPadding: EdgeInsets.zero, diff --git a/lib/widget/buttons/bottom_button.dart b/lib/widget/buttons/bottom_button.dart index de750211..420d8a62 100644 --- a/lib/widget/buttons/bottom_button.dart +++ b/lib/widget/buttons/bottom_button.dart @@ -1,9 +1,7 @@ +import 'package:aku_new_community/base/base_style.dart'; import 'package:flutter/material.dart'; - import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:aku_new_community/base/base_style.dart'; - class BottomButton extends StatelessWidget { final VoidCallback? onPressed; final Widget child; @@ -26,7 +24,7 @@ class BottomButton extends StatelessWidget { child: MaterialButton( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, disabledColor: Colors.white.withOpacity(0.5), - disabledTextColor: ktextSubColor.withOpacity(0.8), + disabledTextColor: ktextSubColor.withOpacity(0.4), textColor: textColor, child: child, onPressed: onPressed,