flutter textField

textField 属性记录:

TextField(
    controller: textController,
    textInputAction: TextInputAction.search,//改变键盘上搜索文本显示
    //键盘类型
    keyboardType: TextInputType.number,//只能吊起数字键盘
    //输入是否为密码
    obscureText: false,
    //文本对齐方式
//  textAlign: TextAlign.left,
    //文本颜色 字体
    style: TextStyle(color: Colors.pink,fontSize: 14),
    //最大行数
    maxLines: 1,
    //限制文本长度  右下角有统计提示
    maxLength: 10,
    maxLengthEnforced: false,//超过文本限制是否允许输入
    //限制文本长度 右下角没有统计字符串提示
//  inputFormatters: [LengthLimitingTextInputFormatter(10)],
    autofocus: false,//是否自动获取焦点
//   focusNode: FocusNode(skipTraversal: true),
  //是否自动更正
    autocorrect: true,
    //光标颜色 宽度 弧度
    cursorColor: Colors.amber,
    cursorWidth: 2.0,
    cursorRadius: Radius.circular(2),
    //内容改变的回调
    onChanged: (text){
      print(text);
    },
    //内容提交 按回车键的回调
    onSubmitted: (text){
      print(text);
    },
    onEditingComplete: (){print("1111");},
    InputDecoration给TextField设置装饰(形状等)
    decoration: InputDecoration(
		         hintText: "请输入文本",
		         contentPadding: EdgeInsets.all(10),//内边距
			//   fillColor: Colors.white,//填充色
			 filled: true,
			//   border: OutlineInputBorder(//添加边框
			//   borderSide: BorderSide(width: 2,color: Colors.pink,
			//   style: BorderStyle.solid)
			//   ,borderRadius: BorderRadius.all(Radius.circular(10.0)),//边框弧度
			//   ),
			//   disabledBorder: InputBorder.none//去除边框
			//   ,focusedBorder: InputBorder.none//去除边框
			//    ,enabledBorder: InputBorder.none//去除边框(包括线)
    ),

    ),
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值