I'm working on a CustomPainter
widget that receives a List<Widget>
as an argument.
I would like to know the size of each of my Widget
so I can adjust my paint.
The List<Widget>
will be a user-selected List
so I can't use GlobalKeys
here.
I watched some answers on StackOverflow and articles on the subject but every time the answer seems not adapted to my problem.
class MyPainter extends CustomPainter {
final List<Widget> myWidgetList;
MyPainter({
this.myWidgetList,
});
@override
void paint(Canvas canvas, Size size) {
for (var item in myWidgetList) {
// print my widget height.
}
...
}
}