I want create statefulWidget and want in this widget get parent widget height. Don't want do this by sending height data from parent widget. How can I do this?
Use LayoutBuilder as a child widget.
LayoutBuilder(builder: (ctx, constraints) {
return
Container(
height: constraints.maxHeight * 0.5,
width: constraints.maxWidth * 0.5,
child: Text('Inside Layout Builder'),
);
})
As per this code Container will use half of the height and width of parent widget.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With