Skip to content

Commit

Permalink
GroupDetailPanel fixed post max lines restriction [#4822]
Browse files Browse the repository at this point in the history
  • Loading branch information
TodorBachvarov committed Feb 27, 2025
1 parent 34baf13 commit 8d3210d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions lib/ui/groups/GroupPostDetailPanel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,13 @@ class _GroupPostDetailPanelState extends State<GroupPostDetailPanel> 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,
Expand Down
11 changes: 8 additions & 3 deletions lib/ui/groups/GroupWidgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1035,20 +1035,21 @@ class _GroupCardState extends State<GroupCard> implements NotificationsListener

//////////////////////////////////////
// GroupPostCard

enum GroupPostCardDisplayMode { list, page }
class GroupPostCard extends StatefulWidget {
final Post? post;
final List<Reaction>? postReactions;
final Group group;
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
Expand Down Expand Up @@ -1120,7 +1121,7 @@ class _GroupPostCardState extends State<GroupPostCard> {
child: Column(
children: [
HtmlWidget(
"<div style= text-overflow:ellipsis;max-lines:3> ${StringUtils.ensureNotEmpty(htmlBody)}</div>",
"<div style= $_htmlStyle> ${StringUtils.ensureNotEmpty(htmlBody)}</div>",
onTapUrl : (url) {_onLinkTap(url); return true;},
textStyle: Styles().textStyles.getTextStyle("widget.card.title.small")
),
Expand Down Expand Up @@ -1244,6 +1245,10 @@ class _GroupPostCardState extends State<GroupPostCard> {
}

bool get _reactionsEnabled => false;

String get _htmlStyle => widget.displayMode == GroupPostCardDisplayMode.list ?
"text-overflow:ellipsis;max-lines:3" :
"white-space: normal";
}

//////////////////////////////////////
Expand Down

0 comments on commit 8d3210d

Please sign in to comment.