I want to know how can I find a widget's default size to set it as constraints: minHeight
or constraints: maxHeight
properties?
For example if I have this widget:
Expanded(
child: Column(
children: [
// right menu 1
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
constraints: BoxConstraints(
maxHeight: constraints.maxHeight - 16,
minHeight: 100,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.blue[400],
),
),
),
),
// right menu 2
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
constraints: BoxConstraints(
maxHeight: constraints.maxHeight - 16,
minHeight: 100,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.red[200],
),
),
),
),
],
),
),
And I want to set minHeight
to the container's default height instead of hardcoded 100.
Have you tried LayoutBuilder?