我有国家/地区代码(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"),
),
),
),
],
),
感谢@danish-khan-I,我解决了使用crossAxisAlignment: CrossAxisAlignment.baseline
。但你还必须提供textBaseline
否则它给出例外。
所以在我的行中我使用了:
crossAxisAlignment: CrossAxisAlignment.baseline
textBaseline: TextBaseline.ideographic,
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)