diff --git a/lib/models/message/comment_message_item_model.dart b/lib/models/message/comment_message_item_model.dart new file mode 100644 index 0000000..f2dfaa5 --- /dev/null +++ b/lib/models/message/comment_message_item_model.dart @@ -0,0 +1,21 @@ +class CommentMessageItemModel { + int id; + int type; + int relationId; + + CommentMessageItemModel({this.id, this.type, this.relationId}); + + CommentMessageItemModel.fromJson(Map json) { + id = json['id']; + type = json['type']; + relationId = json['relationId']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['type'] = this.type; + data['relationId'] = this.relationId; + return data; + } +} diff --git a/lib/models/message/system_message_item_model.dart b/lib/models/message/system_message_item_model.dart new file mode 100644 index 0000000..ea8a53e --- /dev/null +++ b/lib/models/message/system_message_item_model.dart @@ -0,0 +1,21 @@ +class SystemMessageItemModel { + int id; + int type; + int relationId; + + SystemMessageItemModel({this.id, this.type, this.relationId}); + + SystemMessageItemModel.fromJson(Map json) { + id = json['id']; + type = json['type']; + relationId = json['relationId']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['type'] = this.type; + data['relationId'] = this.relationId; + return data; + } +} diff --git a/lib/ui/home/messages/comment_message.dart b/lib/ui/home/messages/comment_message.dart index 41fade7..c8e7913 100644 --- a/lib/ui/home/messages/comment_message.dart +++ b/lib/ui/home/messages/comment_message.dart @@ -1,8 +1,12 @@ // Flutter imports: +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/models/message/comment_message_item_model.dart'; +import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart'; import 'package:flutter/material.dart'; // Package imports: import 'package:aku_ui/common_widgets/aku_common_widgets.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; // Project imports: @@ -18,6 +22,7 @@ class CommentMessage extends StatefulWidget { } class _CommentMessageState extends State { + EasyRefreshController _refreshController = EasyRefreshController(); Widget _messageList( String date, String name, @@ -112,9 +117,7 @@ class _CommentMessageState extends State { ], ), SizedBox(height: 16.w), - Divider( - height: 1.w, - ), + Divider(height: 1.w), AkuButton( onPressed: () {}, child: Container( @@ -145,12 +148,18 @@ class _CommentMessageState extends State { Widget build(BuildContext context) { return AkuScaffold( title: '评论消息', - body: ListView( - padding: EdgeInsets.only(left: 32.w, right: 32.w, bottom: 40.w), - children: [ - _messageList('2020-10-23 10:00', '杨建', '四星'), - _messageList('2020-10-24 11:00', '刘能', '四星'), - ], + body: BeeListView( + controller: _refreshController, + path: API.message.commentList, + convert: (model) => model.tableList + .map((e) => CommentMessageItemModel.fromJson(e)) + .toList(), + builder: (items) { + return ListView( + padding: EdgeInsets.only(left: 32.w, right: 32.w, bottom: 40.w), + children: [], + ); + }, ), ); } diff --git a/lib/ui/home/messages/system_message.dart b/lib/ui/home/messages/system_message.dart index 6278aa3..d97ecbc 100644 --- a/lib/ui/home/messages/system_message.dart +++ b/lib/ui/home/messages/system_message.dart @@ -1,8 +1,12 @@ // Flutter imports: +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/models/message/system_message_item_model.dart'; +import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart'; import 'package:flutter/material.dart'; // Package imports: import 'package:aku_ui/aku_ui.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; // Project imports: @@ -19,6 +23,8 @@ class SystemMessage extends StatefulWidget { } class _SystemMessageState extends State { + EasyRefreshController _refreshController = EasyRefreshController(); + Widget _messageList(String date, String name, String phone, String area) { return Column( children: [ @@ -163,12 +169,18 @@ class _SystemMessageState extends State { Widget build(BuildContext context) { return AkuScaffold( title: '系统消息', - body: ListView( - padding: EdgeInsets.only(left: 32.w, right: 32.w, bottom: 40.w), - children: [ - _messageList('2020-10-23 10:00', '杨建', '17867665666', '共区'), - _messageList('2020-10-22 10:00', '刘能', '17855823545', '共区'), - ], + body: BeeListView( + controller: _refreshController, + builder: (items) { + return ListView( + padding: EdgeInsets.only(left: 32.w, right: 32.w, bottom: 40.w), + children: [], + ); + }, + path: API.message.systemList, + convert: (model) => model.tableList + .map((e) => SystemMessageItemModel.fromJson(e)) + .toList(), ), ); } diff --git a/lib/ui/widgets/common/bee_list_view.dart b/lib/ui/widgets/common/bee_list_view.dart index 3eb7287..24ef301 100644 --- a/lib/ui/widgets/common/bee_list_view.dart +++ b/lib/ui/widgets/common/bee_list_view.dart @@ -1,4 +1,5 @@ // Flutter imports: +import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/utils/network/base_list_model.dart'; import 'package:aku_community_manager/utils/network/net_util.dart'; import 'package:flutter/material.dart'; @@ -6,7 +7,6 @@ import 'package:flutter/material.dart'; // Package imports: import 'package:flutter_easyrefresh/easy_refresh.dart'; - /// ## BeeListView ///```dart ///BeeListView( @@ -90,7 +90,9 @@ class _BeeListViewState extends State { Widget build(BuildContext context) { return EasyRefresh( controller: widget.controller, - header: MaterialHeader(), + header: MaterialHeader( + valueColor: AlwaysStoppedAnimation(AppStyle.primaryColor), + ), footer: MaterialFooter(), onRefresh: () async { _pageNum = 1;