diff --git a/client/lib/app_shortcuts.dart b/client/lib/app_shortcuts.dart index 5c5b693b..3c11dd2c 100644 --- a/client/lib/app_shortcuts.dart +++ b/client/lib/app_shortcuts.dart @@ -37,6 +37,22 @@ class DeleteIntent extends Intent { const DeleteIntent(); } +class RenameIntent extends Intent { + const RenameIntent(); +} + +class NewFolderIntent extends Intent { + const NewFolderIntent(); +} + +class UploadFilesIntent extends Intent { + const UploadFilesIntent(); +} + +class UploadFolderIntent extends Intent { + const UploadFolderIntent(); +} + class NavUpIntent extends Intent { const NavUpIntent(); } @@ -55,5 +71,8 @@ Map getAppShortcuts() { SingleActivator(LogicalKeyboardKey.arrowUp, alt: true): NavUpIntent(), SingleActivator(LogicalKeyboardKey.enter): OpenIntent(), SingleActivator(LogicalKeyboardKey.delete): DeleteIntent(), + SingleActivator(LogicalKeyboardKey.keyN, control: true): NewFolderIntent(), + SingleActivator(LogicalKeyboardKey.keyU, control: true): UploadFilesIntent(), + SingleActivator(LogicalKeyboardKey.keyU, control: true, shift: true): UploadFolderIntent(), }; } diff --git a/client/lib/ui/folder/folder_contents_view.dart b/client/lib/ui/folder/folder_contents_view.dart index 1f2d0316..205d2eff 100644 --- a/client/lib/ui/folder/folder_contents_view.dart +++ b/client/lib/ui/folder/folder_contents_view.dart @@ -2,7 +2,6 @@ import 'dart:math'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:phylum/app.dart'; import 'package:phylum/app_shortcuts.dart'; import 'package:phylum/libphylum/actions/action_resource_delete.dart'; import 'package:phylum/libphylum/db/db.dart'; diff --git a/client/lib/ui/folder/folder_navigator_scaffold.dart b/client/lib/ui/folder/folder_navigator_scaffold.dart index 3c72c332..70ef892c 100644 --- a/client/lib/ui/folder/folder_navigator_scaffold.dart +++ b/client/lib/ui/folder/folder_navigator_scaffold.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_state_notifier/flutter_state_notifier.dart'; +import 'package:phylum/app_shortcuts.dart'; import 'package:phylum/ui/common/expandable_fab.dart'; import 'package:phylum/ui/folder/folder_heriarchy_view.dart'; import 'package:phylum/ui/folder/nav_list.dart'; @@ -32,35 +33,43 @@ class FolderScaffoldResponsive extends StatelessWidget { final nav = context.watch(); final folderId = nav.folderId; final expandedLayout = MediaQuery.of(context).size.width > 800; - return Scaffold( - appBar: expandedLayout ? null : AppBar(title: const Text('Phylum')), - drawer: expandedLayout ? null : const Drawer(child: NavList()), - floatingActionButton: expandedLayout - ? null - : ExpandableFab( - distance: 112, - children: [ - ActionButton( - icon: const Icon(Icons.create_new_folder), - onPressed: () async { - createDirectory(context, folderId); - }, - ), - ActionButton( - icon: const Icon(Icons.upload_file), - onPressed: () async { - pickAndUploadFiles(context, folderId); - }, - ), - ActionButton( - icon: const Icon(Icons.drive_folder_upload_outlined), - onPressed: () { - pickAndUploadDirectory(context, folderId); - }, - ), - ], - ), - body: expandedLayout ? buildExpandedBody(folderId) : buildContents(folderId), + return Actions( + actions: { + NewFolderIntent: CallbackAction(onInvoke: (intent) => createDirectory(context, folderId)), + UploadFilesIntent: CallbackAction(onInvoke: (intent) => pickAndUploadFiles(context, folderId)), + UploadFolderIntent: CallbackAction(onInvoke: (intent) => pickAndUploadDirectory(context, folderId)), + }, + child: Scaffold( + appBar: expandedLayout ? null : AppBar(title: const Text('Phylum')), + drawer: expandedLayout ? null : const Drawer(child: NavList()), + floatingActionButton: expandedLayout + ? null + : ExpandableFab( + distance: 112, + children: [ + ActionButton( + icon: const Icon(Icons.create_new_folder), + onPressed: () async { + createDirectory(context, folderId); + // Actions.maybeInvoke(context, const NewFolderIntent()); + }, + ), + ActionButton( + icon: const Icon(Icons.upload_file), + onPressed: () async { + pickAndUploadFiles(context, folderId); + }, + ), + ActionButton( + icon: const Icon(Icons.drive_folder_upload_outlined), + onPressed: () { + pickAndUploadDirectory(context, folderId); + }, + ), + ], + ), + body: expandedLayout ? buildExpandedBody(folderId) : buildContents(folderId), + ), ); } diff --git a/client/lib/util/dialogs.dart b/client/lib/util/dialogs.dart index f3c588ff..60ccd7d6 100644 --- a/client/lib/util/dialogs.dart +++ b/client/lib/util/dialogs.dart @@ -65,10 +65,11 @@ Future showAlertDialog( }, ), ElevatedButton( - child: Text(positiveText), + autofocus: true, onPressed: () { Navigator.of(context).pop(true); }, + child: Text(positiveText), ), ], ),