Issue
Here's what I have on the screen:
https://i.imgur.com/oSblgWD.png
How can I align Last name so it's under First name ? I don't want to put an icon next to Last name, just First name.
Here's the code I have. Thanks.
body: Center(
child: Form(
key: _formKey,
child: Column(
children: <Widget>[
ListTile(
leading: const Icon(Icons.person),
title: new TextField(
decoration: new InputDecoration(
hintText: "First name",
),
),
),
ListTile(
title: new TextField(
decoration: new InputDecoration(
hintText: "Last name",
),
),
),
],
),
)
)
Solution
Simple & Elegant Way would be to use Padding Widget.
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Form(
// key: _formKey,
child: Column(
children: <Widget>[
ListTile(
leading: const Icon(Icons.person),
title: new TextField(
decoration: new InputDecoration(
hintText: "First name",
),
),
),
ListTile(
leading: Padding(padding: EdgeInsets.all(16.0)),
title: new TextField(
decoration: new InputDecoration(
hintText: "Last name",
),
),
),
],
),
)),
);
}
Answered By - anmol.majhail
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.