diff --git a/lib/widgets/context_menu/context_menu_entry.dart b/lib/widgets/context_menu/context_menu_entry.dart index 5f7578b..c89059c 100644 --- a/lib/widgets/context_menu/context_menu_entry.dart +++ b/lib/widgets/context_menu/context_menu_entry.dart @@ -35,7 +35,7 @@ abstract class BaseContextMenuEntry extends PopupMenuEntry { /// [ContextSubMenuEntry] is a [PopupMenuEntry] that displays a base menu entry. class ContextMenuEntry extends BaseContextMenuEntry { /// A tap with a primary button has occurred. - final VoidCallback onTap; + final VoidCallback? onTap; /// Optional content to display keysequence after the title. /// Typically a [Text] widget. @@ -44,7 +44,7 @@ class ContextMenuEntry extends BaseContextMenuEntry { const ContextMenuEntry({ required String id, required Widget title, - required this.onTap, + this.onTap, Widget? leading, this.shortcut, bool enabled = true, @@ -71,7 +71,7 @@ class _ContextMenuEntryState extends State { onTap: widget.enabled ? () { Navigator.pop(context); - widget.onTap.call(); + widget.onTap?.call(); } : null, child: Container( diff --git a/lib/widgets/entity_context_menu.dart b/lib/widgets/entity_context_menu.dart index 6c57340..106ea82 100644 --- a/lib/widgets/entity_context_menu.dart +++ b/lib/widgets/entity_context_menu.dart @@ -27,13 +27,13 @@ class EntityContextMenu extends StatelessWidget { ContextMenuEntry( id: 'open', title: const Text("Open"), - onTap: () => onOpen?.call(), + onTap: onOpen, shortcut: const Text("Return"), ), ContextMenuEntry( id: 'open_with', title: const Text("Open with other application"), - onTap: () => onOpenWith?.call(), + onTap: onOpenWith, enabled: false, ), const ContextMenuDivider(), @@ -41,21 +41,21 @@ class EntityContextMenu extends StatelessWidget { id: 'copy', leading: const Icon(Icons.file_copy_outlined), title: const Text("Copy file"), - onTap: () => onCopy?.call(), + onTap: onCopy, shortcut: const Text("Ctrl+C"), ), ContextMenuEntry( id: 'cut', leading: const Icon(Icons.cut_outlined), title: const Text("Cut file"), - onTap: () => onCut?.call(), + onTap: onCut, shortcut: const Text("Ctrl+X"), ), ContextMenuEntry( id: 'paste', leading: const Icon(Icons.paste_outlined), title: const Text("Paste file"), - onTap: () => onPaste?.call(), + onTap: onPaste, shortcut: const Text("Ctrl+V"), ) ], diff --git a/lib/widgets/grid.dart b/lib/widgets/grid.dart index af05048..3ac408b 100644 --- a/lib/widgets/grid.dart +++ b/lib/widgets/grid.dart @@ -104,12 +104,12 @@ class FileCell extends StatelessWidget { borderRadius: BorderRadius.circular(4), ), child: InkWell( - onTap: () => onTap?.call(), + onTap: onTap, onDoubleTap: () { onTap?.call(); onDoubleTap?.call(); }, - onLongPress: () => onLongTap?.call(), + onLongPress: onLongTap, child: EntityContextMenu( onOpen: () { onTap?.call();