Member-only story

Centering Flutter Adaptive Scaffold Content

Fred Grott
3 min readDec 24, 2022

--

One of the missing classes in the Flutter Adaptive Scaffold is a widget to centered body content. And it gets complicated with the way the Flutter

Adaptive Scaffold supports foldables. Let me show you my own solution to centering both body and second body content in the Flutter Adaptive Scaffold.

How Flutter Adaptive Scaffold Works

1. Only detects hinge to modify content padding as it assumes that when supporting foldables that the same body to second body content relationship exists in non-foldables in mobile and non-mobile.

2. Body slots use the Size construct inside BoxConstraints widgets.

3. The core Adaptive Layout also takes a body orientation.

And you can see that in the source of the Adaptive Layout class:

So the thought process is this in picture form:

--

--

Fred Grott
Fred Grott

No responses yet