chore: Move emote settings button to chat popup menu

This commit is contained in:
Christian Kußowski 2025-09-25 14:47:42 +02:00
commit 524a63e1d6
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
4 changed files with 130 additions and 32 deletions

View file

@ -10,7 +10,7 @@ import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.
import 'package:fluffychat/widgets/future_loading_dialog.dart';
import 'matrix.dart';
enum ChatPopupMenuActions { details, mute, unmute, leave, search }
enum ChatPopupMenuActions { details, mute, unmute, emote, leave, search }
class ChatSettingsPopupMenu extends StatefulWidget {
final Room room;
@ -31,6 +31,20 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
super.dispose();
}
void goToEmoteSettings() async {
final room = widget.room;
// okay, we need to test if there are any emote state events other than the default one
// if so, we need to be directed to a selection screen for which pack we want to look at
// otherwise, we just open the normal one.
if ((room.states['im.ponies.room_emotes'] ?? <String, Event>{})
.keys
.any((String s) => s.isNotEmpty)) {
context.push('/rooms/${room.id}/details/multiple_emotes');
} else {
context.push('/rooms/${room.id}/details/emotes');
}
}
@override
Widget build(BuildContext context) {
notificationChangeSub ??= Matrix.of(context)
@ -95,6 +109,8 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
case ChatPopupMenuActions.search:
context.go('/rooms/${widget.room.id}/search');
break;
case ChatPopupMenuActions.emote:
goToEmoteSettings();
}
},
itemBuilder: (BuildContext context) => [
@ -141,6 +157,16 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
],
),
),
PopupMenuItem<ChatPopupMenuActions>(
value: ChatPopupMenuActions.emote,
child: Row(
children: [
const Icon(Icons.emoji_emotions_outlined),
const SizedBox(width: 12),
Text(L10n.of(context).emoteSettings),
],
),
),
PopupMenuItem<ChatPopupMenuActions>(
value: ChatPopupMenuActions.leave,
child: Row(