use a widget for edited

This commit is contained in:
Henry Hiles 2026-01-10 10:21:28 -05:00
commit a1c7349b3b
No known key found for this signature in database
2 changed files with 17 additions and 9 deletions

View file

@ -142,8 +142,6 @@ class Html extends ConsumerWidget {
"data-mx-bg-color" => MapEntry("background-color", value), "data-mx-bg-color" => MapEntry("background-color", value),
"edited" => MapEntry("display", "block"),
_ => null, _ => null,
}, },
) )

View file

@ -244,8 +244,12 @@ class RoomChat extends HookConsumerWidget {
required bool isSentByMe, required bool isSentByMe,
MessageGroupStatus? groupStatus, MessageGroupStatus? groupStatus,
}) => FlyerChatTextMessage( }) => FlyerChatTextMessage(
customWidget: Html( customWidget: Column(
(message.metadata?["formatted"] crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Html(
(message.metadata?["formatted"]
as String) as String)
.replaceAllMapped( .replaceAllMapped(
RegExp( RegExp(
@ -264,11 +268,17 @@ class RoomChat extends HookConsumerWidget {
return "<a href=\"$url\">$url</a>"; return "<a href=\"$url\">$url</a>";
}, },
) )
.replaceAll("\n", "<br/>") + .replaceAll("\n", "<br/>"),
((message.editedAt != null) client: room.roomData.client,
? "<sub edited>(edited)</sub>" ),
: ""), if (message.editedAt != null)
client: room.roomData.client, Text(
"(edited)",
style: theme
.textTheme
.labelSmall,
),
],
), ),
topWidget: TopWidget( topWidget: TopWidget(
message, message,