我正在try 做一个水平滚动按钮组.
我有一个categories
个的列表,对于每个列表,我需要一个按钮来呈现.
我的代码如下所示:
GroupButton(
buttons: [
for(final cat in categories)
ElevatedButton.icon(
onPressed: () {
_getCategory(cat.id);
},
icon: cat.icon,
label: Text(cat.name, style: const TextStyle(color: Colors.black),
),
),
],
)
I have the expected result but the buttons won't render
With this code the output looks like this:
If I don't wrap the buttons with the GroupButtons I obtain this result:
如何正确渲染按钮?