feat: Limit height of text messages and expand if selected

This commit is contained in:
krille-chan 2025-05-21 19:24:15 +02:00
commit d4f1381a26
No known key found for this signature in database
3 changed files with 8 additions and 0 deletions

View file

@ -23,6 +23,7 @@ class HtmlMessage extends StatelessWidget {
final void Function(LinkableElement) onOpen; final void Function(LinkableElement) onOpen;
final String? eventId; final String? eventId;
final Set<Event>? checkboxCheckedEvents; final Set<Event>? checkboxCheckedEvents;
final bool limitHeight;
const HtmlMessage({ const HtmlMessage({
super.key, super.key,
@ -34,6 +35,7 @@ class HtmlMessage extends StatelessWidget {
required this.onOpen, required this.onOpen,
this.eventId, this.eventId,
this.checkboxCheckedEvents, this.checkboxCheckedEvents,
this.limitHeight = true,
}); });
/// Keep in sync with: https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes /// Keep in sync with: https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes
@ -513,6 +515,8 @@ class HtmlMessage extends StatelessWidget {
fontSize: fontSize, fontSize: fontSize,
color: textColor, color: textColor,
), ),
maxLines: limitHeight ? 64 : null,
overflow: TextOverflow.fade,
); );
} }
} }

View file

@ -418,6 +418,7 @@ class Message extends StatelessWidget {
onInfoTab: onInfoTab, onInfoTab: onInfoTab,
borderRadius: borderRadius, borderRadius: borderRadius,
timeline: timeline, timeline: timeline,
selected: selected,
), ),
if (event.hasAggregatedEvents( if (event.hasAggregatedEvents(
timeline, timeline,

View file

@ -30,6 +30,7 @@ class MessageContent extends StatelessWidget {
final void Function(Event)? onInfoTab; final void Function(Event)? onInfoTab;
final BorderRadius borderRadius; final BorderRadius borderRadius;
final Timeline timeline; final Timeline timeline;
final bool selected;
const MessageContent( const MessageContent(
this.event, { this.event, {
@ -39,6 +40,7 @@ class MessageContent extends StatelessWidget {
required this.textColor, required this.textColor,
required this.linkColor, required this.linkColor,
required this.borderRadius, required this.borderRadius,
required this.selected,
}); });
void _verifyOrRequestKey(BuildContext context) async { void _verifyOrRequestKey(BuildContext context) async {
@ -269,6 +271,7 @@ class MessageContent extends StatelessWidget {
textColor: textColor, textColor: textColor,
room: event.room, room: event.room,
fontSize: AppConfig.fontSizeFactor * AppConfig.messageFontSize, fontSize: AppConfig.fontSizeFactor * AppConfig.messageFontSize,
limitHeight: !selected,
linkStyle: TextStyle( linkStyle: TextStyle(
color: linkColor, color: linkColor,
fontSize: fontSize: