I want to reduce space between line and text with flutter.
SizedBox(
width: 60.0,
child: TextField(
textAlign: TextAlign.center,
keyboardType: TextInputType.number,
style: TextStyle(color: Colors.black),
decoration: InputDecoration(
hintText: '125',
),
),
),
CodePudding user response:
Instead of wrapping TextField
inside SizedBox
use constraints
property of Input Decoration
to give the TextField min or max height/width:
TextField(
textAlign: TextAlign.center,
keyboardType: TextInputType.number,
style: TextStyle(color: Colors.black),
decoration: InputDecoration(
hintText: '125',
isDense: true,
constraints: BoxConstraints(
maxWidth: 60
)
),
)
CodePudding user response:
Inside InputDecoration()
set the contentPadding: EdgeInsets.zero
. And set isDense: true