NodeFlowShortcutManager<T> class

Manages keyboard shortcuts and action execution.

The shortcut manager maintains:

  • Registered actions that can be executed
  • Keyboard shortcut mappings to action IDs
  • Methods for handling keyboard events
  • Action search and categorization

Built-in shortcuts follow platform conventions:

  • Cmd/Ctrl for primary modifier
  • Shift for variations
  • Common key bindings (Cmd+A for select all, Delete for delete, etc.)

Example usage:

// Create manager and register actions
final manager = NodeFlowShortcutManager<MyData>();
manager.registerActions(DefaultNodeFlowActions.createDefaultActions());

// Handle keyboard events
KeyboardListener(
  onKeyEvent: (event) {
    manager.handleKeyEvent(event, controller, context);
  },
  child: ...,
);

// Custom shortcut
manager.setShortcut(
  LogicalKeySet(LogicalKeyboardKey.keyQ, LogicalKeyboardKey.meta),
  'my_custom_action',
);

// Search actions
final results = manager.searchActions('select');

Constructors

NodeFlowShortcutManager({Map<LogicalKeySet, String>? customShortcuts})
Creates a shortcut manager with optional custom shortcuts.

Properties

actions Map<String, NodeFlowAction<T>>
Gets all registered actions for UI display.
no setter
hashCode int
The hash code for this object.
no setterinherited
keyMap Map<LogicalKeySet, String>
Gets the shortcuts map for UI display.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shortcuts Map<LogicalKeySet, String>
Gets all current keyboard shortcuts.
no setter

Methods

getAction(String actionId) NodeFlowAction<T>?
Finds an action by its ID.
getActionsByCategory() Map<String, List<NodeFlowAction<T>>>
Gets all registered actions grouped by category.
getShortcutForAction(String actionId) LogicalKeySet?
Gets the keyboard shortcut for an action.
handleKeyEvent(KeyEvent event, NodeFlowController<T> controller, BuildContext? context) bool
Handles keyboard events and executes matching actions.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerAction(NodeFlowAction<T> action) → void
Registers a single action.
registerActions(List<NodeFlowAction<T>> actions) → void
Registers multiple actions at once.
removeShortcut(LogicalKeySet keySet) → void
Removes a keyboard shortcut.
searchActions(String query) List<NodeFlowAction<T>>
Searches for actions matching a query string.
setShortcut(LogicalKeySet keySet, String actionId) → void
Sets or updates a keyboard shortcut.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited