Remove flutter chat #26

Manually merged
Henry-Hiles merged 108 commits from remove-flutter-chat into main 2026-05-22 15:26:28 -04:00
2 changed files with 28 additions and 5 deletions
Showing only changes of commit f9b1960cf8 - Show all commits

support for m.emote msgtype

Henry Hiles 2026-05-19 11:23:38 -04:00
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -25,6 +25,13 @@ abstract class MessageContent extends Content with _$MessageContent {
String? formattedBody,
}) = NoticeMessageContent;
@FreezedUnionValue("m.emote")
factory MessageContent.emote({
required String body,
String? format,
String? formattedBody,
}) = EmoteMessageContent;
@FreezedUnionValue("m.image")
factory MessageContent.image({
required String body,

View file

@ -62,6 +62,11 @@ class RenderEvent extends ConsumerWidget {
children: getEventOptions!(event).toList(),
);
final textStyle = TextStyle(
fontSize: event.localContent?.bigEmoji == true ? 32 : null,
fontStyle: event.content is EmoteMessageContent ? FontStyle.italic : null,
);
if (event.redactedBy != null) return SizedBox.shrink();
final child = switch (event.content) {
@ -132,6 +137,11 @@ class RenderEvent extends ConsumerWidget {
:final formattedBody,
:final format,
) ||
EmoteMessageContent(
:final body,
:final formattedBody,
:final format,
) ||
ImageMessageContent(
:final body,
:final formattedBody,
@ -141,10 +151,7 @@ class RenderEvent extends ConsumerWidget {
children: [
format == "org.matrix.custom.html" && !textOnly
? Html(
textStyle:
event.localContent?.bigEmoji == true
? TextStyle(fontSize: 32)
: null,
textStyle: textStyle,
formattedBody!.replaceAllMapped(
RegExp(
"(<a\\b[^>]*>.*?<\\/a>)|(\\bhttps?:\\/\\/[^\\s<]+)",
@ -164,6 +171,7 @@ class RenderEvent extends ConsumerWidget {
),
)
: Linkify(
style: textStyle,
text: body,
maxLines: maxLines,
overflow: TextOverflow.ellipsis,
@ -263,7 +271,15 @@ class RenderEvent extends ConsumerWidget {
LinkPreview(link.url),
],
),
_ => Text("Unknown message type", style: errorStyle),
MessageContent(:final body) => Row(
spacing: 8,
mainAxisSize: MainAxisSize.min,
children: [
Text("Unknown message type:", style: errorStyle),
Text(body),
],
),
_ => throw Exception("This is impossible"),
},
],
),