【发布时间】:2021-12-06 10:25:24
【问题描述】:
【问题讨论】:
标签: flutter dart flutter-layout
【问题讨论】:
标签: flutter dart flutter-layout
正如你的问题所说,你遵循这种方法,它不包含multiple columns,项目的宽度不同。这个 sn-p 可以正常工作。
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Column(
children: [
Row(
key: const ValueKey("row1"),
children: _items(),
),
Row(
key: const ValueKey("row2"),
children: _items(),
),
],
),
),
【讨论】:
items.sublist(0, items.length ~/ 2) 和第二行items.sublist(( items.length ~/ 2), items.length)
您可以通过SingleChildScrolView 小部件和axis : horizontal 实现此目的,并且该列表项将使用FilterChip 小部件创建。
像这样:
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Wrap(
spacing: 10.0,
runSpacing: 5.0,
children: [...generateTags()],
),
),
generateTags(){
return _keywords.map((e) => FilterChip(label : e)).toList();
}
var _keywords =["hello" , "hi" ,"words 1" , "word 2"];
【讨论】: