Should I always use a SafeArea at the top level of my flutter screens?

Viewed 3064

I am curious if I should always use a SafeArea widget at the top level of my screen. I mean....when would I want my content blocked by things like a notch? For me it seems like the answer is never.

So should I not just use SafeArea on every page? If so, should it be above or below the Scaffold widget?

2 Answers

You don't have to use SafeArea on every screen. It actually depends if an App Bar is used or not, because the App Bar automatically calculates the values and adds the required padding.

If you use it above a Scaffold the area where the padding is applied would be black. On the other hand, if you use it below the Scaffold the color of the area would depend on the app theme, probably the Scaffold background color.

If you won't add an app bar or add it. if you want to adjust the screen to be responsive using MediaQuery and you don't need any scroll inside the screen use it.

Use it as the first widget in the body of the scaffold.

Related