From 7e31df2bca7ae1d3fae8dd25cd25aead4a52edd9 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Thu, 4 Feb 2021 19:06:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=9D=E9=A2=98=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E7=9A=84=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/api.dart | 2 +- .../community/community_topic_model.dart | 151 +++--------------- .../topic/topic_community_view.dart | 6 +- .../topic/topic_detail_page.dart | 1 - lib/widget/picker/bee_image_preview.dart | 13 +- 5 files changed, 33 insertions(+), 140 deletions(-) diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 410233be..e6247362 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -164,7 +164,7 @@ class _Community { String get boardDetail => '/user/announcement/findById'; ///社区话题:查询最新的所有主题信息 - String get topicList => '/user/gambit/list'; + String get topicList => '/user/gambit/listGambit'; String get eventByTopicId => '/user/gambit/listByGambitId'; diff --git a/lib/model/community/community_topic_model.dart b/lib/model/community/community_topic_model.dart index cc029304..798521e0 100644 --- a/lib/model/community/community_topic_model.dart +++ b/lib/model/community/community_topic_model.dart @@ -2,153 +2,52 @@ import 'package:akuCommunity/model/common/img_model.dart'; class CommunityTopicModel { int id; - int createId; - int isComment; - int isLike; - String createName; + String title; + String summary; String content; - String gambitTitle; - String createDate; - List likeNames; - List imgUrls; - List headSculptureImgUrl; - List gambitThemeCommentVoList; + List imgUrl; + int activityNum; String get firstImg { - var firstImg = ''; - if (imgUrls?.isNotEmpty ?? false) { - firstImg = imgUrls?.first?.url ?? ''; - } - return firstImg; + if (imgUrl.isEmpty) + return ''; + else + return imgUrl.first.url; } CommunityTopicModel( {this.id, - this.createId, - this.isComment, - this.isLike, - this.createName, + this.title, + this.summary, this.content, - this.gambitTitle, - this.createDate, - this.likeNames, - this.imgUrls, - this.headSculptureImgUrl, - this.gambitThemeCommentVoList}); + this.imgUrl, + this.activityNum}); CommunityTopicModel.fromJson(Map json) { id = json['id']; - createId = json['createId']; - isComment = json['isComment']; - isLike = json['isLike']; - createName = json['createName']; + title = json['title']; + summary = json['summary']; content = json['content']; - gambitTitle = json['gambitTitle']; - createDate = json['createDate']; - if (json['likeNames'] != null) { - likeNames = new List(); - json['likeNames'].forEach((v) { - likeNames.add(new LikeNames.fromJson(v)); - }); - } - if (json['imgUrls'] != null) { - imgUrls = new List(); - json['imgUrls'].forEach((v) { - imgUrls.add(new ImgModel.fromJson(v)); + if (json['imgUrl'] != null) { + imgUrl = new List(); + json['imgUrl'].forEach((v) { + imgUrl.add(new ImgModel.fromJson(v)); }); } else - imgUrls = []; - if (json['headSculptureImgUrl'] != null) { - headSculptureImgUrl = new List(); - json['headSculptureImgUrl'].forEach((v) { - headSculptureImgUrl.add(new ImgModel.fromJson(v)); - }); - } else - headSculptureImgUrl = []; - if (json['gambitThemeCommentVoList'] != null) { - gambitThemeCommentVoList = new List(); - json['gambitThemeCommentVoList'].forEach((v) { - gambitThemeCommentVoList.add(new GambitThemeCommentVoList.fromJson(v)); - }); - } + imgUrl = []; + activityNum = json['activityNum']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; - data['createId'] = this.createId; - data['isComment'] = this.isComment; - data['isLike'] = this.isLike; - data['createName'] = this.createName; + data['title'] = this.title; + data['summary'] = this.summary; data['content'] = this.content; - data['gambitTitle'] = this.gambitTitle; - data['createDate'] = this.createDate; - if (this.likeNames != null) { - data['likeNames'] = this.likeNames.map((v) => v.toJson()).toList(); - } - if (this.imgUrls != null) { - data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); - } - if (this.headSculptureImgUrl != null) { - data['headSculptureImgUrl'] = - this.headSculptureImgUrl.map((v) => v.toJson()).toList(); + if (this.imgUrl != null) { + data['imgUrl'] = this.imgUrl.map((v) => v.toJson()).toList(); } - if (this.gambitThemeCommentVoList != null) { - data['gambitThemeCommentVoList'] = - this.gambitThemeCommentVoList.map((v) => v.toJson()).toList(); - } - return data; - } -} - -class LikeNames { - int id; - String name; - - LikeNames({this.id, this.name}); - - LikeNames.fromJson(Map json) { - id = json['id']; - name = json['name']; - } - - Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; - return data; - } -} - -class GambitThemeCommentVoList { - int id; - String parentName; - String content; - String createName; - String createDate; - - GambitThemeCommentVoList( - {this.id, - this.parentName, - this.content, - this.createName, - this.createDate}); - - GambitThemeCommentVoList.fromJson(Map json) { - id = json['id']; - parentName = json['parentName']; - content = json['content']; - createName = json['createName']; - createDate = json['createDate']; - } - - Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['parentName'] = this.parentName; - data['content'] = this.content; - data['createName'] = this.createName; - data['createDate'] = this.createDate; + data['activityNum'] = this.activityNum; return data; } } diff --git a/lib/ui/community/community_views/topic/topic_community_view.dart b/lib/ui/community/community_views/topic/topic_community_view.dart index 22a08746..c1902612 100644 --- a/lib/ui/community/community_views/topic/topic_community_view.dart +++ b/lib/ui/community/community_views/topic/topic_community_view.dart @@ -56,9 +56,7 @@ class _TopicCommunityViewState extends State ), child: BackdropFilter( filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), - //TODO 等待后端接口补充话题摘要 - // model.summary - child: ('#${''}') + child: ('#${model.summary}') .text .center .size(28.sp) @@ -76,7 +74,7 @@ class _TopicCommunityViewState extends State Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - (model?.gambitTitle ?? '') + (model?.title ?? '') .text .maxLines(2) .size(28.sp) diff --git a/lib/ui/community/community_views/topic/topic_detail_page.dart b/lib/ui/community/community_views/topic/topic_detail_page.dart index 4958529c..02a318a8 100644 --- a/lib/ui/community/community_views/topic/topic_detail_page.dart +++ b/lib/ui/community/community_views/topic/topic_detail_page.dart @@ -4,7 +4,6 @@ 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/topic/topic_sliver_header.dart'; import 'package:akuCommunity/ui/community/community_views/widgets/chat_card.dart'; -import 'package:akuCommunity/utils/headers.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; diff --git a/lib/widget/picker/bee_image_preview.dart b/lib/widget/picker/bee_image_preview.dart index 3c70c36b..4ad8561e 100644 --- a/lib/widget/picker/bee_image_preview.dart +++ b/lib/widget/picker/bee_image_preview.dart @@ -50,14 +50,11 @@ class _BeeImagePreviewState extends State { onTap: Get.back, child: Scaffold( backgroundColor: Colors.black54, - body: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), - child: InteractiveViewer( - boundaryMargin: EdgeInsets.all(48), - minScale: 0.2, - maxScale: 10, - child: Center(child: image), - ), + body: InteractiveViewer( + boundaryMargin: EdgeInsets.all(48), + minScale: 0.2, + maxScale: 10, + child: Center(child: image), ), ), );