lukepighetti / salomon_bottom_bar

Yet another bottom navigation bar, but with a few key promises.
https://pub.dev/packages/salomon_bottom_bar
MIT License
258 stars 55 forks source link

SalomonBottomBar with GetX #39

Closed benedictcontawe closed 1 year ago

benedictcontawe commented 1 year ago

Not updating current index Graphics UI fpr BottomNavigationBarWidget with SalomonBottomBarItem

benedictcontawe commented 1 year ago

Solve!

class BottomNavigationBarWidget extends BaseWidget<MainController> {

  const BottomNavigationBarWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return Obx( () {
      return SalomonBottomBar(
          currentIndex: controller.getIndex(),
          duration: const Duration(milliseconds: 1000),
          onTap: (index) {
            controller.setIndex(index);
            //return controller.getIndex();
          },
          items: [
            /// Home
            SalomonBottomBarItem(
              icon: Icon(Icons.home),
              title: Text("Shop"),
              selectedColor: Colors.purple,
            ),

            SalomonBottomBarItem(
                icon: Icon(Icons.shopping_basket),
                title: Text("Cart"),
                selectedColor: Colors.blue),

            /// Likes
            SalomonBottomBarItem(
              icon: Icon(Icons.favorite_border),
              title: Text("Likes"),
              selectedColor: Colors.pink,
            ),

            /// Search
            SalomonBottomBarItem(
              icon: Icon(Icons.search),
              title: Text("Search"),
              selectedColor: Colors.orange,
            ),

            /// Profile
            SalomonBottomBarItem(
              icon: Icon(Icons.person),
              title: Text("Profile"),
              selectedColor: Colors.teal,
            ),
          ],
        );
    } );
  } 
}