From ccdc83bd53dd70c9a0633c122259ca203becc552 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Thu, 4 Feb 2021 16:22:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A4=BE=E5=8C=BA=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E5=8A=A8=E6=80=81=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/api.dart | 2 ++ .../community_views/new_community_view.dart | 36 ++++++++++++++++++- .../community_views/widgets/chat_card.dart | 8 ++--- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/lib/constants/api.dart b/lib/constants/api.dart index ec2087f8..807db143 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -167,6 +167,8 @@ class _Community { String get topicList => '/user/gambit/list'; String get eventByTopicId => '/user/gambit/listByGambitId'; + + String get newEventList => '/user/gambit/list'; } class _Upload { diff --git a/lib/ui/community/community_views/new_community_view.dart b/lib/ui/community/community_views/new_community_view.dart index 626bfbf8..1b02a6ca 100644 --- a/lib/ui/community/community_views/new_community_view.dart +++ b/lib/ui/community/community_views/new_community_view.dart @@ -1,4 +1,9 @@ +import 'package:akuCommunity/constants/api.dart'; +import 'package:akuCommunity/model/community/event_item_model.dart'; +import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; +import 'package:akuCommunity/ui/community/community_views/widgets/chat_card.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; class NewCommunityView extends StatefulWidget { NewCommunityView({Key key}) : super(key: key); @@ -9,10 +14,39 @@ class NewCommunityView extends StatefulWidget { class _NewCommunityViewState extends State with AutomaticKeepAliveClientMixin { + EasyRefreshController _refreshController = EasyRefreshController(); + @override + void dispose() { + _refreshController?.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { super.build(context); - return Container(); + return BeeListView( + path: API.community.newEventList, + controller: _refreshController, + convert: (model) { + return model.tableList.map((e) => EventItemModel.fromJson(e)).toList(); + }, + builder: (items) { + return ListView.builder( + itemBuilder: (context, index) { + final item = items[index] as EventItemModel; + return ChatCard( + name: item.createName ?? '', + title: item.gambitTitle ?? '', + contentImg: item.imgUrls, + date: item.date, + id: item.id, + headImg: item.headSculptureImgUrl, + ); + }, + itemCount: items.length, + ); + }, + ); } @override diff --git a/lib/ui/community/community_views/widgets/chat_card.dart b/lib/ui/community/community_views/widgets/chat_card.dart index b1387436..e84de0aa 100644 --- a/lib/ui/community/community_views/widgets/chat_card.dart +++ b/lib/ui/community/community_views/widgets/chat_card.dart @@ -25,10 +25,10 @@ class ChatCard extends StatefulWidget { final int id; ChatCard({ Key key, - this.name, - this.title, - this.headImg, - this.contentImg, + @required this.name, + @required this.title, + @required this.headImg, + @required this.contentImg, @required this.date, this.initLike = false, @required this.id,