我正在嘗試獲得下面 gif 中的布局,但無法獲得任何資源來繼續。有兩行多列并且是可滾動的。我怎樣才能實作這樣的布局?

uj5u.com熱心網友回復:
您可以通過SingleChildScrolViewwidget with來實作這一點,axis : horizontal 并且該listitem 將使用FilterChipwidget創建。
像這樣 :
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"];
uj5u.com熱心網友回復:
正如您的問題所說,您遵循這種方法,并且它不包含multiple columns, 專案具有不同的寬度。此代碼段將正常作業。
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Column(
children: [
Row(
key: const ValueKey("row1"),
children: _items(),
),
Row(
key: const ValueKey("row2"),
children: _items(),
),
],
),
),
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/374332.html
上一篇:在Dart中的函式引數中鍵入串列
下一篇:如何為顫振中的一項添加復選框
