I try to create a view where I have TextFields
and at the bottom Wrap Chips
.
When Wrap has few Chips without ListView
like this:
Wrap(
spacing: 4,
children: [
Chip(label: Text('TAG 1')),
Chip(label: Text('TAG 2')),
Chip(label: Text('TAG 3')),
Chip(label: Text('TAG 4')),
Chip(label: Text('TAG 5')),
],
)
Works fine.
But when I put more Chips, part become invisible.
I tried to put Wrap in ListView but in this way all Chips is invisible.
How to create scrollable Wrap with chips insight?
Here is my even attempts:
Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
TextField(...),
Container(...),
Container(...),
Container(...),
ListView(
children: <Widget>[
Wrap(
spacing: 4,
children: genTagsList(context),//Generates Chips from string array with size 20
)
],
)
],
)
To get your desired outcome, fix your code like so;
Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
TextField(...),
Container(...),
Container(...),
Container(...),
ListView(
primary: true,
shrinkWrap: true,
children: <Widget>[
Wrap(
spacing: 4.0,
runSpacing: 0.0,
children: List<Widget>.generate(
array.length, // place the length of the array here
(int index) {
return Chip(
label: Text()
);
}
).toList(),
),
],
),
],
)