Fix some textOnly handling

This commit is contained in:
Henry Hiles 2026-05-26 20:04:09 -04:00
commit a150ef2ecf
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
2 changed files with 35 additions and 26 deletions

View file

@ -163,7 +163,7 @@ class EventRenderer extends ConsumerWidget {
if (child != null) ...[ if (child != null) ...[
if (textOnly) if (textOnly)
child child
else else ...[
GestureDetector( GestureDetector(
onSecondaryTapUp: contextMenuCallback, onSecondaryTapUp: contextMenuCallback,
onLongPressStart: contextMenuCallback, onLongPressStart: contextMenuCallback,
@ -173,22 +173,23 @@ class EventRenderer extends ConsumerWidget {
), ),
), ),
...[ ...[
if (event.content is! MessageContent) ReactionRow(event), if (event.content is! MessageContent) ReactionRow(event),
if (event.sendError != null && event.sendError != "not sent") if (event.sendError != null && event.sendError != "not sent")
Text( Text(
event.sendError!, event.sendError!,
style: theme.textTheme.labelSmall?.copyWith( style: theme.textTheme.labelSmall?.copyWith(
color: theme.colorScheme.error, color: theme.colorScheme.error,
),
), ),
].map(
(child) => Padding(
padding: EdgeInsetsGeometry.only(left: 4),
child: child,
), ),
].map(
(child) => Padding(
padding: EdgeInsetsGeometry.only(left: 4),
child: child,
), ),
), ],
] else if (textOnly) ] else if (textOnly)
Text("Unknown event type", style: errorStyle), Text("Unknown event type", style: errorStyle),
], ],

View file

@ -140,20 +140,28 @@ class MessageRenderer extends ConsumerWidget {
"Unable to decrypt event", "Unable to decrypt event",
style: errorStyle, style: errorStyle,
), ),
StickerContent(:final url, :final info) => StickerContent(:final body, :final url, :final info) =>
ConstrainedBox( textOnly
constraints: BoxConstraints.loose(Size.square(200)), ? Text(
child: MessageImage( body,
url.mxcToHttps( maxLines: maxLines,
ref.watch( overflow: TextOverflow.ellipsis,
ClientStateController.provider.select( )
(value) => value!.homeserverUrl!, : ConstrainedBox(
constraints: BoxConstraints.loose(
Size.square(200),
),
child: MessageImage(
url.mxcToHttps(
ref.watch(
ClientStateController.provider.select(
(value) => value!.homeserverUrl!,
),
),
),
info: info,
), ),
), ),
),
info: info,
),
),
// TODO: Handle locations // TODO: Handle locations
// LocationMessageContent(:final body , :final geoUri) => // LocationMessageContent(:final body , :final geoUri) =>
TextMessageContent( TextMessageContent(
@ -272,7 +280,7 @@ class MessageRenderer extends ConsumerWidget {
UrlPreview(link.url), UrlPreview(link.url),
SizedBox(height: 4), SizedBox(height: 4),
ReactionRow(event), if (!textOnly) ReactionRow(event),
], ],
], ],
), ),