Reputation: 1890
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?
Upvotes: 14
Views: 9761
Reputation: 5135
You don't have to use SafeArea
on every screen. It actually depends if an AppBar
is used or not, because the AppBar
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.
Upvotes: 17
Reputation: 56
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.
Upvotes: 1