From f77c959e4ad4f7183e2a6f298929cf28a622cd02 Mon Sep 17 00:00:00 2001 From: edouard Date: Sat, 24 Oct 2026 06:14:18 +0200 Subject: [PATCH] UI: Replace notification menu with toggle button in channel chat --- lib/screens/channel_chat_screen.dart | 58 ++++++---------------------- 1 file changed, 12 insertions(+), 46 deletions(-) diff --git a/lib/screens/channel_chat_screen.dart b/lib/screens/channel_chat_screen.dart index 647c5508..80818747 100644 --- a/lib/screens/channel_chat_screen.dart +++ b/lib/screens/channel_chat_screen.dart @@ -407,7 +407,7 @@ class _ChannelChatScreenState extends State { final notificationMode = settings.getChannelNotificationMode( muteKey, ); - return PopupMenuButton( + return IconButton( tooltip: context.l10n.channels_notificationSettings, icon: Icon( notificationMode == ChannelNotificationMode.muted @@ -416,52 +416,18 @@ class _ChannelChatScreenState extends State { ? Icons.notification_important : Icons.notifications, ), - onSelected: (mode) { - settings.setChannelNotificationMode(muteKey, mode); + onPressed: () { + final currentMode = settings.getChannelNotificationMode(muteKey); + ChannelNotificationMode newMode; + if (currentMode == ChannelNotificationMode.all) { + newMode = ChannelNotificationMode.mentionsOnly; + } else if (currentMode == ChannelNotificationMode.mentionsOnly) { + newMode = ChannelNotificationMode.muted; + } else { + newMode = ChannelNotificationMode.all; + } + settings.setChannelNotificationMode(muteKey, newMode); }, - itemBuilder: (context) => [ - PopupMenuItem( - value: ChannelNotificationMode.all, - child: Row( - children: [ - Icon( - Icons.notifications, - color: notificationMode == ChannelNotificationMode.all - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.onSurfaceVariant, - ), - const SizedBox(width: 8), - Text(context.l10n.channels_notifyAll), - ], - ), - ), - PopupMenuItem( - value: ChannelNotificationMode.mentionsOnly, - child: Row( - children: [ - const Icon(Icons.notification_important), - const SizedBox(width: 8), - Text(context.l10n.channels_notifyMentionsOnly), - ], - ), - ), - PopupMenuItem( - value: ChannelNotificationMode.muted, - child: Row( - children: [ - Icon( - Icons.notifications_off, - color: - notificationMode == ChannelNotificationMode.muted - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.onSurfaceVariant, - ), - const SizedBox(width: 8), - Text(context.l10n.channels_notifyNone), - ], - ), - ), - ], ); }, ),