问题
I'm trying to align horizontal bottom 1 Text
and 1 TextField
value using Row
, but TextField
value always higher than the left Text
.
is it possible to align horizontal bottom Text
and TextField
value even when the font-size more bigger ?
Here are my code and screenshot:
body: Column(
children: <Widget>[
Row(
children: <Widget>[
Text('Number 1 : '),
Expanded(
child:
TextField(
textAlign: TextAlign.start,
textAlignVertical: TextAlignVertical.bottom,
textCapitalization: TextCapitalization.sentences,
maxLength: 10,
),
),
]),
],
)
回答1:
You should set textBaseline and crossAxisAlignment for Row.
Row(
crossAxisAlignment: CrossAxisAlignment.baseline, // <--
textBaseline: TextBaseline.alphabetic, // <--
children: <Widget>[
Text('Number 1 : '),
...
It will look like this
来源:https://stackoverflow.com/questions/60969898/how-to-align-a-textfield-and-a-text-on-the-same-level