I can't figure out why there is space at the bottom of TextField
between the text and the blue line.
Here is my code :
Future<Null> _selectNoteType (BuildContext context) async {
switch (await showDialog<Null>(
context: context,
builder: (BuildContext context) {
return new SimpleDialog(
title: const Text('Select Note Type'),
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: new TextField(
keyboardType: TextInputType.text,
maxLines: 1,
style: new TextStyle(
color: Colors.black,
fontSize: 20.0
),
),
),
new SimpleDialogOption(
onPressed: () {},
child: const Text('Text')
),
new SimpleDialogOption(
onPressed: () {},
child: const Text('Checklist')
),
],
);
}
)) {}
}
In my case the
TextField
would still not collapse even after usingInputDecoration.collapsed()
.My version doesn't have any padding at all and takes the minimum size:
Live preview: https://dartpad.dev/3f9149a1c8f5eec352c796e7585e233c
You can use a collapsed
InputDecoration
for thedecoration:
property of theTextField
.But you must know the consequences of using a collapsed
InputDecoration
. From the documentation:And for the
InputDecoration.collapse()
constructor: