@@ -38,7 +38,8 @@ class AdaptiveLayoutBuilder extends StatelessWidget {
3838 final Widget Function (BuildContext , Widget , EdgeInsets )? alignBuilder;
3939
4040 /// Presentation of body, background, and foreground
41- final Widget Function (BuildContext , Widget , Widget , Widget )? presentationBuilder;
41+ final Widget Function (BuildContext , Widget , Widget , Widget )?
42+ presentationBuilder;
4243
4344 /// Side insets calculation
4445 final EdgeInsets Function (BuildContext , EdgeInsets )? sideInsetsBuilder;
@@ -79,31 +80,63 @@ class AdaptiveLayoutBuilder extends StatelessWidget {
7980 body = paddingBuilder? .call (context, body) ?? body;
8081
8182 // Build side widgets
82- final topSide = topSideBuilder? .call (context, MediaQuery .of (context).viewInsets.top) ??
83+ final topSide =
84+ topSideBuilder? .call (
85+ context,
86+ MediaQuery .of (context).viewInsets.top,
87+ ) ??
8388 const SizedBox .shrink ();
8489 final bottomSide =
85- bottomSideBuilder? .call (context, MediaQuery .of (context).viewInsets.bottom) ??
86- const SizedBox .shrink ();
87- final leftSide = leftSideBuilder? .call (context, MediaQuery .of (context).viewInsets.left) ??
90+ bottomSideBuilder? .call (
91+ context,
92+ MediaQuery .of (context).viewInsets.bottom,
93+ ) ??
94+ const SizedBox .shrink ();
95+ final leftSide =
96+ leftSideBuilder? .call (
97+ context,
98+ MediaQuery .of (context).viewInsets.left,
99+ ) ??
88100 const SizedBox .shrink ();
89101 final rightSide =
90- rightSideBuilder? .call (context, MediaQuery .of (context).viewInsets.right) ??
91- const SizedBox .shrink ();
102+ rightSideBuilder? .call (
103+ context,
104+ MediaQuery .of (context).viewInsets.right,
105+ ) ??
106+ const SizedBox .shrink ();
92107
93108 // Calculate side insets
94- final sideInsets = sideInsetsBuilder? .call (
109+ final sideInsets =
110+ sideInsetsBuilder? .call (
95111 context,
96112 EdgeInsets .only (
97- left: letAsOrNull <PreferredSizeWidget >(leftSide)? .preferredSize.width ?? 0.0 ,
98- right: letAsOrNull <PreferredSizeWidget >(rightSide)? .preferredSize.width ?? 0.0 ,
99- top: letAsOrNull <PreferredSizeWidget >(topSide)? .preferredSize.height ?? 0.0 ,
100- bottom: letAsOrNull <PreferredSizeWidget >(bottomSide)? .preferredSize.height ?? 0.0 ,
113+ left:
114+ letAsOrNull <PreferredSizeWidget >(
115+ leftSide,
116+ )? .preferredSize.width ??
117+ 0.0 ,
118+ right:
119+ letAsOrNull <PreferredSizeWidget >(
120+ rightSide,
121+ )? .preferredSize.width ??
122+ 0.0 ,
123+ top:
124+ letAsOrNull <PreferredSizeWidget >(
125+ topSide,
126+ )? .preferredSize.height ??
127+ 0.0 ,
128+ bottom:
129+ letAsOrNull <PreferredSizeWidget >(
130+ bottomSide,
131+ )? .preferredSize.height ??
132+ 0.0 ,
101133 ),
102134 ) ??
103135 EdgeInsets .zero;
104136
105137 // Align body with side insets
106- body = alignBuilder? .call (context, body, sideInsets) ??
138+ body =
139+ alignBuilder? .call (context, body, sideInsets) ??
107140 _defaultAlign (context, body, sideInsets);
108141
109142 // Combine body with side widgets
@@ -119,7 +152,9 @@ class AdaptiveLayoutBuilder extends StatelessWidget {
119152 children: [
120153 topSide is PreferredSizeWidget
121154 ? ConstrainedBox (
122- constraints: BoxConstraints .loose (topSide.preferredSize),
155+ constraints: BoxConstraints .loose (
156+ topSide.preferredSize,
157+ ),
123158 child: topSide,
124159 )
125160 : topSide,
@@ -131,14 +166,18 @@ class AdaptiveLayoutBuilder extends StatelessWidget {
131166 children: [
132167 leftSide is PreferredSizeWidget
133168 ? ConstrainedBox (
134- constraints: BoxConstraints .loose (leftSide.preferredSize),
169+ constraints: BoxConstraints .loose (
170+ leftSide.preferredSize,
171+ ),
135172 child: leftSide,
136173 )
137174 : leftSide,
138175 const Spacer (),
139176 rightSide is PreferredSizeWidget
140177 ? ConstrainedBox (
141- constraints: BoxConstraints .loose (rightSide.preferredSize),
178+ constraints: BoxConstraints .loose (
179+ rightSide.preferredSize,
180+ ),
142181 child: rightSide,
143182 )
144183 : rightSide,
@@ -147,7 +186,9 @@ class AdaptiveLayoutBuilder extends StatelessWidget {
147186 ),
148187 bottomSide is PreferredSizeWidget
149188 ? ConstrainedBox (
150- constraints: BoxConstraints .loose (bottomSide.preferredSize),
189+ constraints: BoxConstraints .loose (
190+ bottomSide.preferredSize,
191+ ),
151192 child: bottomSide,
152193 )
153194 : bottomSide,
@@ -157,7 +198,8 @@ class AdaptiveLayoutBuilder extends StatelessWidget {
157198 );
158199
159200 // Apply presentation
160- body = presentationBuilder? .call (
201+ body =
202+ presentationBuilder? .call (
161203 context,
162204 body,
163205 backgroundBuilder? .call (context) ?? _defaultBackground (context),
@@ -238,10 +280,7 @@ Widget _defaultPresentation(
238280 fit: StackFit .expand,
239281 children: [
240282 background,
241- Padding (
242- padding: MediaQuery .viewInsetsOf (context),
243- child: body,
244- ),
283+ Padding (padding: MediaQuery .viewInsetsOf (context), child: body),
245284 foreground,
246285 ],
247286 );
0 commit comments