From aa403dedd880f49f3b12e1d9c7e55e8bea88eb62 Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Sat, 6 May 2023 04:19:53 +0200 Subject: [PATCH] Small issue fixed --- lib/screens/clients/active_client_tile.dart | 49 ++++++++++++--------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/lib/screens/clients/active_client_tile.dart b/lib/screens/clients/active_client_tile.dart index f9b598f..c3e55cf 100644 --- a/lib/screens/clients/active_client_tile.dart +++ b/lib/screens/clients/active_client_tile.dart @@ -25,6 +25,29 @@ class ActiveClientTile extends StatelessWidget { @override Widget build(BuildContext context) { + void openOptionsModal() { + showDialog( + context: context, + builder: (context) => OptionsModal( + options: [ + MenuOption( + title: AppLocalizations.of(context)!.copyClipboard, + icon: Icons.copy_rounded, + action: () { + copyToClipboard( + context: context, + value: client.name != '' + ? client.name! + : client.ip, + successMessage: AppLocalizations.of(context)!.copiedClipboard, + ); + }, + ) + ] + ), + ); + } + if (splitView == true) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 12), @@ -51,27 +74,10 @@ class ActiveClientTile extends StatelessWidget { child: InkWell( borderRadius: BorderRadius.circular(28), onTap: () => onTap(client), - onLongPress: () => showDialog( - context: context, - builder: (context) => OptionsModal( - options: [ - MenuOption( - title: AppLocalizations.of(context)!.copyClipboard, - icon: Icons.copy_rounded, - action: () { - copyToClipboard( - context: context, - value: client.name != '' - ? client.name! - : client.ip, - successMessage: AppLocalizations.of(context)!.copiedClipboard, - ); - Navigator.pop(context); - }, - ) - ] - ), - ), + onLongPress: () { + Navigator.pop(context); + openOptionsModal(); + }, child: Container( width: double.maxFinite, padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), @@ -155,6 +161,7 @@ class ActiveClientTile extends StatelessWidget { ), ), onTap: () => onTap(client), + onLongPress: openOptionsModal, ), ); }