KeyboardWidget constructor

const KeyboardWidget({
  1. Key? key,
  2. required List<KeyAction> bindings,
  3. String? helpText,
  4. bool hasFocus = true,
  5. required Widget child,
  6. LogicalKeyboardKey showDismissKey = LogicalKeyboardKey.f1,
  7. int columnCount = 1,
  8. Color? backgroundColor,
  9. TextStyle? textStyle,
  10. bool showMap = false,
  11. VoidCallback? callbackOnHide,
})

Creates a new KeyboardWidget with a list of Keystrokes and associated functions bindings, a required child widget and an optional keystroke to show and dismiss the displayed map, showDismissKey.

The number of columns of text used to display the options can be optionally chosen. It defaults to one column.

The backgroundColor and textColor set the background of the card used to display the help screen background and text respectively. Otherwise they default to the inherited theme's card and primary text colors.

By default the F1 keyboard key is used to show and dismiss the keymap display. If another key is preferred, set the showDismissKey to another LogicalKeyboardKey.

If the help map should be displayed, set the parameter showMap to true. This lets the implementer programmatically show the map. You would usually pair this with a function callbackOnHide so that the caller to show the help screen can be notified when it is hidden

Implementation

const KeyboardWidget({
  Key? key,
  required this.bindings,
  this.helpText,
  this.hasFocus = true,
  required this.child,
  this.showDismissKey = LogicalKeyboardKey.f1,
  this.columnCount = 1,
  this.backgroundColor,
  this.textStyle,
  this.showMap = false,
  this.callbackOnHide,
})  : assert(columnCount > 0),
      super(key: key);