# check notch

bool isNeedSafeArea = MediaQuery.of(context).viewPadding.bottom > 0;

# result

before

SafeArea(
  top: true,
  bottom: false,
  child: Scaffold(
    ...
    bottomSheet: Container(
      height: 60,
      color: CustomColors.skinlogMain140.withOpacity(0.95),
     ...

after

SafeArea(
  top: true,
  bottom: false,
  child: Scaffold(
    ...
    bottomSheet: Container(
      height: isNeedSafeArea ? 80 : 60,
      color: CustomColors.skinlogMain140.withOpacity(0.95),
     ...

SafeArea

before

SafeArea(
  top: true,
  bottom: true,
  child: Scaffold(
    ...
    bottomSheet: Container(
      height: isNeedSafeArea ? 80 : 60,
      color: CustomColors.skinlogMain140.withOpacity(0.95),

cf.

Whether to avoid system intrusions on the bottom side of the screen.

SafeArea(
  top: true,
  bottom: false,
  child : ...
)

top

bottom

cf.

https://stackoverflow.com/questions/58848681/how-do-i-check-if-device-needs-safearea-needs-bottom-top-padding

You can check if the top and bottom padding> 0 to see if the user's device has a notch to it:

window.viewPadding
profile
𝙸 𝚊𝚖 𝚊 𝚌𝚞𝚛𝚒𝚘𝚞𝚜 𝚍𝚎𝚟𝚎𝚕𝚘𝚙𝚎𝚛 𝚠𝚑𝚘 𝚎𝚗𝚓𝚘𝚢𝚜 𝚍𝚎𝚏𝚒𝚗𝚒𝚗𝚐 𝚊 𝚙𝚛𝚘𝚋𝚕𝚎𝚖. 🇰🇷👩🏻‍💻

0개의 댓글