Home > Mobile >  Flutter navigator hides (covers) first window conent
Flutter navigator hides (covers) first window conent

Time:10-06

Why when I use the navigator to go to another page(widget) that covers just part of the screen, I can't see the first-page content (which is on top of the page)?

enter image description here

enter image description here

I tried code from this example (enter image description here

CodePudding user response:

use this class instead of your class

    class SecondRoute extends StatelessWidget {
  const SecondRoute({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Second Route'),
      ),
      body: Container(
      padding:const EdgeInsets.only(top:128),
        child: Center(
          child: ElevatedButton(
            onPressed: () {
              Navigator.pop(context);
            },
            child: const Text('Go back!'),
          ),
        ),
      ),
    );
  }
}
  • Related