AntdInput class
@t 输入框 @g 信息录入 @o 57 @d 通过键盘输入内容,是最基础的表单域包装。 @u 一般用在表单页进行信息的收集,提供文本框、选择框两种类型。
- Inheritance
Constructors
-
AntdInput.new({Key? key, AntdInputStyle? style, AntdStyleBuilder<
AntdInputStyle, AntdInput> ? styleBuilder, FocusNode? focusNode, bool clearable = true, String? value, bool disabled = false, ValueChanged<String?> ? onChange, VoidCallback? onEditingComplete, ValueChanged<String> ? onSubmitted, VoidCallback? onClear, Widget? placeholder, bool readOnly = false, AntdInputController? controller, TextAlign textAlign = TextAlign.start, bool obscureIcon = true, bool obscureText = false, bool autocorrect = false, int? maxLines, int? minLines, int? maxLength, TextInputType? keyboardType = TextInputType.text, TextInputAction? inputAction, SelectionChangedCallback? onSelectionChanged, List<TextInputFormatter> ? formatters, Widget? prefix, Widget? suffix, VoidCallback? onTap, EditableTextContextMenuBuilder? contextMenuBuilder, UndoHistoryController? undoController, SpellCheckConfiguration? spellCheckConfiguration, TextMagnifierConfiguration? magnifierConfiguration, AppPrivateCommandCallback? onAppPrivateCommand, DragStartBehavior dragStartBehavior = DragStartBehavior.start, ScrollController? scrollController, ScrollPhysics? scrollPhysics = const AlwaysScrollableScrollPhysics(), Clip clipBehavior = Clip.hardEdge, AntdOnFocus? onFocus}) -
const
Properties
- autocorrect → bool
-
是否自动校正拼写错误(如iOS键盘的自动修正),默认为true
finalinherited
- child → Widget
-
no setteroverride
- clearable → bool
-
是否显示清除按钮(点击会清空输入内容)
finalinherited
- clipBehavior → Clip
-
内容裁剪方式(如抗锯齿裁剪)
finalinherited
- contextMenuBuilder → EditableTextContextMenuBuilder?
-
自定义上下文菜单构建器(长按文本时弹出的菜单)
finalinherited
- controller → AntdInputController?
-
输入框的控制器,用于程序化控制文本内容
finalinherited
- disabled → bool
-
是否禁用输入框
finalinherited
- dragStartBehavior → DragStartBehavior
-
拖动行为的起始方式(如立即响应或延迟响应)
finalinherited
- focusNode → FocusNode?
-
控制输入框的焦点状态
finalinherited
-
formatters
→ List<
TextInputFormatter> ? -
输入内容格式过滤器(如限制数字、正则匹配等)
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- inputAction → TextInputAction?
-
键盘动作按钮类型(如搜索、发送等)
finalinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardType → TextInputType?
-
键盘类型(如数字键盘、邮箱键盘等)
finalinherited
- magnifierConfiguration → TextMagnifierConfiguration?
-
文本放大镜配置(长按选中文本时的放大效果)
finalinherited
- maxLength → int?
-
允许输入的最大字符数
finalinherited
- maxLines → int?
-
输入框的最大行数(多行文本时生效)
finalinherited
- minLines → int?
-
输入框的最小行数(多行文本时生效)
finalinherited
- obscureIcon → bool
-
是否显示密码可见性切换图标(仅当obscureText=true时有效)
finalinherited
- obscureText → bool
-
是否以密码形式隐藏输入内容(显示为圆点),默认为false
finalinherited
- onAppPrivateCommand → AppPrivateCommandCallback?
-
处理来自键盘的私有命令(如第三方键盘扩展功能)
finalinherited
-
onChange
→ ValueChanged<
String?> ? -
输入内容变化时的回调函数
finalinherited
- onClear → VoidCallback?
-
点击清除按钮时的回调函数
finalinherited
- onEditingComplete → VoidCallback?
-
编辑完成时的回调(通常点击键盘完成/下一步时触发)
finalinherited
- onFocus → AntdOnFocus?
-
焦点事件
finalinherited
- onSelectionChanged → SelectionChangedCallback?
-
文本选中范围变化时的回调
finalinherited
-
onSubmitted
→ ValueChanged<
String> ? -
文本提交时的回调(通常点击键盘发送/搜索时触发)
finalinherited
- onTap → VoidCallback?
-
输入框点击事件回调
finalinherited
- placeholder → Widget?
-
输入框为空时显示的提示文本
finalinherited
- prefix → Widget?
-
输入框前缀部件(如图标、标签等)
finalinherited
- readOnly → bool
-
是否为只读模式(可选中文本但不可编辑)
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController?
-
滚动控制器(用于控制多行文本的滚动位置)
finalinherited
- scrollPhysics → ScrollPhysics?
-
滚动物理效果(如滚动边界行为)
finalinherited
- spellCheckConfiguration → SpellCheckConfiguration?
-
拼写检查配置(如启用/禁用、错误文本样式等)
finalinherited
- style → AntdInputStyle?
-
样式
finalinherited
-
styleBuilder
→ AntdStyleBuilder<
AntdInputStyle, AntdInput> ? -
动态样式
finalinherited
- suffix → Widget?
-
输入框后缀部件(如图标、按钮等)
finalinherited
- textAlign → TextAlign
-
文本对齐方式(左/中/右)
finalinherited
- undoController → UndoHistoryController?
-
撤销/重做历史控制器
finalinherited
- value → String?
-
输入框的初始值
finalinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< StatefulWidget> -
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
-
getDefaultStyle(
BuildContext context, AntdTheme theme, AntdMapToken token) → AntdInputStyle -
inherited
-
getFinalStyle(
BuildContext context, AntdInputStyle style, AntdMapToken token) → AntdInputStyle -
inherited
-
getInputStyle(
BuildContext context) → AntdInputStyle? -
inherited
-
getStyle(
BuildContext context) → AntdInputStyle -
inherited
-
getStyleBuilder(
BuildContext context) → AntdStyleBuilder< AntdInputStyle, AntdInput> ? -
inherited
-
getThemeStyle(
BuildContext context, AntdTheme theme) → AntdStyleBuilder< AntdInputStyle, AntdInput> ? -
override
-
getValue(
BuildContext context) → dynamic -
inherited
-
getWidget(
BuildContext context) → AntdInput -
override
-
isFromItemEnv(
BuildContext context) → bool -
inherited
-
margeStyle(
AntdInputStyle defaultStyle, AntdInputStyle? style) → AntdInputStyle -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setValue(
BuildContext context, dynamic value, AntdFormTrigger sourceTrigger) → void -
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
-
useValue(
BuildContext context, void action(dynamic value)) → void -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited