Mohib Raja
Mohib Raja

Reputation: 1

Why bottomBar Navigation hide when I navigate from dialog or bottom sheet to next Screen?

In flutter, I want to keep bottom bar on all screens but when ever I navigate to any screen from dialog or bottom sheet than Bottom Bar gone hide. How to prevent it from hidden?

Following is my code. I call showTheDialog() from a button click.

showTheDialog() {

showDialog(
    context: context,
    builder: (BuildContext context) {
      return new AlertDialog(
        title: new Text("My Super title"),
        content: new Text("Hello World"),
        actions: [
          TextButton(
            onPressed: () {
              Navigator.pop(context);
              gotoSecondScreen();
            },
            child: Text('Go Forward'),
          )
        ],
      );
    });

}

gotoSecondScreen() {

pushNewScreen(
  mainCon!,
  screen: HomeF1Page(),
  withNavBar: true, // OPTIONAL VALUE. True by default.
  pageTransitionAnimation: PageTransitionAnimation.cupertino,
);

}

Upvotes: 0

Views: 795

Answers (2)

Taylan
Taylan

Reputation: 1

Bottom navigation bar has items and it just loops through these items. You are trying to navigate in another navigation. I guess you can try add a dynamic navigation or you can change your way and you use just bottom navigation bar.

Upvotes: 0

Thanos
Thanos

Reputation: 19

Becuase the bottom bar added is in the previous scafold and when you navigation that widget is moved back and new Scafold widget appear on screen you need to maintain the parent scaffold and in that all the navigators. So that bottom bar will get maintain

Upvotes: 1

Related Questions