KeyboardDisplay.fromActivator constructor

const KeyboardDisplay.fromActivator({
  1. Key? key,
  2. required ShortcutActivator activator,
  3. double? spacing,
})

Creates a KeyboardDisplay from a shortcut activator.

Automatically extracts the keyboard keys from the provided ShortcutActivator and displays them as styled key representations. This constructor is convenient when working with Flutter's shortcut system.

Parameters:

  • activator (ShortcutActivator, required): Shortcut to extract keys from
  • spacing (double?, optional): Gap between key displays

Example:

KeyboardDisplay.fromActivator(
  activator: SingleActivator(LogicalKeyboardKey.keyS, control: true),
  spacing: 4.0,
)

Implementation

const KeyboardDisplay.fromActivator({
  super.key,
  required ShortcutActivator activator,
  this.spacing,
})  : _keys = null,
      _activator = activator;