root_navigator

A flutter package that creates a sub-navigator with routes

Watch on GitHub Star on GitHub

Getting Started

So you want for example a bottom bar with independent navigator view stack.

import 'package:root_navigator/root_navigator.dart';

return MaterialApp(
        theme: config.forceDarkMode ? JTheme.darkTheme : JTheme.lightTheme,
        darkTheme: config.forceLightMode ? JTheme.lightTheme : JTheme.darkTheme,
        localizationsDelegates: [
          // ... app-specific localization delegate[s] here
          GlobalMaterialLocalizations.delegate,
          GlobalWidgetsLocalizations.delegate,
          GlobalCupertinoLocalizations.delegate,
          Localizable.delegate,
        ],
        supportedLocales: Localizable.supportedLocales,
        routes: Screens.routes,
        home: Scaffold(
                  resizeToAvoidBottomPadding: true,
                  body: IndexedStack(
                    index: activeTab,
                    children: [
                        RootNavigator(root: MyPageWidget1(), routes: Screens.routes),
                        RootNavigator(root: MyPageWidget2(), routes: Screens.routes),
                        RootNavigator(root: MyPageWidget3(), routes: Screens.routes),
                    ],
                  ),
                  bottomNavigationBar: TabSelector(
                    activeTab: activeTab,
                    onTabSelected: (tab) =>
                        _changeToTab(tab),
                  ),
));

A working example project is available in the repository.

License

This project is licensed under the MIT License - see the license file for details.

Libraries

root_navigator