How to constrain height of AlertDialog
Wrap your content with a Column
and set mainAxisSize
to MainAxisSize.min
:
AlertDialog(
content: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
//your content
],
),
You can wrap it inside a SizedBox
or ConstrainedBox
ConstrainedBox(
constraints: BoxConstraints(maxHeight: 100.0),
child: AlertDialog(
...
),
);
Alternatively, you can set shrinkWrap
to true
in your ListView
so that it takes the least amount of vertical space necessary.
ListView(
shrinkWrap: true,
...
)