美文网首页flutter
Flutter之TextFiled组件

Flutter之TextFiled组件

作者: 习惯了_就好 | 来源:发表于2018-11-23 15:17 被阅读81次
/**
    const TextField({
    Key key,
    this.controller,//控制器,TextField的相关信息存储在里面
    this.focusNode,
    this.decoration = const InputDecoration(),//输入器装饰
    TextInputType keyboardType, //弹出键盘的类型
    this.textInputAction,//更改TextField的textInputAction可以更改键盘右下角的操作按钮,搜索,完成
    this.textCapitalization = TextCapitalization.none,//户输入中的字母大写的选项,TextCapitalization.sentences每个句子的首字母大写,TextCapitalization.characters:句子中的所有字符都大写,TextCapitalization.words : 将每个单词的首字母大写。
    this.style,
    this.textAlign = TextAlign.start, //文字显示位置
    this.autofocus = false,//自动获取焦点
    this.obscureText = false,//是否隐藏输入,true密码样式显示,false明文显示
    this.autocorrect = true,
    this.maxLines = 1,//编辑框最多显示行数
    this.maxLength,//输入最大长度,并且默认情况下会将计数器添加到TextField
    this.maxLengthEnforced = true,
    this.onChanged,   //输入监听
    this.onEditingComplete,//当用户提交时调用
    this.onSubmitted, //文字提交触发(键盘按键)
    this.inputFormatters,
    this.enabled,
    this.cursorWidth = 2.0,//更改光标宽度
    this.cursorRadius,//更改光标半径
    this.cursorColor,//更改光标颜色
    this.keyboardAppearance,
    this.scrollPadding = const EdgeInsets.all(20.0),
    }) : assert(textAlign != null),
    assert(autofocus != null),
    assert(obscureText != null),
    assert(autocorrect != null),
    assert(maxLengthEnforced != null),
    assert(scrollPadding != null),
    assert(maxLines == null || maxLines > 0),
    assert(maxLength == null || maxLength > 0),
    keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline),
    super(key: key);
 */
/**
    const InputDecoration({
    this.icon,
    this.labelText,//Material Design风格的输入提示
    this.labelStyle,//设置labeltext的样式
    this.helperText,//显示在输入的下面
    this.helperStyle,
    this.hintText,//普通的输入提示
    this.hintStyle,
    this.errorText,//显示在输入的下面,输入框会变成红色
    this.errorStyle,
    this.errorMaxLines,//错误提示最多显示的行数
    this.isDense,
    this.contentPadding,//显示内容的padding
    this.prefixIcon,//输入框内侧左面的Icon
    this.prefix,//输入框内侧左面的Widget
    this.prefixText,//输入框内侧左面的Text
    this.prefixStyle,//设置prefixText的样式
    this.suffixIcon,//输入框内侧右面的Icon
    this.suffix,//输入框内侧右面的Widget
    this.suffixText,//输入框内侧右面的Text
    this.suffixStyle,//设置suffixText的样式
    this.counterText,//输入框右下角的计数器文本
    this.counterStyle,
    this.filled,//是否显示输入框背景色,true显示,false不显示
    this.fillColor,
    this.errorBorder,
    this.focusedBorder,
    this.focusedErrorBorder,
    this.disabledBorder,
    this.enabledBorder,
    this.border,//InputBorder.none没有边框,UnderlineInputBorder下边框,OutlineInputBorder四周都有边框
    this.enabled = true,
    this.semanticCounterText,
    }) : assert(enabled != null),
    assert(!(prefix != null && prefixText != null), 'Declaring both prefix and prefixText is not allowed'),
    assert(!(suffix != null && suffixText != null), 'Declaring both suffix and suffixText is not allowed'),
    isCollapsed = false;
 */

练习demo,链接https://gitee.com/xgljh/Flutter

相关文章

网友评论

    本文标题:Flutter之TextFiled组件

    本文链接:https://www.haomeiwen.com/subject/yapjqqtx.html