build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: TonsOfOtherWidgets(),
),
);
}
Widget
On today's devices, apps rarely get a neat little rectangle to run in.
Notification bars and controls can creep in, and rounded corners and notches nip at your content, complicating layouts.
That's why Flutter has SafeArea.
It uses a MediaQuery to check the dimensions of the screen and pads its shell to match.
So if your app looks like this, wrap it in a SafeArea, and keep your contents safe on both iOS and Android.
You can even specify which dimensions you care about, and wrapping the body of a Scaffold works great.
For more info on SafeArea and all the other Flutter widgets, hit the flutter.io ♪ (music) ♪