fix: Limit message preview to one line (#1387)

pull/1593/head
ggurdin 10 months ago committed by GitHub
parent a6adf00094
commit 9826501c86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -71,6 +71,9 @@ class ChatListItemSubtitle extends StatelessWidget {
? snapshot.data!
: L10n.of(context).emptyChat,
style: style,
softWrap: false,
maxLines: 2,
overflow: TextOverflow.ellipsis,
);
},
);
@ -97,6 +100,9 @@ class ChatListItemSubtitle extends StatelessWidget {
messageAnalyticsEntry: analyticsEntry,
isSelected: null,
onClick: null,
softWrap: false,
maxLines: pangeaMessageEvent.room.notificationCount >= 1 ? 2 : 1,
overflow: TextOverflow.ellipsis,
);
}

@ -132,6 +132,10 @@ class MessageTextWidget extends StatelessWidget {
final bool Function(PangeaToken)? isSelected;
final void Function(TokenPosition tokenPosition)? onClick;
final bool? softWrap;
final int? maxLines;
final TextOverflow? overflow;
const MessageTextWidget({
super.key,
required this.pangeaMessageEvent,
@ -139,6 +143,9 @@ class MessageTextWidget extends StatelessWidget {
this.messageAnalyticsEntry,
this.isSelected,
this.onClick,
this.softWrap,
this.maxLines,
this.overflow,
});
@override
@ -156,10 +163,16 @@ class MessageTextWidget extends StatelessWidget {
return Text(
pangeaMessageEvent.messageDisplayText,
style: style,
softWrap: softWrap,
maxLines: maxLines,
overflow: overflow,
);
}
return RichText(
softWrap: softWrap ?? true,
maxLines: maxLines,
overflow: overflow ?? TextOverflow.clip,
text: TextSpan(
children:
tokenPositions.mapIndexed((int i, TokenPosition tokenPosition) {

Loading…
Cancel
Save