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
3 changed files with 194 additions and 162 deletions
Showing only changes of commit c9b5b3dda8 - Show all commits

various fixes

Henry Hiles 2026-05-18 14:30:44 -04:00
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -21,8 +21,8 @@ class UserController extends AsyncNotifier<MembershipContent> {
),
);
if (member?.content is MembershipContent) {
return member!.content as MembershipContent;
if (member?.content case final MembershipContent content) {
return content;
}
final profile = await ref.watch(ProfileController.provider(userId).future);

View file

@ -2,6 +2,7 @@ import "package:fast_immutable_collections/fast_immutable_collections.dart";
import "package:flutter/material.dart";
import "package:flutter_riverpod/flutter_riverpod.dart";
import "package:nexus/controllers/client_state_controller.dart";
import "package:nexus/helpers/extensions/show_context_menu.dart";
import "package:nexus/helpers/launch_helper.dart";
import "package:nexus/models/content/avatar.dart";
import "package:nexus/models/content/content.dart";
@ -35,6 +36,7 @@ class EventText extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final theme = Theme.of(context);
final colorScheme = theme.colorScheme;
final errorStyle = TextStyle(color: colorScheme.error);
final timestamp = Tooltip(
message: event.timestamp.toString(),
@ -43,8 +45,17 @@ class EventText extends ConsumerWidget {
style: theme.textTheme.labelSmall?.copyWith(color: Colors.grey),
),
);
final contextMenuCallback = getEventOptions == null
? null
: (details) => context.showContextMenu(
globalPosition: details.globalPosition,
children: getEventOptions!(event).toList(),
);
return switch (event.content) {
return GestureDetector(
onSecondaryTapUp: contextMenuCallback,
onLongPressStart: contextMenuCallback,
child: switch (event.content) {
MessageContent() => Row(
spacing: 8,
children: [
@ -67,7 +78,10 @@ class EventText extends ConsumerWidget {
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(8)),
child: Container(
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 12),
padding: EdgeInsets.symmetric(
vertical: 8,
horizontal: 12,
),
decoration: BoxDecoration(
color:
ref.watch(
@ -90,7 +104,7 @@ class EventText extends ConsumerWidget {
switch (event.content) {
Content(:final parseError?) => SelectableText(
"An error occurred while parsing this message:\n$parseError",
style: TextStyle(color: colorScheme.error),
style: errorStyle,
),
TextMessageContent(
:final body,
@ -99,10 +113,12 @@ class EventText extends ConsumerWidget {
) =>
Column(
children: [
format == "org.matrix.custom.html"
format == "org.matrix.custom.html" &&
!textOnly
? Html(
textStyle:
event.localContent?.bigEmoji == true
event.localContent?.bigEmoji ==
true
? TextStyle(fontSize: 32)
: null,
formattedBody!.replaceAllMapped(
@ -125,6 +141,7 @@ class EventText extends ConsumerWidget {
)
: Linkify(
text: body,
maxLines: maxLines,
options: LinkifyOptions(
humanize: false,
),
@ -149,7 +166,13 @@ class EventText extends ConsumerWidget {
LinkPreview(link),
],
),
_ => SizedBox.shrink(),
_ =>
textOnly
? Text(
"Unknown message type",
style: errorStyle,
)
: SizedBox.shrink(),
},
],
),
@ -175,8 +198,12 @@ class EventText extends ConsumerWidget {
Text("changed the room avatar"),
],
),
_ => Text("AAAAA"),
};
_ =>
textOnly
? Text("Unknown event type", style: errorStyle)
: SizedBox.shrink(),
},
);
}
}

View file

@ -99,13 +99,17 @@ class RoomChat extends HookConsumerWidget {
),
))
PopupMenuItem(
enabled: false,
child: IconTheme(
data: theme.iconTheme,
child: Row(
children: [
...{
...ref.watch(
AccountDataController.provider.select(
(value) => IList(
value["m.recent_emoji"]?.content["recent_emoji"] ??
value["m.recent_emoji"]
?.content["recent_emoji"] ??
[],
).map((entry) => entry["emoji"]),
),
@ -137,6 +141,7 @@ class RoomChat extends HookConsumerWidget {
],
),
),
),
if (ref.watch(
PowerLevelController.provider(
PowerLevelConfig(eventType: EventType.message),