mirror of
https://codeberg.org/shroff/phylum.git
synced 2026-01-05 11:10:47 -06:00
[client] More keyboard shortcuts: new folder, upload files and folders
This commit is contained in:
@@ -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<ShortcutActivator, Intent> 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(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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<FolderNavigatorState>();
|
||||
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<NewFolderIntent>(onInvoke: (intent) => createDirectory(context, folderId)),
|
||||
UploadFilesIntent: CallbackAction<UploadFilesIntent>(onInvoke: (intent) => pickAndUploadFiles(context, folderId)),
|
||||
UploadFolderIntent: CallbackAction<UploadFolderIntent>(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),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,10 +65,11 @@ Future<bool?> showAlertDialog(
|
||||
},
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text(positiveText),
|
||||
autofocus: true,
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
child: Text(positiveText),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user