Let's say I have the following custom widget:
MyWidget extends StatelessWidget{
Widget child;
......
const MyWidget(
{Key key,
this.child})
: super(key: key);
@override
Widget build(BuildContext context) {
//get child's size and use it in layout
}
}
How can I reach this? I know that I can do it using global keys but as I see this solution doesn't work here.
How would I do it if I didn't need to create separate StatelessWidget: I'd create GlobalKey and provided it in constructor, but here I can't provide it in constructor because I have already created child Widget in my custom widget.