From 35ebf378496769fe256f0111f4250d3c7a8f6bd6 Mon Sep 17 00:00:00 2001 From: Prateek Sunal Date: Sat, 23 Mar 2024 18:25:52 +0530 Subject: [PATCH] fix: open action pane on right click --- auth/lib/ui/code_widget.dart | 79 ++++++++++++++++--------- auth/macos/Podfile.lock | 4 +- desktop/thirdparty/next-electron-server | 1 + 3 files changed, 55 insertions(+), 29 deletions(-) create mode 160000 desktop/thirdparty/next-electron-server diff --git a/auth/lib/ui/code_widget.dart b/auth/lib/ui/code_widget.dart index 999fa0781..0a74ad1ce 100644 --- a/auth/lib/ui/code_widget.dart +++ b/auth/lib/ui/code_widget.dart @@ -17,6 +17,7 @@ import 'package:ente_auth/utils/dialog_util.dart'; import 'package:ente_auth/utils/platform_util.dart'; import 'package:ente_auth/utils/toast_util.dart'; import 'package:ente_auth/utils/totp_util.dart'; +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:logging/logging.dart'; @@ -134,35 +135,59 @@ class _CodeWidgetState extends State { ), ], ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8), - child: Container( - color: Theme.of(context).colorScheme.codeCardBackgroundColor, - child: Material( - color: Colors.transparent, - child: InkWell( - customBorder: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + child: Builder( + builder: (context) { + return RawGestureDetector( + gestures: { + PanGestureRecognizer: + GestureRecognizerFactoryWithHandlers( + () => PanGestureRecognizer( + debugOwner: this, + // This recognizer accepts any button press made with a secondary button. + allowedButtonsFilter: (int buttons) => + buttons & kSecondaryButton != 0, + ), + (PanGestureRecognizer instance) { + instance + ..dragStartBehavior = DragStartBehavior.down + ..onEnd = (DragEndDetails details) { + Slidable.of(context)?.openEndActionPane(); + }; + }, + ), + }, + child: ClipRRect( + borderRadius: BorderRadius.circular(8), + child: Container( + color: Theme.of(context).colorScheme.codeCardBackgroundColor, + child: Material( + color: Colors.transparent, + child: InkWell( + customBorder: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + onTap: () { + _copyCurrentOTPToClipboard(); + }, + onDoubleTap: isMaskingEnabled + ? () { + setState( + () { + _hideCode = !_hideCode; + }, + ); + } + : null, + onLongPress: () { + _copyCurrentOTPToClipboard(); + }, + child: _getCardContents(l10n), + ), + ), ), - onTap: () { - _copyCurrentOTPToClipboard(); - }, - onDoubleTap: isMaskingEnabled - ? () { - setState( - () { - _hideCode = !_hideCode; - }, - ); - } - : null, - onLongPress: () { - _copyCurrentOTPToClipboard(); - }, - child: _getCardContents(l10n), ), - ), - ), + ); + }, ), ), ); diff --git a/auth/macos/Podfile.lock b/auth/macos/Podfile.lock index 1bb7c4b38..2467d732d 100644 --- a/auth/macos/Podfile.lock +++ b/auth/macos/Podfile.lock @@ -43,7 +43,7 @@ PODS: - FlutterMacOS - smart_auth (0.0.1): - FlutterMacOS - - sodium_libs (2.2.0): + - sodium_libs (2.2.1): - FlutterMacOS - sqflite (0.0.3): - Flutter @@ -168,7 +168,7 @@ SPEC CHECKSUMS: share_plus: 76dd39142738f7a68dd57b05093b5e8193f220f7 shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 smart_auth: b38e3ab4bfe089eacb1e233aca1a2340f96c28e9 - sodium_libs: 72d908a356801223ec77444e67844b3fe87d996a + sodium_libs: d39bd76697736cb11ce4a0be73b9b4bc64466d6f sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec sqlite3: 73b7fc691fdc43277614250e04d183740cb15078 sqlite3_flutter_libs: 06a05802529659a272beac4ee1350bfec294f386 diff --git a/desktop/thirdparty/next-electron-server b/desktop/thirdparty/next-electron-server new file mode 160000 index 000000000..a88030295 --- /dev/null +++ b/desktop/thirdparty/next-electron-server @@ -0,0 +1 @@ +Subproject commit a88030295c89dd8f43d9e3a45025678d95c78a45