stylish_bottom_bar 0.0.9 copy "stylish_bottom_bar: ^0.0.9" to clipboard
stylish_bottom_bar: ^0.0.9 copied to clipboard

outdated

A collection of stylish bottom navigation bar like animated bottom bar and bubble bottom bar for flutter.

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:stylish_bottom_bar/stylish_bottom_bar.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Stylish Bottm Navigation Bar Example',
      theme: ThemeData(
        primarySwatch: Colors.green,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({
    Key? key,
  }) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  var selected;

  var bgColor;
  var heart = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      extendBody: true, //to make floating action button notch transparent
      body: AnimatedContainer(
        duration: Duration(milliseconds: 2000),
        color: bgColor ?? Colors.red.withOpacity(0.5),
        child: SafeArea(
          child: Padding(
            padding: const EdgeInsets.only(top: 30.0),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                StylishBottomBar(
                  items: [
                    BubbleBarItem(
                      backgroundColor: Colors.deepPurple,
                      icon: Icon(
                        Icons.home,
                      ),
                      badge: Text(
                        ' 1 ',
                        style: TextStyle(
                          color: Colors.white,
                        ),
                      ),
                      badgeRadius: BorderRadius.circular(12),
                      showBadge: true,
                      badgeColor: Colors.red,
                      activeIcon: Icon(Icons.home),
                      title: Text("Home"),
                      borderColor: Colors.purple,
                    ),
                    BubbleBarItem(
                        backgroundColor: Colors.green,
                        icon: Icon(
                          Icons.add,
                          color: Colors.black,
                        ),
                        activeIcon: Icon(
                          Icons.add_circle_outline_outlined,
                          color: Colors.green,
                        ),
                        title: Text(
                          "Add",
                        )),
                    BubbleBarItem(
                      backgroundColor: Colors.pinkAccent,
                      icon: Icon(
                        Icons.person,
                      ),
                      title: Text(
                        "Profile",
                      ),
                    ),
                  ],

                  // inkColor: Colors.yellow,
                  barStyle: BubbleBarStyle.vertical,
                  currentIndex: selected ?? 0,
                  onTap: (index) {
                    setState(() {
                      selected = index;
                    });
                  },

                  iconSize: 38,
                  inkEffect: true,
                  opacity: 0.2,
                  hasNotch: false,
                  bubbleFillStyle: BubbleFillStyle.fill,
                  padding: EdgeInsets.all(4),
                ),
                SizedBox(
                  height: 30.0,
                ),
                BubbleNavigationBar(
                  items: [
                    BubbleBarItem(
                        backgroundColor: Colors.deepPurple,
                        icon: Icon(
                          Icons.home,
                        ),
                        activeIcon: Icon(Icons.home),
                        title: Text("Home")),
                    BubbleBarItem(
                        backgroundColor: Colors.green,
                        icon: Icon(
                          Icons.add,
                          color: Colors.black,
                        ),
                        activeIcon: Icon(
                          Icons.add_circle_outline_outlined,
                          color: Colors.green,
                        ),
                        title: Text(
                          "Add",
                        )),
                    BubbleBarItem(
                      backgroundColor: Colors.pinkAccent,
                      icon: Icon(
                        Icons.person,
                      ),
                      title: Text(
                        "Profile",
                      ),
                    ),
                  ],
                  unselectedIconColor: Colors.black,
                  // inkColor: Colors.yellow,
                  barStyle: BubbleBarStyle.horizotnal,
                  currentIndex: selected ?? 0,
                  onTap: (index) {
                    setState(() {
                      selected = index;
                    });
                  },
                  iconSize: 38,
                  inkEffect: true,
                  opacity: 0.2,
                  hasNotch: false,
                ),
              ],
            ),
          ),
        ),
      ),
      bottomNavigationBar: StylishBottomBar(
        items: [
          AnimatedBarItems(
              icon: Icon(
                Icons.house_outlined,
              ),
              selectedIcon: Icon(Icons.house_rounded),
              selectedColor: Colors.deepPurple,
              backgroundColor: Colors.amber,
              title: Text('Home')),
          AnimatedBarItems(
              icon: Icon(Icons.map_outlined),
              selectedIcon: Icon(Icons.map),
              selectedColor: Colors.green,
              backgroundColor: Colors.amber,
              title: Text('Map')),
          AnimatedBarItems(
              icon: Icon(
                Icons.person,
              ),
              backgroundColor: Colors.amber,
              selectedColor: Colors.pinkAccent,
              title: Text('Profile')),
          // BubbleBarItem(icon: Icon(Icons.abc), title: Text('Abc')),
          // BubbleBarItem(icon: Icon(Icons.safety_divider), title: Text('Safety')),
          // BubbleBarItem(icon: Icon(Icons.cabin), title: Text('Cabin')),
        ],
        iconSize: 32,
        // barAnimation: BarAnimation.fade,
        // iconStyle: IconStyle.animated,

        iconStyle: IconStyle.Default,
        hasNotch: true,
        fabLocation: StylishBarFabLocation.end,
        opacity: 0.3,
        currentIndex: selected ?? 0,
        onTap: (index) {
          setState(() {
            selected = index;
          });
        },
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          setState(() {
            heart = !heart;
          });
        },
        backgroundColor: Colors.white,
        child: Icon(
          heart ? CupertinoIcons.heart_fill : CupertinoIcons.heart,
          color: Colors.red,
        ),
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.endDocked,
      // backgroundColor:
      //     bgColor != null ? bgColor.withOpacity(1.0) : Colors.white,
    );
  }
}

//
//Example to setup Stylish Bottom Bar with PageView
class PageExample extends StatefulWidget {
  const PageExample({Key? key}) : super(key: key);

  @override
  _PageExampleState createState() => _PageExampleState();
}

class _PageExampleState extends State<PageExample> {
  PageController controller = PageController(initialPage: 0);
  var selected = 0;

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: PageView(
        controller: controller,
        // physics: NeverScrollableScrollPhysics(),
        children: [
          //Home(),
          //Add(),
          //Profile(),
        ],
      ),
      bottomNavigationBar: AnimatedNavigationBar(
        fabLocation: StylishBarFabLocation.end,
        hasNotch: true,
        items: [
          AnimatedBarItems(
              icon: Icon(
                Icons.home,
              ),
              selectedColor: Colors.deepPurple,
              backgroundColor: Colors.amber,
              title: Text('Home')),
          AnimatedBarItems(
              icon: Icon(
                Icons.add_circle_outline,
              ),
              selectedColor: Colors.green,
              backgroundColor: Colors.amber,
              title: Text('Add')),
          AnimatedBarItems(
              icon: Icon(
                Icons.person,
              ),
              backgroundColor: Colors.amber,
              selectedColor: Colors.pinkAccent,
              title: Text('Profile')),
        ],
        iconSize: 32,
        barAnimation: BarAnimation.transform3D,
        opacity: 0.3,
        currentIndex: selected,
        onTap: (index) {
          setState(() {
            selected = index!;
            controller.jumpToPage(index);
          });
        },
      ),
    );
  }
}
176
likes
0
pub points
96%
popularity

Publisher

verified publishermarsad.dev

A collection of stylish bottom navigation bar like animated bottom bar and bubble bottom bar for flutter.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on stylish_bottom_bar