VirtualKeypad class
A customizable virtual on-screen keyboard widget.
Renders a software keyboard inside your app: QWERTY text, a numeric keypad or numpad, a phone dialer, or a custom PIN pad or OTP layout. Input keeps working on kiosk, POS, ATM, touchscreen, desktop, and embedded screens where the system keyboard is unavailable or unwanted.
Automatically integrates with VirtualKeypadScope to send input to the focused VirtualKeypadTextField. The keyboard automatically adapts its layout based on the focused text field's KeyboardType.
VirtualKeypadScope(
child: Column(
children: [
VirtualKeypadTextField(
controller: controller,
keyboardType: KeyboardType.emailAddress,
),
VirtualKeypad(), // Automatically shows email layout
],
),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- VirtualKeypad
Constructors
-
VirtualKeypad({Key? key, KeyboardType? type, TextInputAction? inputAction, double height = 280, double? width, VirtualKeypadTheme theme = VirtualKeypadTheme.light, KeyFeedback feedback = KeyFeedback.sound, void onKeyPressed(VirtualKey key)?, void onKeyPressedWithText(VirtualKey key, String? text)?, void onStandaloneInputAction(KeyAction action, String text)?, List<
String> ? availableLanguages, String? initialLanguage, ValueChanged<String> ? onLanguageChanged, KeyboardLayout? customLayout, bool enableEmojiKey = false, bool showEmojiKeyboardInitially = false, TextStyle? emojiTextStyle, EmojiFontBytesLoader? colorEmojiFontLoader, bool checkEmojiPlatformCompatibility = false, bool hideWhenUnfocused = false, bool standalone = false, ValueChanged<bool> ? onVisibilityChanged, Duration animationDuration = const Duration(milliseconds: 200), Curve animationCurve = Curves.easeInOut, VirtualKeypadKeyBuilder? keyBuilder, KeyShuffle keyShuffle = KeyShuffle.none, Listenable? shuffleTrigger}) -
Creates a virtual keyboard.
const
Properties
- animationCurve → Curve
-
Animation curve for show/hide transitions.
final
- animationDuration → Duration
-
Duration for show/hide animation when hideWhenUnfocused is true.
final
-
availableLanguages
→ List<
String> ? -
Ordered list of language codes that can be switched from the keyboard.
final
- checkEmojiPlatformCompatibility → bool
-
When true, emoji the platform cannot render are filtered out of the grid.
final
- colorEmojiFontLoader → EmojiFontBytesLoader?
-
Loads a color emoji font at runtime, replacing the bundled monochrome one.
final
- customLayout → KeyboardLayout?
-
Custom layout when type is KeyboardType.custom.
final
- emojiTextStyle → TextStyle?
-
Text style used to paint the emoji glyphs in the emoji page.
final
-
When true, the keyboard can be driven with a D-pad or remote control.
final
- enableEmojiKey → bool
-
When true, text-style keyboards expose an emoji page.
final
- feedback → KeyFeedback
-
Haptic and sound confirmation for each key press.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
Height of the keyboard in logical pixels.
final
- hideWhenUnfocused → bool
-
When true, hides the keyboard with animation when no text field is focused.
final
- initialLanguage → String?
-
Preferred initial language for the keyboard.
final
- inputAction → TextInputAction?
-
Override input action displayed on the enter/done key.
If null, uses the action from the focused text field.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyBuilder → VirtualKeypadKeyBuilder?
-
Draws the content of a key, overriding the default label or icon.
final
- keyShuffle → KeyShuffle
-
When the digit keys change position, for PIN and payment entry.
final
- onKeyPressed → void Function(VirtualKey key)?
-
Optional callback invoked when any key is pressed.
final
- onKeyPressedWithText → void Function(VirtualKey key, String? text)?
-
Optional callback invoked when any key is pressed, including the
inserted
text. The text is the character inserted for character keys (respecting shift/caps), ornullfor action keys.final -
onLanguageChanged
→ ValueChanged<
String> ? -
Called when the user selects a new language from the keyboard picker.
final
- onStandaloneInputAction → void Function(KeyAction action, String text)?
-
Called when a submit-style action key is pressed in standalone mode.
final
-
onVisibilityChanged
→ ValueChanged<
bool> ? -
Called when the keyboard's active visibility changes.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showEmojiKeyboardInitially → bool
-
When true, supported text layouts open on the emoji page by default.
final
- shuffleTrigger → Listenable?
-
Draws a fresh digit arrangement each time this fires.
final
- standalone → bool
-
When true, the keyboard works with any standard Flutter TextField or
TextFormField without requiring VirtualKeypadScope or
VirtualKeypadTextField.
final
- theme → VirtualKeypadTheme
-
Visual theme for the keyboard.
final
- type → KeyboardType?
-
Override keyboard type. If null, uses the type from the focused text field.
final
- width → double?
-
Width of the keyboard. Defaults to screen width if null.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< VirtualKeypad> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited