AdaptiveCommandInput class
An adaptive, platform-aware search input for mobile and desktop Command menus.
Automatically switches between iOS/macOS Cupertino conventions (Cupertino text field, selection handles and magnifier) and Android/Material conventions (Material text field and theme typography).
Features built-in:
- Native text editing engine with selection magnifier and clipboard actions
- Mobile touch target sizing (default 44px min height)
- Adaptive filled/unfilled styling with system fill colors
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- AdaptiveCommandInput
Constructors
-
AdaptiveCommandInput({Key? key, TextEditingController? controller, FocusNode? focusNode, bool autofocus = true, String placeholder = 'Search...', Widget? placeholderWidget, TextStyle? style, TextStyle? placeholderStyle, Color? cursorColor, double? cursorWidth, double? cursorHeight, Radius? cursorRadius, bool? cursorOpacityAnimates, bool? showCursor, ValueChanged<
String> ? onValueChange, EdgeInsetsGeometry? padding, Decoration? decoration, bool filled = false, Color? fillColor, BorderRadius? borderRadius, Widget? prefix, Widget? suffix, FocusOnKeyEventCallback? onKeyEvent, CommandInputEditorBuilder? editorBuilder, EditableTextContextMenuBuilder? contextMenuBuilder, bool autocorrect = false, bool enableSuggestions = true, TextCapitalization textCapitalization = TextCapitalization.none, SmartDashesType smartDashesType = SmartDashesType.disabled, SmartQuotesType smartQuotesType = SmartQuotesType.disabled, Brightness? keyboardAppearance, EdgeInsets scrollPadding = const EdgeInsets.all(20), bool unfocusOnSubmit = false, TargetPlatform? platform, double minHeight = 44.0}) -
const
Properties
- autocorrect → bool
-
Whether the keyboard may automatically correct text.
final
- autofocus → bool
-
Whether the input should autofocus when mounted.
final
- borderRadius → BorderRadius?
-
Border radius when filled is true.
final
- contextMenuBuilder → EditableTextContextMenuBuilder?
-
Builds the text selection menu. When omitted, uses the platform editor's
default menu, including the system menu where supported.
Custom editorBuilder implementations receive this through
CommandInputEditor.contextMenuBuilder.
final
- controller → TextEditingController?
-
Optional external TextEditingController. If omitted, one is managed internally.
final
- cursorColor → Color?
-
Cursor color. Defaults to the platform's primary color.
final
- cursorHeight → double?
-
Optional cursor height.
final
- cursorOpacityAnimates → bool?
-
Whether the cursor blinks with opacity animation.
final
- cursorRadius → Radius?
-
Optional cursor radius.
final
- cursorWidth → double?
-
Cursor width. Defaults to 1.5.
final
- decoration → Decoration?
-
Explicit custom decoration. Overrides filled and fillColor.
final
- editorBuilder → CommandInputEditorBuilder?
-
Custom editor builder override.
final
- enableSuggestions → bool
-
Whether keyboard suggestions are requested.
final
- fillColor → Color?
-
Custom background fill color when filled is true.
final
- filled → bool
-
Whether to render a platform-styled background container (pill/rect).
final
- focusNode → FocusNode?
-
Optional external FocusNode.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardAppearance → Brightness?
-
Keyboard appearance brightness.
final
- minHeight → double
-
Minimum height to ensure touch target accessibility. Defaults to 44.0.
final
- onKeyEvent → FocusOnKeyEventCallback?
-
Key event interceptor.
final
-
onValueChange
→ ValueChanged<
String> ? -
Callback when the input text changes.
final
- padding → EdgeInsetsGeometry?
-
Inner padding around the search field.
final
- placeholder → String
-
Placeholder text string. Defaults to 'Search...'.
final
- placeholderStyle → TextStyle?
-
Text style for placeholder text.
final
- placeholderWidget → Widget?
-
Custom widget to display when the input is empty.
final
- platform → TargetPlatform?
-
Target platform override. If null, adapts to surrounding theme or OS.
final
- prefix → Widget?
-
Optional prefix widget placed to the left of the text input.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollPadding → EdgeInsets
-
Scroll padding for keyboard insets.
final
- showCursor → bool?
-
Whether to show the cursor.
final
- smartDashesType → SmartDashesType
-
Smart dashes configuration.
final
- smartQuotesType → SmartQuotesType
-
Smart quotes configuration.
final
- style → TextStyle?
-
Text style for input text.
final
- suffix → Widget?
-
Custom suffix widget placed to the right of the text input.
final
- textCapitalization → TextCapitalization
-
Text capitalization behavior.
final
- unfocusOnSubmit → bool
-
Whether soft-keyboard submission unfocuses before invoking action.
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