TDInput class

Inheritance

Constructors

TDInput({Key? key, double? width, double? height, TextStyle? textStyle, Color? backgroundColor, Decoration? decoration, Widget? leftIcon, String? leftLabel, TextStyle? leftLabelStyle, bool? required, bool readOnly = false, bool autofocus = false, bool obscureText = false, VoidCallback? onEditingComplete, ValueChanged<String>? onSubmitted, String? hintText, TextInputType? inputType, ValueChanged<String>? onChanged, List<TextInputFormatter>? inputFormatters, InputDecoration? inputDecoration, int maxLines = 1, FocusNode? focusNode, TextEditingController? controller, Color? cursorColor, Widget? rightBtn, TextStyle? hintTextStyle, GestureTapCallback? onBtnTap, Widget? labelWidget, Color? textInputBackgroundColor, EdgeInsetsGeometry? contentPadding, TDInputType type = TDInputType.normal, TDInputSize size = TDInputSize.large, double? leftInfoWidth, int? maxNum = 500, String? additionInfo = '', Color? additionInfoColor, TextAlign? textAlign, GestureTapCallback? onClearTap, bool needClear = true, Color? clearBtnColor, TextAlign contentAlignment = TextAlign.start, Widget? rightWidget, TDCardStyle? cardStyle, String? cardStyleTopText, String? cardStyleBottomText})

Properties

additionInfo String?
错误提示信息
final
additionInfoColor Color?
错误提示颜色
final
autofocus bool
是否自动获取焦点
final
backgroundColor Color?
输入框背景色
final
cardStyle TDCardStyle?
卡片默认样式
final
cardStyleBottomText String?
卡片模式下方文字
final
cardStyleTopText String?
卡片模式上方文字
final
clearBtnColor Color?
右侧删除按钮颜色
final
contentAlignment TextAlign
内容对齐方向
final
contentPadding EdgeInsetsGeometry?
textInput内边距
final
controller TextEditingController?
controller 用户获取或者赋值输入内容
final
cursorColor Color?
游标颜色
final
decoration Decoration?
输入框样式
final
focusNode FocusNode?
获取或者取消焦点使用
final
hashCode int
The hash code for this object.
no setterinherited
height double?
输入框宽度
final
hintText String?
提示文案
final
hintTextStyle TextStyle?
提示文本颜色,默认为文本颜色
final
inputDecoration InputDecoration?
自定义输入框样式,默认圆角
final
inputFormatters List<TextInputFormatter>?
显示输入内容,如限制长度(LengthLimitingTextInputFormatter(6))
final
inputType TextInputType?
键盘类型,数字、字母
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labelWidget Widget?
leftLabel右侧组件,支持自定义
final
leftIcon Widget?
带图标的输入框
final
leftInfoWidth double?
输入框左侧的宽度(输入框有16dp的左侧padding,因而左侧部分不用考虑这16dp)
final
leftLabel String?
输入框左侧文案
final
leftLabelStyle TextStyle?
左侧标签样式
final
maxLines int
最大输入行数
final
maxNum int?
最大字数限制
final
needClear bool
是否需要右侧按钮变为删除
final
obscureText bool
是否隐藏输入的文字,一般用在密码输入框中
final
onBtnTap GestureTapCallback?
右侧按钮点击
final
onChanged ValueChanged<String>?
输入文本变化时回调
final
onClearTap GestureTapCallback?
右侧删除点击
final
onEditingComplete VoidCallback?
点击键盘完成按钮时触发的回调
final
onSubmitted ValueChanged<String>?
点击键盘完成按钮时触发的回调, 参数值为输入的内容
final
readOnly bool
是否只读
final
required bool?
是否必填标志(红色*)
final
rightBtn Widget?
右侧按钮
final
rightWidget Widget?
右侧自定义组件 特殊类型时生效
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size TDInputSize
输入框规格
final
textAlign TextAlign?
文字对齐方向
final
textInputBackgroundColor Color?
文本框背景色
final
textStyle TextStyle?
文本颜色
final
type TDInputType
输入框类型
final
width double?
输入框宽度(TDCardStyle时必须设置该参数)
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
buildCardStyleInput(BuildContext context) Widget
buildInputView(BuildContext context) Widget
buildLongTextInput(BuildContext context) Widget
buildNormalInput(BuildContext context) Widget
buildSpecialInput(BuildContext context) Widget
buildTwoLineInput(BuildContext context) Widget
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
getInputPadding() double
获取输入框规格
getTextSize(String text, [TextStyle? style]) Size
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