If you only need the rows to scroll together (and manually decide which row each chip goes into), all you need is warp the rows in a column then put them in a horizontal scrollable.
class ChipGrid extends StatelessWidget {
const ChipGrid({super.key});
@override
Widget build(BuildContext context) {
return ListView(
scrollDirection: Axis.horizontal,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
for (var i = 0; i < 10; i++)
Chip(label: Text('Item Number $i')),
],
),
Row(
children: [
for (var i = 10; i < 20; i++)
Chip(label: Text('Item Number $i')),
],
),
Row(
children: [
for (var i = 20; i < 30; i++)
Chip(label: Text('Item Number(Row 3): $i')),
],
),
],
)
],
);
}
}
2
Answers
If you only need the rows to scroll together (and manually decide which row each chip goes into), all you need is warp the rows in a column then put them in a horizontal scrollable.
You can use the
Column
to create separated line of chips and fill it with calculated total chips / line count.Workaround code below to demonstrate the result:
And this is the result:
Hopefully it can solve your problem, Thanks 😉