Reputation: 398
in my Flutter app I have a column with dynamically created children:
Column (
children: _getWidgetsList(),
);
My goal is to wrap each item that's returned from _getWidgetsList()
withFlexible
widget so that all the items can be distributed evenly on the screen.
Unfortunately, if I do that in _getWidgetsList()
I get an error:
The ParentDataWidget Flexible(flex: 1) wants to apply ParentData of type FlexParentData to a RenderObject, which has been set up to accept ParentData of incompatible type ParentData.
Is is possible to somehow specify a wrapper for each child in the Column?
Upvotes: 0
Views: 50
Reputation: 4666
You can try mapping the children like this :
Column (
children: _getWidgetsList().map((e) => Flexible(child: e,)).toList(),
);
Upvotes: 1