0

According to Documentation here. SafeArea should keep the content away from the notch in iPhone X and similar devices but its not working on my pixel3 XL virtual device (I cannot test it on Physical android device as my phone has a pop up camera). Is this feature exclusively for IOS ? Is there any other way to keep my content away from the notch irrespective of the OS and notch dimensions ?

Here's my Code.

void main() {
  runApp(
    MaterialApp(
      debugShowCheckedModeBanner: false,
      title: "SafeArea Demo",
      theme: ThemeData(fontFamily: 'Roboto'),
      home: Scaffold(
        body: Home(),
      ),
    ),
  );
}

class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Stack(
      fit: StackFit.expand,
      children: [
        setBackGround(),
        SafeArea(
          child: Text(
            "Pramod Pardeshi",
            style: TextStyle(color: Color(0xFFFEFEFE), fontSize: 25),
            textScaleFactor: 1.5,
          ),
        ),
        //setGrid(),
      ],
    );
  }

Here's how it look.

Pixel3 XL

2 Answers 2

0

Try to wrap the whole App or at least the Scaffold widget in a Safearea widget.

If that doesn't work it is possible that the emulator that you are using is not reporting its notch. On an actual phone it should work.

1
  • 1
    I would agree with that answer, cause status bar is the same height as notch on real devices Sep 1, 2020 at 9:30
0

@MindStudio is right. found this article on medium. according to it notch has to be enabled from developers options though it can only be done for AVD with android P. there is no mention of lower versions anywhere else, as I was using android Oreo I thought may be that's an issue. I updated it to android Q and It worked!

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.