keyboardHeightFor function

double keyboardHeightFor(
  1. KeyboardVariant variant, {
  2. required double letters,
  3. double? keypad,
})

How tall the keyboard a field asked for variant is, on a screen whose letters keyboard is letters and whose digit pad is keypad.

Device.keyboardFor is this rule with a device's own numbers. It is out here for the previews guest, which is told the two numbers over the wire and never holds a Device — one rule for both, so they cannot drift.

Implementation

double keyboardHeightFor(
  KeyboardVariant variant, {
  required double letters,
  double? keypad,
}) => switch (variant) {
  KeyboardVariant.keypad => keypad ?? letters,
  // Email and URL are the *same* keyboard with two keys swapped in the
  // bottom row, on every device measured. They differ in the picture and not
  // in the height.
  _ => letters,
};