CatalogKeyboard class

The guest's keyboard: what the app asks for, what the host allows, and how tall the answer is.

Two facts arriving from opposite directions, which is the shape of the whole feature. The app's opinion comes up from the framework — a field took focus, so GuestTextInput.asking moved — and it knows nothing about which phone it is on. The measurement comes down from the host, which knows the device and cannot know when a field is focused. Neither half is a keyboard on its own.

The measurement travels over the VM service rather than with the window metrics, and that is forced rather than chosen: FlutterWindowMetricsEvent carries a size, a ratio and four insets, and the guest already spends the insets on the device's safe areas. A keyboard arriving on the same channel would be indistinguishable from a notch.

Which keyboard to draw is on neither wire: the host already stages the platform, so defaultTargetPlatform answers it — see CatalogKeyboardScope.

Properties

asked → KeyboardVariant?
What the app is asking for, or null when it is asking for nothing.
no setter
deviceHeight → double
The device's measured letters keyboard, in logical pixels, already turned the way the device is. Zero for a stage with no keyboard at all — a desktop window, and Fit, which is not a device and has no measurement to draw.
no setter
hashCode → int
The hash code for this object.
no setterinherited
height → double
What the screen actually loses. Zero on a stage with no measurement, so a forced-up keyboard on Fit raises nothing rather than inventing a height.
no setter
mode → KeyboardMode
no setter
requested → bool
Whether the app has asked for a keyboard, whatever mode then does with it.
no setter
revision → ValueNotifier<int>
Bumped whenever what is on screen would change, so CatalogKeyboardScope has something to rebuild on.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
state → KeyboardState
no setter
variant → KeyboardVariant
Which keyboard is drawn.
no setter

Methods

apply({KeyboardMode? mode, double? deviceHeight, double? deviceKeypadHeight, bool clearKeypad = false}) → bool
Applies what the host asked for. Returns whether anything moved.
install() → void
Starts following the framework's own signal. Call once, before runApp, and after GuestTextInput.install.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerExtensions() → void
Registers the extension. Call once, before runApp.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Properties

instance → CatalogKeyboard
final

Constants

eventKind → const String
The event the host listens for. Pushed rather than polled because the interesting transitions are the app's, and a host that had to ask would only ever find out about them a poll late — which for a control drawn over the keyboard band means drawn in the wrong place.