我有带图标的textformfield,但是输入文本位置与我有某种意义的图标不相等
我该如何解决?
我尝试过的代码
class TestPage extends StatefulWidget {
@override
_TestPageState createState() => _TestPageState();
}
class _TestPageState extends State<TestPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
TextFormField(
decoration: InputDecoration(
prefixIcon: Icon(Icons.person),
filled: true,
hintText: 'Email',
fillColor: Colors.white
),
),
TextFormField(
decoration: InputDecoration(
prefixIcon: Icon(Icons.https),
filled: true,
hintText: 'Password',
fillColor: Colors.white
),
),
],
)
);
}
}
答案 0 :(得分:0)
请遵循以下方法:
contentPadding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0),
请在InputDecoration内使用内容填充,并尝试将TextFormField放在容器内以更好地对齐。