keyboardVariantForName function
The variant a field asking for name gets.
name and signed are the text input channel's own spelling — the
{name, signed, decimal} map that rides TextInput.setClient, which both
the previews guest and the scenario binding receive verbatim. Taking the
pair rather than a TextInputType is what lets one function serve both
without either lane translating first.
signed is the discriminator nobody expects. A plain number field and
a decimal one get iOS's keypad; the moment a minus sign is allowed the
platform gives the full punctuation keyboard at full height instead.
Measured on two phones, both agreeing.
Anything unrecognised is KeyboardVariant.letters, which is the shape most types have and the safe answer for a type this build has not heard of.
Implementation
KeyboardVariant keyboardVariantForName(String name, {bool signed = false}) =>
switch (name) {
'TextInputType.phone' => KeyboardVariant.keypad,
'TextInputType.number' when !signed => KeyboardVariant.keypad,
'TextInputType.emailAddress' => KeyboardVariant.email,
'TextInputType.url' => KeyboardVariant.url,
_ => KeyboardVariant.letters,
};