fix: render overflow using richtext instead of row

This commit is contained in:
Gordon Hayes
2022-11-17 16:55:45 +01:00
parent 6f0645d879
commit 48e7adaba0
2 changed files with 26 additions and 20 deletions
@@ -1,3 +1,7 @@
## Upcomming
🐞 Fixed
- Fix render overflow issue with `MessageSearchListTileTitle`. It now uses `Text.rich` instead of `Row`. Better default behaviour and allows `TextOverflow`.
## 5.1.0 ## 5.1.0
🐞 Fixed 🐞 Fixed
@@ -122,7 +122,8 @@ class StreamMessageSearchListTile extends StatelessWidget {
final title = this.title ?? final title = this.title ??
MessageSearchListTileTitle( MessageSearchListTileTitle(
messageResponse: messageResponse, messageResponse: messageResponse,
textStyle: channelPreviewTheme.titleStyle, textStyle: channelPreviewTheme.titleStyle
?.copyWith(overflow: TextOverflow.ellipsis),
); );
final subtitle = this.subtitle ?? final subtitle = this.subtitle ??
@@ -177,27 +178,28 @@ class MessageSearchListTileTitle extends StatelessWidget {
final channel = messageResponse.channel; final channel = messageResponse.channel;
final channelName = channel?.extraData['name']; final channelName = channel?.extraData['name'];
return Row( return Text.rich(
TextSpan(
children: [ children: [
Text( TextSpan(
user.id == StreamChat.of(context).currentUser?.id text: user.id == StreamChat.of(context).currentUser?.id
? context.translations.youText ? context.translations.youText
: user.name, : user.name,
style: textStyle,
), ),
if (channelName != null) ...[ if (channelName != null) ...[
Text( TextSpan(
' ${context.translations.inText} ', text: ' ${context.translations.inText} ',
style: textStyle?.copyWith( style: textStyle?.copyWith(
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
), ),
), ),
Text( TextSpan(
channelName as String, text: channelName as String,
style: textStyle,
), ),
], ],
], ],
),
style: textStyle,
); );
} }
} }