tab_navigation_bar 1.0.2 copy "tab_navigation_bar: ^1.0.2" to clipboard
tab_navigation_bar: ^1.0.2 copied to clipboard

Bottom navigation bar, it has unique indicator mode. When change current index then indicator move.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:tab_navigation_bar/tab_navigation_bar.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        canvasColor: const Color.fromARGB(255, 232, 232, 232),
      ),
      home: const Home(),
    );
  }
}

class Home extends StatefulWidget {
  const Home({Key? key}) : super(key: key);

  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {
  final Color navigationBarColor = Colors.white;
  int selectedIndex = 0;
  late PageController pageController;

  @override
  void initState() {
    super.initState();
    pageController = PageController(initialPage: selectedIndex);
  }

  void _onTabChanged(int index) {
    if (index != 2) {
      setState(() {
        selectedIndex = index;
      });
      pageController.animateToPage(
        selectedIndex,
        duration: const Duration(milliseconds: 400),
        curve: Curves.easeOutQuad,
      );
    }
  }

  @override
  Widget build(BuildContext context) {
    return AnnotatedRegion<SystemUiOverlayStyle>(
      value: SystemUiOverlayStyle(
        systemNavigationBarColor: navigationBarColor,
        systemNavigationBarIconBrightness: Brightness.dark,
      ),
      child: Scaffold(
        floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
        floatingActionButton: FloatingActionButton(
          onPressed: () {},
          child: const Icon(Icons.add),
        ),
        body: PageView(
          physics: const NeverScrollableScrollPhysics(),
          controller: pageController,
          children: <Widget>[
            Container(
              alignment: Alignment.center,
              child: const Icon(
                Icons.favorite,
                size: 56,
                color: Colors.grey,
              ),
            ),
            Container(
              alignment: Alignment.center,
              child: const Icon(
                Icons.feed,
                size: 56,
                color: Colors.grey,
              ),
            ),
            Container(
              alignment: Alignment.center,
              child: const Icon(
                Icons.bookmark,
                size: 56,
                color: Colors.grey,
              ),
            ),
            Container(
              alignment: Alignment.center,
              child: const Icon(
                Icons.person,
                size: 56,
                color: Colors.grey,
              ),
            ),
          ],
        ),
        bottomNavigationBar: BottomAppBar(
          shape: const CircularNotchedRectangle(),
          child: TabNavigationBar(
            indicatorHeight: 8,
            bottomPadding: 12,
            indicatorWidth: 8,
            backgroundColor: Colors.transparent,
            onItemSelected: _onTabChanged,
            selectedIndex: selectedIndex,
            items: const [
              TabNavigationItem(
                activeIcon: Icons.favorite,
                icon: Icons.favorite_outline,
              ),
              TabNavigationItem(
                activeIcon: Icons.feed,
                icon: Icons.feed_outlined,
              ),
              TabNavigationItem(),
              TabNavigationItem(
                activeIcon: Icons.bookmark_rounded,
                icon: Icons.bookmark_border_rounded,
              ),
              TabNavigationItem(
                activeIcon: Icons.person,
                icon: Icons.person_outline,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
12
likes
0
pub points
41%
popularity

Publisher

unverified uploader

Bottom navigation bar, it has unique indicator mode. When change current index then indicator move.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on tab_navigation_bar