InputManager class

Orchestrates keyboard input routing between host app and palettes.

InputManager is the central coordinator that:

  • Tracks which entity (host or palette) has keyboard focus
  • Routes captured keys to focused palette AND any unfocused palettes that want them
  • Handles click-outside behavior

Example:

// Get the InputManager from PaletteHost
final inputManager = PaletteHost.instance.inputManager;

// Palette shows and takes focus
inputManager.registerPalette('slash-menu', InputBehavior.menu());
inputManager.setFocus(PaletteFocused('slash-menu'));

// Later, palette hides
inputManager.unregisterPalette('slash-menu');
inputManager.setFocus(HostFocused());

Constructors

InputManager(NativeBridge _bridge)
Create an InputManager with the given bridge.

Properties

focusedEntity FocusedEntity
Current focused entity.
no setter
focusedPaletteId String?
ID of the focused palette, or null if host is focused.
no setter
focusStream Stream<FocusedEntity>
Stream of focus changes.
no setter
hashCode int
The hash code for this object.
no setterinherited
isPaletteFocused bool
Whether a palette currently has focus.
no setter
keyEventStream Stream<(String, LogicalKeyboardKey, Set<LogicalKeyboardKey>)>
Stream of key events: (paletteId, key, modifiers).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
visiblePaletteIds Set<String>
Get all currently visible palette IDs.
no setter

Methods

clearShowGuard(String paletteId) → void
Explicitly clear the show guard for a palette.
dispose() → void
Dispose resources.
getBehavior(String id) InputBehavior?
Get the input behavior for a visible palette.
getVisibleInGroup(PaletteGroup group) Set<String>
Get all visible palettes in a specific exclusive group.
hideGroup(PaletteGroup group) Future<void>
Hide all palettes in an exclusive group.
isPaletteVisible(String id) bool
Check if a palette is currently registered as visible.
isShowBlocked(String paletteId) bool
Check if showing a palette is currently blocked by the show guard.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDismissRequested(void callback(String paletteId)) → void
Set callback for when a palette requests dismissal.
registerDismissCallback(String paletteId, void callback()) → void
Register a dismiss callback for a specific palette.
registerPalette(String id, InputBehavior behavior) Future<bool>
Register a visible palette with its input behavior.
setFocus(FocusedEntity entity, {FocusRestoreMode focusRestoreMode = FocusRestoreMode.mainWindow}) Future<void>
Set which entity has keyboard focus.
toString() String
A string representation of this object.
inherited
unregisterDismissCallback(String paletteId) → void
Unregister a dismiss callback for a specific palette.
unregisterPalette(String id) Future<void>
Unregister a palette when it becomes hidden.
updateBehavior(String id, InputBehavior behavior) Future<void>
Update the input behavior for a visible palette.

Operators

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