From 7fb1543eebdbadef7d5c1bb075f219fbe96a2298 Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Sat, 28 Mar 2026 21:09:37 +0530 Subject: [PATCH] feat: add context menu to conversations screen and simplify manage network UI component --- .../screens/agent_network_screen.dart | 24 +++------ .../screens/conversations_screen.dart | 52 +++++++++++++++---- 2 files changed, 49 insertions(+), 27 deletions(-) diff --git a/lib/features/agents/presentation/screens/agent_network_screen.dart b/lib/features/agents/presentation/screens/agent_network_screen.dart index 4d346c5..38253c6 100644 --- a/lib/features/agents/presentation/screens/agent_network_screen.dart +++ b/lib/features/agents/presentation/screens/agent_network_screen.dart @@ -151,22 +151,14 @@ class AgentNetworkScreen extends ConsumerWidget { width: 0.5), borderRadius: BorderRadius.circular(7), ), - child: Row( - children: [ - const Text( - 'Manage My Network', - style: TextStyle( - fontFamily: 'Fractul', - fontSize: 14, - fontWeight: FontWeight.w600, - color: AppColors.primaryDark, - ), - ), - const Spacer(), - Icon(Icons.arrow_forward, - size: 20, - color: AppColors.primaryDark.withValues(alpha: 0.7)), - ], + child: const Text( + 'Manage My Network', + style: TextStyle( + fontFamily: 'Fractul', + fontSize: 14, + fontWeight: FontWeight.w600, + color: AppColors.primaryDark, + ), ), ); } diff --git a/lib/features/messaging/presentation/screens/conversations_screen.dart b/lib/features/messaging/presentation/screens/conversations_screen.dart index df7f3e7..518192f 100644 --- a/lib/features/messaging/presentation/screens/conversations_screen.dart +++ b/lib/features/messaging/presentation/screens/conversations_screen.dart @@ -200,18 +200,48 @@ class _ConversationsScreenState extends ConsumerState { ), ), const SizedBox(width: 8), - // Three dots menu (outside the search box) - GestureDetector( - onTap: () {}, - behavior: HitTestBehavior.opaque, - child: const Padding( - padding: EdgeInsets.all(4), - child: Icon( - Icons.more_horiz, - size: 22, - color: AppColors.primaryDark, - ), + // Three dots menu + PopupMenuButton( + icon: const Icon( + Icons.more_horiz, + size: 22, + color: AppColors.primaryDark, ), + padding: EdgeInsets.zero, + onSelected: (value) { + switch (value) { + case 'mark_all_read': + final conversations = + ref.read(messagingProvider).conversations; + for (final c in conversations) { + if (c.unreadCount > 0) { + ref + .read(messagingProvider.notifier) + .markAsRead(c.id); + } + } + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text('All conversations marked as read')), + ); + break; + case 'refresh': + ref + .read(messagingProvider.notifier) + .loadConversations(); + break; + } + }, + itemBuilder: (_) => const [ + PopupMenuItem( + value: 'mark_all_read', + child: Text('Mark all as read'), + ), + PopupMenuItem( + value: 'refresh', + child: Text('Refresh'), + ), + ], ), ], ),