Search packages, repositories and app categories

Package detailsv0.3.0

custom_navigator

A flutter package that makes it easy to create your own navigator anywhere in the widget tree.

30-day downloads
107
Likes
51
Pub points
40

Install package

flutter pub add custom_navigator

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter package that simplifies the creation of custom navigators within any part of the widget tree. It allows developers to define and manage navigation logic independently of the app's main navigator, enabling modular and reusable navigation components. Ideal for complex UIs with nested or dynamic navigation flows, it promotes clean separation of concerns and enhances testability. The package is lightweight and designed for flexibility without requiring deep integration into the app’s core structure.

Use cases

  • Building modular navigation in large apps
  • Creating nested navigation within widgets
  • Implementing dynamic route management
  • Enabling reusable navigation components
  • Testing navigation logic in isolation

Key features

  • Easy integration anywhere in the widget tree
  • Supports custom route definitions
  • Promotes reusable navigation logic
  • Minimal boilerplate
  • Works independently of the main navigator

Suitable for

  • Developers building complex navigation patterns
  • Teams needing modular UI architecture
  • Apps with dynamic or nested navigation
  • Test-driven development workflows
  • Custom UI components requiring internal navigation

Considerations

  • Not intended as a replacement for MaterialApp.router
  • Requires careful state management when used across multiple contexts
  • May increase complexity if overused in simple apps
  • Limited platform-specific features compared to built-in navigators

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Custom navigator

A flutter package that makes it easy to create your own navigator anywhere in the widget tree.

A common use for such widget is when you need to implement an "Always presenting bottom navigation bar"

Getting Started

First you need to add the package to your pubspec.yaml file.

Custom scaffold

CustomScaffold is a stateful widget that uses the CustomNavigator to to handle item transition of [BottomNavigationBar] with nested navigation while keeping the [BottomNavigationBar] visible!

Usage
// Here's the custom scaffold widget
// It takes a normal scaffold with mandatory bottom navigation bar
// and children who are your pages
CustomScaffold(
      scaffold: Scaffold(
        bottomNavigationBar: BottomNavigationBar(
          items: _items,
        ),
      ),

      // Children are the pages that will be shown by every click
      // They should placed in order such as
      // `page 0` will be presented when `item 0` in the [BottomNavigationBar] clicked.
      children: <Widget>[
        Page('0'),
        Page('1'),
        Page('2'),
      ],

      // Called when one of the [items] is tapped.
      onItemTap: (index) {},
    );

See the custom_scaffold_example for more details


Custom navigator

The CustomNavigator is fairly easy to use

Usage

CustomNavigator(
        home: YourChildWidget(),
        //Specify your page route [PageRoutes.materialPageRoute] or [PageRoutes.cupertinoPageRoute]
        pageRoute: PageRoutes.materialPageRoute,
      );

Then you can call it using the same old Navigator.of(context)

Options
  • you can specify Named routes exactly like in MaterialApp.

if you want to use the default [Navigator] you need to specify a [GlobalKey] to your [MaterialApp] and use it navigatorKey.currentState

See the example for more details.

Categories

Source repository

Projects using this package