From 8d3210d4b335a58b94c50fa80491f26452758352 Mon Sep 17 00:00:00 2001 From: Todor Bachvarov Date: Thu, 27 Feb 2025 15:53:41 +0200 Subject: [PATCH] GroupDetailPanel fixed post max lines restriction [#4822] --- CHANGELOG.md | 2 ++ lib/ui/groups/GroupPostDetailPanel.dart | 9 +++++++-- lib/ui/groups/GroupWidgets.dart | 11 ++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09a9aa8e4..88e4b3fb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +### Fixed +- GroupDetailPanel fixed post max lines restriction [#4822](https://github.com/rokwire/illinois-app/issues/4822). ## [6.1.64] - 2025-02-20 ### Changed diff --git a/lib/ui/groups/GroupPostDetailPanel.dart b/lib/ui/groups/GroupPostDetailPanel.dart index 8fa7227a6..aa22750c4 100644 --- a/lib/ui/groups/GroupPostDetailPanel.dart +++ b/lib/ui/groups/GroupPostDetailPanel.dart @@ -257,8 +257,13 @@ class _GroupPostDetailPanelState extends State implements // onTapUrl : (url) {_onTapPostLink(url); return true;}, // textStyle: Styles().textStyles.getTextStyle("widget.detail.large"), // ) - GroupPostCard(post: _post, group: widget.group, isClickable: false, postReactions: widget.postReactions, - isAdmin: _post?.creator?.findAsMember(groupMembers: _allMembersAllowedToPost)?.isAdmin) + GroupPostCard( + post: _post, + group: widget.group, + isClickable: false, + displayMode: GroupPostCardDisplayMode.page, + postReactions: widget.postReactions, + isAdmin: _post?.creator?.findAsMember(groupMembers: _allMembersAllowedToPost)?.isAdmin) ), Visibility( visible: _isEditMainPost, diff --git a/lib/ui/groups/GroupWidgets.dart b/lib/ui/groups/GroupWidgets.dart index 46e26858d..b362c3eeb 100644 --- a/lib/ui/groups/GroupWidgets.dart +++ b/lib/ui/groups/GroupWidgets.dart @@ -1035,7 +1035,7 @@ class _GroupCardState extends State implements NotificationsListener ////////////////////////////////////// // GroupPostCard - +enum GroupPostCardDisplayMode { list, page } class GroupPostCard extends StatefulWidget { final Post? post; final List? postReactions; @@ -1043,12 +1043,13 @@ class GroupPostCard extends StatefulWidget { final bool? isAdmin; final bool? isClickable; final bool? pinned; + final GroupPostCardDisplayMode displayMode; // final Member? creator; // final StreamController? updateController; static const EdgeInsets contentHorizontalPadding = EdgeInsets.symmetric(horizontal: 12); - GroupPostCard({Key? key, required this.post, required this.group, this.isAdmin, this.isClickable = true, this.postReactions, this.pinned}) : + GroupPostCard({Key? key, required this.post, required this.group, this.isAdmin, this.isClickable = true, this.postReactions, this.pinned, this.displayMode = GroupPostCardDisplayMode.list}) : super(key: key); @override @@ -1120,7 +1121,7 @@ class _GroupPostCardState extends State { child: Column( children: [ HtmlWidget( - "
${StringUtils.ensureNotEmpty(htmlBody)}
", + "
${StringUtils.ensureNotEmpty(htmlBody)}
", onTapUrl : (url) {_onLinkTap(url); return true;}, textStyle: Styles().textStyles.getTextStyle("widget.card.title.small") ), @@ -1244,6 +1245,10 @@ class _GroupPostCardState extends State { } bool get _reactionsEnabled => false; + + String get _htmlStyle => widget.displayMode == GroupPostCardDisplayMode.list ? + "text-overflow:ellipsis;max-lines:3" : + "white-space: normal"; } //////////////////////////////////////