flutter_dev_89
flutter_dev_89

Reputation: 45

Keep Navigation rail appears in all app screens

I working on dashboard on ipad device, I created the side navigation bar (NavigationRail), the problem that when I push to another screen inside any navigation rail item the NavigationRail disappear, so is there any way to keep navigation rail in screen even after navigate to another screens inside the same navigation rail item?

thank you

Upvotes: 3

Views: 1498

Answers (1)

Pavel
Pavel

Reputation: 5876

To keep NavigationRail after push, use nested navigator:

Scaffold(
  body: Row(
    children: [
      NavigationRail(
        // ...
      ),
      VerticalDivider(),
      Expanded(
        child: ClipRect(
          child: Navigator(
            onGenerateRoute: (settings) => MaterialPageRoute(
              builder: (context) => Parent(),
            ),
          ),
        ),
      ),
    ],
  ),
)

Then pushing from Parent will replace screen part only inside the Navigator.

Upvotes: 1

Related Questions