【发布时间】:2019-06-17 10:47:03
【问题描述】:
我有一个国家代码(DropdownMenu)和电话(TextFormField),我怎样才能把它们放在同一级别? 我试过对齐小部件。
Row(
children: <Widget>[
Flexible(
flex: 1,
child: DropdownButtonFormField(
value: _selectedCountryCode ?? 'TR',
onChanged: (value) {
setState(() {
_selectedCountryCode = value;
});
},
items: countryCodes,
),
),
Flexible(
flex: 4,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: TextFormField(
decoration: InputDecoration(labelText: "Phone"),
),
),
),
],
),
【问题讨论】:
-
别忘了添加小部件的代码。
-
在
Row()小部件中你可以使用crossAxisAlignment: CrossAxisAlignment.baseline -
@danish-khan-I crossAxisAlignment != I/flutter (2417): CrossAxisAlignment.baseline || textBaseline != null': 不正确。
标签: flutter