flutter中如何控制TextFormField的高度?

码云
2020-11-09 14:03

flutter中TextFormField的默认高度不是很高,如果要调整输入框的高度,可以通过调整内边contentPadding距来实现,示例代码如下:

final email = TextFormField(
    keyboardType: TextInputType.emailAddress,//电子邮箱类型的输入
    autofocus: false,
    initialValue: 'sathyabaman@gmail.com',
    style: new TextStyle(fontWeight: FontWeight.normal, color: Colors.white),
    decoration: InputDecoration(
      hintText: 'Email',
      contentPadding: new EdgeInsets.symmetric(vertical: 25.0, horizontal: 10.0), //内边距设置
      border: OutlineInputBorder(borderRadius: BorderRadius.circular(32.0)),//圆角设置
    ),
  );

 

实现效果如下:

全部评论