@@ -55,6 +55,9 @@ class AppDialog extends StatelessWidget {
5555 /// The content padding.
5656 final EdgeInsets ? contentPadding;
5757
58+ /// Whether to put the content in a [ListView] instead of a [Column] .
59+ final bool scrollable;
60+
5861 /// Creates a new app dialog instance.
5962 const AppDialog ({
6063 super .key,
@@ -65,6 +68,7 @@ class AppDialog extends StatelessWidget {
6568 this .borderRadius = 28 ,
6669 this .displayCloseButton,
6770 this .contentPadding,
71+ this .scrollable = true ,
6872 });
6973
7074 @override
@@ -89,6 +93,19 @@ class AppDialog extends StatelessWidget {
8993 child: this .children[i],
9094 ),
9195 ];
96+ children = [
97+ if (title != null )
98+ Transform .translate (
99+ offset: Offset (0 , - 1 ),
100+ child: _AppDialogTitle (
101+ title: title! ,
102+ ellipsisTitleOnOverflow: ellipsisTitleOnOverflow,
103+ displayCloseButton: displayCloseButton,
104+ borderRadius: borderRadius,
105+ ),
106+ ),
107+ ...children,
108+ ];
92109 Widget dialog = AlertDialog (
93110 shape: RoundedRectangleBorder (
94111 borderRadius: BorderRadius .all (
@@ -98,22 +115,15 @@ class AppDialog extends StatelessWidget {
98115 contentPadding: EdgeInsets .zero,
99116 content: SizedBox (
100117 width: MediaQuery .sizeOf (context).width,
101- child: ListView (
102- shrinkWrap: true ,
103- children: [
104- if (title != null )
105- Transform .translate (
106- offset: Offset (0 , - 1 ),
107- child: _AppDialogTitle (
108- title: title! ,
109- ellipsisTitleOnOverflow: ellipsisTitleOnOverflow,
110- displayCloseButton: displayCloseButton,
111- borderRadius: borderRadius,
112- ),
118+ child: scrollable
119+ ? ListView (
120+ shrinkWrap: true ,
121+ children: children,
122+ )
123+ : Column (
124+ mainAxisSize: MainAxisSize .min,
125+ children: children,
113126 ),
114- ...children,
115- ],
116- ),
117127 ),
118128 actions: actions,
119129 );
0 commit comments