From 5a52083f576237d0317d1d90f2e0ca482530f290 Mon Sep 17 00:00:00 2001 From: Dain Nilsson Date: Thu, 9 Jun 2022 12:29:51 +0200 Subject: [PATCH] Use CMD as modifier on MacOS instead of CTRL. --- lib/oath/views/account_dialog.dart | 3 ++- lib/oath/views/account_view.dart | 5 ++++- lib/oath/views/oath_screen.dart | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/oath/views/account_dialog.dart b/lib/oath/views/account_dialog.dart index 82ac5cbb..84be21ec 100755 --- a/lib/oath/views/account_dialog.dart +++ b/lib/oath/views/account_dialog.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -104,7 +105,7 @@ class AccountDialog extends ConsumerWidget with AccountMixin { autofocus: true, onKey: (node, event) { if (event is RawKeyDownEvent && - event.isControlPressed && + (Platform.isMacOS ? event.isMetaPressed : event.isControlPressed) && event.logicalKey == LogicalKeyboardKey.keyC) { copyToClipboard(context, ref); return KeyEventResult.handled; diff --git a/lib/oath/views/account_view.dart b/lib/oath/views/account_view.dart index 0f6fcee0..a57c304c 100755 --- a/lib/oath/views/account_view.dart +++ b/lib/oath/views/account_view.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -109,7 +110,9 @@ class AccountView extends ConsumerWidget with AccountMixin { return Focus( onKey: (node, event) { if (event is RawKeyDownEvent && - event.isControlPressed && + (Platform.isMacOS + ? event.isMetaPressed + : event.isControlPressed) && event.logicalKey == LogicalKeyboardKey.keyC) { triggerCopy(); return KeyEventResult.handled; diff --git a/lib/oath/views/oath_screen.dart b/lib/oath/views/oath_screen.dart index c76dafcb..04867b86 100755 --- a/lib/oath/views/oath_screen.dart +++ b/lib/oath/views/oath_screen.dart @@ -138,7 +138,7 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> { onKey: (node, event) { //TODO: Use Shortcuts, Intents, Actions if (event is RawKeyDownEvent && - event.isControlPressed && + (Platform.isMacOS ? event.isMetaPressed : event.isControlPressed) && event.logicalKey == LogicalKeyboardKey.keyF) { searchController.selection = TextSelection( baseOffset: 0, extentOffset: searchController.text.length);