('TextField Border Color Example'), ), body: Padding( padding: const EdgeInsets.all(16.0), child: TextField( decoration: InputDecoration( border: OutlineInputBorder( borderSide: BorderSide(color: Colors.blue, width: 2.0), // 设置边框颜色和宽度 ), labelText: 'Enter text', ), ), ), ...
在TextField的decoration属性中使用InputDecoration来定义装饰样式: 代码语言:txt 复制 TextField( decoration: InputDecoration( border: OutlineInputBorder( borderSide: BorderSide(color: Colors.red), // 设置边框颜色 ), ), ) 在上述代码中,我们通过border属性设置了一个带有红色边框的OutlineInputBorder,并...
borderRadius: BorderRadius.all(Radius.circular(10)), ///用来配置边框的样式 borderSide: BorderSide( ///设置边框的颜色 color: Colors.red, ///设置边框的粗细 width: 2.0, ), ), ///设置输入框可编辑时的边框样式 enabledBorder: OutlineInputBorder( ///设置边框四个角的弧度 borderRadius: Border...
hintText: "请填写您宝贵的意见", border: OutlineInputBorder( borderRadius: BorderRadius.circular(5.0), borderSide: BorderSide()), ), obscureText: false, //是否是密码 cursorColor: Colors.red, //光标颜色 //内容改变的回调 onChanged: (text) { print('change $text'); }, //内容提交(按回车...
TextField 是Flutter中的用户输入框,属性挺多的,不同的配置出不同的效果,就像是HTML中的 input 一样。..., //输入框是否可用 this.cursorWidth = 2.0, //光标的宽度 this.cursorRadius, //光标的圆角 this.cursorColor, //光标的颜色...,可以去掉边框 border: OutlineInputBorder( borderSide: BorderS...
二、TextField:表单常见属性: maxLines:设置此参数可以把文本框改为多行文本框 onChanged:文本框改变的时候触发的事件。 decoration: hintText:类似html中的placeholder border:配置文本框边框 OutlineInputBorder:配合使用 labelText:lable的名称 labelStyle:配置label的样式 ...
cursorColor: Colors.red 2. 通过修改 enabledBorder 和 focusedBorder 可以调整边框在选中和失焦时的颜色 child: TextField( controller: pwdController, obscureText:true, decoration: InputDecoration( hintText:'请输入验证码', prefixIcon: Icon(Icons.lock), ...
二、TextField:表单常见属性: maxLines:设置此参数可以把文本框改为多行文本框 onChanged:文本框改变的时候触发的事件。 decoration: hintText:类似html中的placeholder border:配置文本框边框 OutlineInputBorder:配合使用 labelText:lable的名称 labelStyle:配置label的样式 ...
this.fillColor, //相当于输入框的背景颜色 this.errorBorder, //errorText不为空,输入框没有...
borderSide: BorderSide( color: Colors.grey[200], ), ); TextField( controller: _inputController,//控制器 focusNode: _inputFocusNode,//焦点 style: TextStyle(fontSize: 16, color: Colors.black87),//文字大小、颜色 maxLines: 10,//最多多少行 ...