From f34c2a92c31841cc7d1ae8b8ecec08c5f6ba7963 Mon Sep 17 00:00:00 2001 From: Eric Poulsen Date: Sat, 13 Jun 2026 19:22:16 -0700 Subject: [PATCH] Add onSecondaryTap to MeshCard and fix right-click on message text bubbles --- lib/screens/channels_screen.dart | 20 +++++++++----------- lib/screens/discovery_screen.dart | 10 +++------- lib/widgets/mesh_ui.dart | 3 +++ 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index 94bbd65e..8a6b990a 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -429,16 +429,15 @@ class _ChannelsScreenState extends State channelMessageStore, channel, ), - child: GestureDetector( - onSecondaryTapUp: PlatformInfo.isDesktop - ? (_) => _showChannelActions( - this.context, - connector, - channelMessageStore, - channel, - ) - : null, - child: Row( + onSecondaryTap: PlatformInfo.isDesktop + ? () => _showChannelActions( + this.context, + connector, + channelMessageStore, + channel, + ) + : null, + child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ // Leading avatar with optional community badge @@ -566,7 +565,6 @@ class _ChannelsScreenState extends State ], ), ), - ), ); } diff --git a/lib/screens/discovery_screen.dart b/lib/screens/discovery_screen.dart index 415562c3..4a782d6f 100644 --- a/lib/screens/discovery_screen.dart +++ b/lib/screens/discovery_screen.dart @@ -147,13 +147,6 @@ class _DiscoveryScreenState extends State { connector, index, ); - if (PlatformInfo.isDesktop) { - return GestureDetector( - onSecondaryTapUp: (_) => - _showContactContextMenu(contact, connector), - child: tile, - ); - } return tile; }, ), @@ -204,6 +197,9 @@ class _DiscoveryScreenState extends State { } }, onLongPress: () => _showContactContextMenu(contact, connector), + onSecondaryTap: PlatformInfo.isDesktop + ? () => _showContactContextMenu(contact, connector) + : null, padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), child: Row( children: [ diff --git a/lib/widgets/mesh_ui.dart b/lib/widgets/mesh_ui.dart index 797af7a7..cb4698bb 100644 --- a/lib/widgets/mesh_ui.dart +++ b/lib/widgets/mesh_ui.dart @@ -50,6 +50,7 @@ class MeshCard extends StatelessWidget { final Widget child; final VoidCallback? onTap; final VoidCallback? onLongPress; + final VoidCallback? onSecondaryTap; final EdgeInsetsGeometry padding; final EdgeInsetsGeometry margin; final Color? color; @@ -61,6 +62,7 @@ class MeshCard extends StatelessWidget { required this.child, this.onTap, this.onLongPress, + this.onSecondaryTap, this.padding = const EdgeInsets.all(14), this.margin = const EdgeInsets.symmetric(horizontal: 16, vertical: 4), this.color, @@ -89,6 +91,7 @@ class MeshCard extends StatelessWidget { HapticFeedback.selectionClick(); onLongPress!(); }, + onSecondaryTap: onSecondaryTap, child: Padding(padding: padding, child: child), ), ),