1. SafeArea - Flutter Widget

random-developer·2022년 10월 9일


목록 보기

Widget build(BuildContext context) {
  return Scaffold(
    body: SafeArea(
      child: TonsOfOtherWidgets(),

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) ♪


0개의 댓글