Responsive Navigation Bar

Loading preview

Starting the Flutter app

A Flutter responsive navigation bar with app bar links on wide screens and a drawer on narrow ones.

Get the source

Add it to your project

Copies the Dart source into your app, so you own it. Flutter SDK only, no extra packages.

First time? Run dart pub global activate fluttertemplates_dev, or read the CLI guide.

How it works

MediaQuery width above 800 shows _navBarItems inline in the AppBar; below that, a menu button opens _drawer, both built from _menuItems. Links, drawer rows and the _ProfileIcon menu all call _select, which stores _selected, highlights the match, updates the body text and shows a demo SnackBar. The drawer closes itself first. ThemeData.dark() is forced on the whole page, overriding your app theme.

Adapting it

  • Remove the Theme wrapper, or supply your own dark theme.
  • Turn _menuItems into label and route pairs, then navigate from _select.
  • Rename the Menu values, and update the switch in _ProfileIcon.