我创建了一个列表视图,包含 3 个文本字段,问题是 ofc,它们扩展到整个屏幕宽度。
我尝试用容器包裹它们并设置宽度,
并用 LimitedBox 包裹它并设置 maxWidth - 它们都不起作用
我如何控制 Listview 内部文本字段的宽度,
或者请使用替代方法来完成它。
我尝试调整其宽度,添加了其中一个文本字段
谢谢
ListView(
children: <Widget>[
LimitedBox(
maxWidth: 50,
child: Container(
width: 50,
child: TextFormField(
style: TextStyle(color: Colors.white),
decoration: InputDecoration(
hintText: '[email protected] /cdn-cgi/l/email-protection',
hintStyle: TextStyle(fontSize: 10, color: Colors.white),
labelText: 'E-mail adress',
labelStyle: TextStyle(
color: Colors.white,
)),
),
),
),
),
使用行小部件
ListView(children: <Widget>[
Row(
children: <Widget>[
LimitedBox(
maxWidth: 50,
child: Container(
child: TextFormField(
style: TextStyle(color: Colors.white),
decoration: InputDecoration(
hintText: '[email protected] /cdn-cgi/l/email-protection',
hintStyle: TextStyle(fontSize: 10, color: Colors.white),
labelText: 'E-mail adress',
labelStyle: TextStyle(
color: Colors.white,
)),
),color: Colors.amber,
),
)
],
),
])
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)