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,