Reputation: 113
i have textformfield that have icon, but the input text position not equal with the icon i have somehow
how do i fix this?
code i tried
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
),
),
],
)
);
}
}
Upvotes: 0
Views: 1926
Reputation: 425
Please follow below approach :
contentPadding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0),
Please use content padding inside InputDecoration and also try to put TextFormField inside container for better alignment.
Upvotes: 4