scroll_bottom_navigation_bar 3.0.0 copy "scroll_bottom_navigation_bar: ^3.0.0" to clipboard
scroll_bottom_navigation_bar: ^3.0.0 copied to clipboard

outdated

This package allow hide or show bottom navigation bar while scrolling

example/lib/main.dart

import 'dart:math';

import 'package:flutter/material.dart';
import 'package:scroll_bottom_navigation_bar/scroll_bottom_navigation_bar.dart';

void main() => runApp(App());

class App extends StatelessWidget {
  final controller = ScrollController();

  final items = <BottomNavigationBarItem>[
    BottomNavigationBarItem(
      icon: Icon(Icons.home),
      title: Text("Home"),
    ),
    BottomNavigationBarItem(
      icon: Icon(Icons.settings),
      title: Text("Settings"),
    ),
  ];

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: ValueListenableBuilder<int>(
            valueListenable: controller.bottomNavigationBar.tabNotifier,
            builder: (context, value, child) => items[value].title,
          ),
        ),
        body: Snap(
          controller: controller.bottomNavigationBar,
          child: ValueListenableBuilder<int>(
            valueListenable: controller.bottomNavigationBar.tabNotifier,
            builder: (context, value, child) => ListView.builder(
              controller: controller,
              itemBuilder: _listBuildItem,
            ),
          ),
        ),
        bottomNavigationBar: ScrollBottomNavigationBar(
          controller: controller,
          items: items,
        ),
      ),
    );
  }

  Widget _listBuildItem(BuildContext context, int index) {
    return Container(
      padding: const EdgeInsets.symmetric(vertical: 50),
      color: Color(Random().nextInt(0xffffffff)),
      child: Center(child: Text("$index")),
    );
  }
}
182
likes
40
pub points
82%
popularity

Publisher

unverified uploader

This package allow hide or show bottom navigation bar while scrolling

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

flutter, scroll_bars_common

More

Packages that depend on scroll_bottom_navigation_bar