Reputation: 2091
Oh what a nightmare these BoxConstraints are, please upskill me in anyway possible.
List<Chip> chipList = List.generate(toolsProvidedList.length, (index) {
return Chip(
label: SizedBox(height: 20.0, child: Text(toolsProvidedList[index]) ),
);
});
toolsProvided = Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: chipList,
);
I've tried wrapped the Text child of my chipList in flexible, expanded, SizedBox, none of these have worked. You can see I've used MainAxisSize.min on the Row widget. That's not worked.
The Row needs to have a known height, how can I give it that? I don't know how many chips there maybe, they may go across the row then, I hope, wrap down.
Upvotes: 0
Views: 356
Reputation: 2091
SOLVED! It's a list of items so intuitively one should reach for a ListView (doh). But it complained about Bounds once more. I think UI maybe one of the most knarly pieces of Flutter.
Here's the complete revised & working snippet.
Widget toolsProvided = Flexible( child: ListView(
children: List.generate(toolsProvidedList.length, (index) {
return Chip(
label: SizedBox(height: 20.0, child: Text(toolsProvidedList[index]) ),
);
}),
));
Happy days :)
Upvotes: 0
Reputation: 3283
I am not quite sure if I don't understand what you need...
But try this to see if that helps
(Remove your Row
widget and replace it with a Wrap
)
var toolsProvided = Container(
child: Wrap(
direction: Axis.horizontal,
children: chipList
));
Adding an image or a better description would help.
Upvotes: 2