auto_scaffold 1.0.4
auto_scaffold: ^1.0.4 copied to clipboard

Automatically switch between a bottom tab bar and a left drawer

auto_scaffold #

With increasing screen size a drawer becomes more common. On smartphones bottom navigation bars are often used. This plugin helps to automatically switch between those depending on the screen size.

On small screens a bottom navigation bar can be used (default on small screens): Bottom Navigation Bar

On small screens a default drawer can be used (tabBarDisabled: true): Drawer mobile

On large screens (like tablet or desktop) the drawer is collapsible and is not shown as overlay above the content: Drawer desktop

Features #

► Automatically switch between collapsible app drawer (position left) and bottom navigation bar depending on screen width

► Disable bottom navigation tab bar on small devices and then use regular drawer instead (without collapse button)

► Show tooltips if the drawer is collapsed on mouse hover on Desktop

► Hide drawer leading if the drawer is collapsed

Getting started #

Use AutoScaffold instead of Scaffold.

In the pubspec.yaml of your flutter project, add the following dependency:

  auto_scaffold: <latest_version>

In your library add the following import:

import 'package:auto_scaffold/app_scaffold.dart';
import 'package:auto_scaffold/navigation_item.dart';

For help getting started with Flutter, view the online documentation.

Example #

class Example extends StatefulWidget {
  _ExampleState createState() => _ExampleState();

class _ExampleState extends State<Example> {

  _ExampleState(): super();

  int _selectedPageIndex = 0;
  String _appBarTitle = 'Home';

  Widget build(BuildContext context) {
    return AutoScaffold(
      appBar: AppBar(
        title: Text(_appBarTitle),
      tabBarDisabled: true,
      drawerLeading: Icon(Icons.favorite, color:,
      drawerTitle: Text('Your App',
          style: TextStyle(color: Theme.of(context).textTheme.bodyText1.color)),
      unselectedNavigationItemColor: Colors.black54,
      onPageSelected: (int pageIndex) {
        setState(() {
          _selectedPageIndex = pageIndex;

          switch (_selectedPageIndex) {
            case 0: _appBarTitle = 'Home'; break;
            case 1: _appBarTitle = 'Settings'; break;
      currentIndex: _selectedPageIndex,
      navigationItems: [
          name: 'Home',
          iconData: Icon(Icons.home),
          route: '/',
          body: Text('Home')
            name: 'Settings',
            iconData: Icon(Icons.settings),
            route: '/settings',
            body: Text('Settings'),

Contributions #

Feel free to contribute to this project.

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue. If you fixed a bug or implemented a new feature, please send a pull request.

pub points

Automatically switch between a bottom tab bar and a left drawer

Repository (GitHub)
View/report issues


API reference



Apache 2.0 (LICENSE)




Packages that depend on auto_scaffold