如何降低文本表单字段的边界宽度?
我需要减少Textfield边界侧的宽度。我该怎么做?
final emailNameField = TextFormField(
autofocus: false,
controller: emailEditingController,
keyboardType: TextInputType.emailAddress,
validator: (email) => email != null && !EmailValidator.validate(email)
? "Enter a valid Email"
: null,
onSaved: (email) {
emailEditingController.text = '$email';
},
textInputAction: TextInputAction.next,
decoration: const InputDecoration(
prefixIcon: Icon(Icons.mail),
contentPadding: EdgeInsets.fromLTRB(20, 15, 20, 15),
prefixIconColor: Colors.red,
border: OutlineInputBorder(
borderRadius: BorderRadius.only(),
borderSide: BorderSide(width: 1)),
hintText: 'Email '),
);
//password field
final passwordNameField = TextFormField(
autofocus: false,
controller: passwordEditingController,
obscureText: true,
onSaved: (value) {
passwordEditingController.text = 'value';
},
textInputAction: TextInputAction.done,
decoration: const InputDecoration(
prefixIcon: Icon(Icons.vpn_key),
contentPadding: EdgeInsets.fromLTRB(200, 15, 20, 15),
prefixIconColor: Colors.red,
border: OutlineInputBorder(
borderSide: const BorderSide(
width: 2, color: Color.fromARGB(26, 204, 32, 32))),
hintText: 'Password ',
suffixIcon: Icon(Icons.remove_red_eye_rounded)));
I need to reduce the width of my border side in TextField. How can I do that?
final emailNameField = TextFormField(
autofocus: false,
controller: emailEditingController,
keyboardType: TextInputType.emailAddress,
validator: (email) => email != null && !EmailValidator.validate(email)
? "Enter a valid Email"
: null,
onSaved: (email) {
emailEditingController.text = '$email';
},
textInputAction: TextInputAction.next,
decoration: const InputDecoration(
prefixIcon: Icon(Icons.mail),
contentPadding: EdgeInsets.fromLTRB(20, 15, 20, 15),
prefixIconColor: Colors.red,
border: OutlineInputBorder(
borderRadius: BorderRadius.only(),
borderSide: BorderSide(width: 1)),
hintText: 'Email '),
);
//password field
final passwordNameField = TextFormField(
autofocus: false,
controller: passwordEditingController,
obscureText: true,
onSaved: (value) {
passwordEditingController.text = 'value';
},
textInputAction: TextInputAction.done,
decoration: const InputDecoration(
prefixIcon: Icon(Icons.vpn_key),
contentPadding: EdgeInsets.fromLTRB(200, 15, 20, 15),
prefixIconColor: Colors.red,
border: OutlineInputBorder(
borderSide: const BorderSide(
width: 2, color: Color.fromARGB(26, 204, 32, 32))),
hintText: 'Password ',
suffixIcon: Icon(Icons.remove_red_eye_rounded)));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以包装父
card
窗口小部件填充物,或者只需使用Margin
外部间距的属性,然后用填充物包装column
用填充物来提供内部间距。有关
card> card
。You can wrap parent
Card
widget padding or just usemargin
property for outside spacing, and wrapColumn
widget with padding to provide inner spacing.More about
Padding
andCard
.您可以通过
装饰
属性来实现这一目标,这是一个示例。请注意,您可以使用多种类型的边界样式。
文档非常清晰,直截了当地解释了
https://api.flutter.dev/flutter/flutter/material/material/material/inputdecoration/inputdecoration-class。 html
You can achieve that through
decoration
property, here is a sample.Pay attention that there is more than one type of borders styling you can apply.
the docs are very clear and straight to the point in explaining that
https://api.flutter.dev/flutter/material/InputDecoration-class.html