Flutter 如何在颤振时从默认值更改TextFormField高度和字体颜色

Flutter 如何在颤振时从默认值更改TextFormField高度和字体颜色,flutter,Flutter,我想更改TextFormField的高度和字体颜色 TextFormField( decoration: const InputDecoration( border: OutlineInputBorder(), filled: true, icon: Icon(Icons.person), hintTex

我想更改TextFormField的高度和字体颜色

           TextFormField(
              decoration: const InputDecoration(
                  border: OutlineInputBorder(),
                  filled: true,
                  icon: Icon(Icons.person),
                  hintText: 'Nick Name',
                  labelText: 'Nick Name',
              ),
            ),

如何编写它?

您可以使用内容填充来调整大小和样式属性来更改颜色和与文本相关的属性

 TextFormField(
        decoration: const InputDecoration(
            contentPadding: EdgeInsets.all(20), // change height
            border: OutlineInputBorder(),
            filled: true,
            icon: Icon(Icons.person),
            hintText: 'Nick Name',
            labelText: 'Nick Name',
            hintStyle:
                TextStyle(color: Colors.amber)), // change hint text color
        style: TextStyle(color: Colors.red), // change input text color
      ),

您可以使用contentPadding调整大小,并使用style属性更改颜色和与文本相关的属性

 TextFormField(
        decoration: const InputDecoration(
            contentPadding: EdgeInsets.all(20), // change height
            border: OutlineInputBorder(),
            filled: true,
            icon: Icon(Icons.person),
            hintText: 'Nick Name',
            labelText: 'Nick Name',
            hintStyle:
                TextStyle(color: Colors.amber)), // change hint text color
        style: TextStyle(color: Colors.red), // change input text color
      ),

要增加
TextFormField
高度,您可以在
InputDecoration
中使用
contentPadding
属性,并为
vertical
参数赋值,如下所示:

decoration: InputDecoration(
                  contentPadding: EdgeInsets.symmetric(vertical: 30),
要更改
标签
提示
的字体颜色,您可以使用
主题
材质应用
进行更改,如下所示:

theme: ThemeData(
      inputDecorationTheme: InputDecorationTheme(
            labelStyle: TextStyle(color: Colors.black),
            hintStyle: TextStyle(color: Colors.black),

      )),

希望这有帮助。

要增加
TextFormField
高度,可以在
InputDecoration
中使用
contentPadding
属性,并将
垂直
参数的值设置为:

decoration: InputDecoration(
                  contentPadding: EdgeInsets.symmetric(vertical: 30),
要更改
标签
提示
的字体颜色,您可以使用
主题
材质应用
进行更改,如下所示:

theme: ThemeData(
      inputDecorationTheme: InputDecorationTheme(
            labelStyle: TextStyle(color: Colors.black),
            hintStyle: TextStyle(color: Colors.black),

      )),

希望这有帮助。

嗨,这个“主题”属性去哪里了?嗨,这个“主题”属性去哪里了?