feat: Limit height of text messages and expand if selected
This commit is contained in:
parent
4739ea42fa
commit
d4f1381a26
3 changed files with 8 additions and 0 deletions
|
|
@ -23,6 +23,7 @@ class HtmlMessage extends StatelessWidget {
|
|||
final void Function(LinkableElement) onOpen;
|
||||
final String? eventId;
|
||||
final Set<Event>? checkboxCheckedEvents;
|
||||
final bool limitHeight;
|
||||
|
||||
const HtmlMessage({
|
||||
super.key,
|
||||
|
|
@ -34,6 +35,7 @@ class HtmlMessage extends StatelessWidget {
|
|||
required this.onOpen,
|
||||
this.eventId,
|
||||
this.checkboxCheckedEvents,
|
||||
this.limitHeight = true,
|
||||
});
|
||||
|
||||
/// Keep in sync with: https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes
|
||||
|
|
@ -513,6 +515,8 @@ class HtmlMessage extends StatelessWidget {
|
|||
fontSize: fontSize,
|
||||
color: textColor,
|
||||
),
|
||||
maxLines: limitHeight ? 64 : null,
|
||||
overflow: TextOverflow.fade,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -418,6 +418,7 @@ class Message extends StatelessWidget {
|
|||
onInfoTab: onInfoTab,
|
||||
borderRadius: borderRadius,
|
||||
timeline: timeline,
|
||||
selected: selected,
|
||||
),
|
||||
if (event.hasAggregatedEvents(
|
||||
timeline,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ class MessageContent extends StatelessWidget {
|
|||
final void Function(Event)? onInfoTab;
|
||||
final BorderRadius borderRadius;
|
||||
final Timeline timeline;
|
||||
final bool selected;
|
||||
|
||||
const MessageContent(
|
||||
this.event, {
|
||||
|
|
@ -39,6 +40,7 @@ class MessageContent extends StatelessWidget {
|
|||
required this.textColor,
|
||||
required this.linkColor,
|
||||
required this.borderRadius,
|
||||
required this.selected,
|
||||
});
|
||||
|
||||
void _verifyOrRequestKey(BuildContext context) async {
|
||||
|
|
@ -269,6 +271,7 @@ class MessageContent extends StatelessWidget {
|
|||
textColor: textColor,
|
||||
room: event.room,
|
||||
fontSize: AppConfig.fontSizeFactor * AppConfig.messageFontSize,
|
||||
limitHeight: !selected,
|
||||
linkStyle: TextStyle(
|
||||
color: linkColor,
|
||||
fontSize:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue