VirtualKeyboardInput class

A widget that provides a text input field with a custom virtual keyboard.

This widget is a wrapper around TextFormField that integrates with a specialized virtual keyboard. It provides all the functionality of a standard TextFormField while offering a custom input experience.

The virtual keyboard is automatically displayed when this input field gains focus, providing a consistent and controllable input method across different platforms and devices.

Usage of this widget is similar to TextFormField, with the added benefit of the custom virtual keyboard integration.

This widget is particularly useful in scenarios where you want to ensure a consistent keyboard experience across different devices or when you need to provide a specialized input method.

Most properties of TextFormField are available in this widget, allowing for extensive customization of the input field's appearance and behavior.

See also:

Inheritance

Constructors

VirtualKeyboardInput({Key? key, TextEditingController? inputController, FocusNode? focusNode, InputDecoration? decoration = const InputDecoration(), TextInputAction? textInputAction, TextCapitalization textCapitalization = TextCapitalization.none, TextStyle? style, StrutStyle? strutStyle, TextAlign textAlign = TextAlign.start, TextAlignVertical? textAlignVertical, TextDirection? textDirection, bool readOnly = false, bool? showCursor, bool autofocus = false, bool obscureText = false, bool autocorrect = true, SmartDashesType? smartDashesType, SmartQuotesType? smartQuotesType, bool enableSuggestions = true, int? maxLines = 1, int? minLines, bool expands = false, int? maxLength, MaxLengthEnforcement? maxLengthEnforcement, ValueChanged<String>? onChanged, VoidCallback? onEditingComplete, ValueChanged<String>? onSubmitted, List<TextInputFormatter>? inputFormatters, bool? enabled, double cursorWidth = 2.0, double? cursorHeight, Radius? cursorRadius, Color? cursorColor, Brightness? keyboardAppearance, EdgeInsets scrollPadding = const EdgeInsets.all(20.0), bool enableInteractiveSelection = true, TextSelectionControls? selectionControls, ScrollPhysics? scrollPhysics, Iterable<String>? autofillHints, AutovalidateMode? autovalidateMode, String? restorationId, bool enableIMEPersonalizedLearning = true, MouseCursor? mouseCursor, InputCounterWidgetBuilder? buildCounter, ScrollController? scrollController, String? initialValue, FormFieldValidator<String>? validator, FormFieldSetter<String>? onSaved})

Properties

autocorrect bool
Whether to enable autocorrection.
final
autofillHints Iterable<String>?
List of auto fill hints.
final
autofocus bool
Whether this text field should focus itself if nothing else is already focused.
final
autovalidateMode AutovalidateMode?
Used to enable/disable auto validation and to control its behavior.
final
buildCounter InputCounterWidgetBuilder?
Builds the widget to show under the input for the current character/word count.
final
cursorColor Color?
The color to use when painting the cursor.
final
cursorHeight double?
How tall the cursor will be.
final
cursorRadius Radius?
How rounded the corners of the cursor should be.
final
cursorWidth double
How thick the cursor will be.
final
decoration InputDecoration?
The decoration to show around the text field.
final
enabled bool?
If null, this widget is considered enabled.
final
enableIMEPersonalizedLearning bool
Whether to enable updating the text via IME personalized learning.
final
enableInteractiveSelection bool
Whether to enable user interface affordances for changing the text selection.
final
enableSuggestions bool
Whether to show input suggestions.
final
expands bool
Whether the input field can expand to fill its parent.
final
focusNode FocusNode?
Defines the keyboard focus for this widget.
final
hashCode int
The hash code for this object.
no setterinherited
initialValue String?
The initial value of the text field.
final
inputController TextEditingController
The controller for the text being edited.
final
inputFormatters List<TextInputFormatter>?
Optional input validation and formatting overrides.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardAppearance Brightness?
The appearance of the keyboard.
final
maxLength int?
The maximum number of characters (Unicode scalar values) to allow in the text field.
final
maxLengthEnforcement MaxLengthEnforcement?
How to enforce the text length limit.
final
maxLines int?
The maximum number of lines for the text to span, wrapping if necessary.
final
minLines int?
The minimum number of lines to occupy when the content spans fewer lines.
final
mouseCursor MouseCursor?
The cursor for a mouse pointer when it enters or is hovering over the widget.
final
obscureText bool
Whether to hide the text being edited (e.g., for passwords).
final
onChanged ValueChanged<String>?
Called when the user initiates a change to the TextField's value.
final
onEditingComplete VoidCallback?
Called when the user submits editable content (e.g., user presses the "done" button on the keyboard).
final
onSaved FormFieldSetter<String>?
An optional method to call with the final value when the form is saved via FormState.save.
final
onSubmitted ValueChanged<String>?
Called when the user indicates that they are done editing the text in the field.
final
readOnly bool
Whether the text can be changed.
final
restorationId String?
Restoration ID to save and restore the state of the text field.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollController ScrollController
Controls the scrolling of the input field.
final
scrollPadding EdgeInsets
Configures padding to edges of the container while scrolling.
final
scrollPhysics ScrollPhysics?
The physics to be used in the scrollable.
final
selectionControls TextSelectionControls?
Optional delegate for building the text selection handles and toolbar.
final
showCursor bool?
Whether to show cursor.
final
smartDashesType SmartDashesType?
The configuration of smart dashes.
final
smartQuotesType SmartQuotesType?
The configuration of smart quotes.
final
strutStyle StrutStyle?
Defines the strut style used for the vertical layout of the text.
final
style TextStyle?
The style to use for the text being edited.
final
textAlign TextAlign
How the text should be aligned horizontally.
final
textAlignVertical TextAlignVertical?
How the text should be aligned vertically.
final
textCapitalization TextCapitalization
Configures how the platform keyboard will select an uppercase or lowercase keyboard.
final
textDirection TextDirection?
The directionality of the text.
final
textInputAction TextInputAction?
The type of action button to use for the keyboard.
final
validator FormFieldValidator<String>?
An optional method that validates an input. Returns an error string to display if the input is invalid, or null otherwise.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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