Flutter: Bottom sheet with TextField/TextFormField
You will have to provide a specific width to the TextField
, simply provide width
in your Container
or wrap your Column
in Expanded
.
Solution 1
Container(
width: 100, // do it in both Container
child: TextField(),
),
Solution 2
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded( // wrap your Column in Expanded
child: Column(
children: <Widget>[
Text('item 1'),
Container(child: TextField()),
],
),
),
Expanded( // wrap your Column in Expanded
child: Column(
children: <Widget>[
Text('item 2'),
Container(child: TextField()),
],
),
),
],
),