ScrollBottomNavigationBar

Hide or show bottom navigation bar while scrolling.

Roadmap

This is currently our roadmap, please feel free to request additions/changes.

Feature Progress
Scrollable
Supports FAB
Supports Snackbar
Gradient background
Pin/unpin
Snap/unsnap
Auto change page
Change page by controller
Listen page changes
Custom scroll controller
Auto attach scroll controller
Animated transitions ?

Usage

Getting started

Add scroll_bottom_navigation_bar package to your project. You can do this following this steps.

Basic implementation

First, you need a ScrollBottomNavigationBarController instance. If you need a custom ScrollController, you can pass the instance on constructor.

final controller = ScrollBottomNavigationBarController(); 
Dart

Now, you can use the ScrollBottomNavigationBar widget in a Scaffold widget, and attach ScrollController instance in your scrollable widget on body.

For simplify your code, you can use the ScrollBody widget as your scrollable widget. This widget takes care of exchanging items from the bottom bar.

NOTE: Showing only essencial code. See example section to a complete implementation.

@override
Widget build(BuildContext context) {
  return Scaffold(
    body: ScrollBody(
      scrollBottomNavigationBarController: controller,
      builder: (context, index) => container(index),
    ),
    bottomNavigationBar: ScrollBottomNavigationBar(
      scrollBottomNavigationBarController: controller,
      items: items,
    ),
  );
}
Dart

ScrollBottomNavigationBarController

You can use the ScrollBottomNavigationBarController instance to manage the behavior of the bottom navigation bar.

// Custom scroll controller
final scrollController = ScrollController();

final controller = ScrollBottomNavigationBarController(
  scrollController: scrollController,
  snap: true, // snap effect
); 
Dart

Change page

controller.changePage(page);
Dart

Check pin state

controller.isPinned;
Dart

Pin

controller.setPinState(true);
Dart

Unpin

controller.setPinState(false);
Dart

Toogle pin state

controller.tooglePin();
Dart

Check snap state

controller.snap;
Dart

Snap

controller.setSnapState(true);
Dart

Unsnap

controller.setSnapState(false);
Dart

Toogle snap state

controller.toogleSnap();
Dart

Listen page changes

controller.pageListener((index) => print(index));
Dart

Dispose

controller.dispose();
Dart

Example

You can also check the example for additional information.

Snapshots

snapshot01

snapshot02

snapshot03

snapshot04

GitHub

https://github.com/EdsonOnildoJR/scroll_bottom_navigation_bar