hacktons / convex_bottom_bar

A Flutter package which implements a ConvexAppBar to show a convex tab in the bottom bar. Theming supported.
https://bar.hacktons.cn
Apache License 2.0
801 stars 151 forks source link

add activeIndex For BLOC implementation #114

Open yooman1213 opened 4 years ago

yooman1213 commented 4 years ago

Please add activeIndex For BLOC implementation

Feature explain please implement active Index, so the index can change with a button pressed anywhere by inserting manual index so the current active index is controlled by given BLOC pattern index

Environment details detailed explanation.

ConvexAppBar(
            ///activeIndex: BlocProvider.of<BottomNavigationBloc>(context).currentIndex 
/// so the bottomnavigation index can be controlled by BLOC output
                initialActiveIndex:
                    BlocProvider.of<BottomNavigationBloc>(context).currentIndex,
                style: TabStyle.titled,
                height: 55,
                top: -30,
                curveSize: 88,
                onTap: (index) => BlocProvider.of<BottomNavigationBloc>(context)
                    .add(PageTapped(index: index)),
                activeColor: Colors.white,
                color: Colors.black,
                backgroundColor: color,
                items: [
                  TabItem(icon: MyIcon.home_1, title: "Home"),
                  TabItem(icon: MyIcon.assessment, title: "Empty"),
                  TabItem(icon: MyIcon.qrcode, title: "Empty"),
                  TabItem(icon: MyIcon.qrcode, title: "Empty"),
                  TabItem(icon: MyIcon.assignment, title: "Empty"),
                ],
              )
avenwu commented 4 years ago

I'm no fan of BLOC, will take into consideration

yooman1213 commented 4 years ago

or atleast keep the legacy currentIndex like from the BottomNavigationBar