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
791 stars 147 forks source link

How to change text styte depends on selected tab? #199

Open RomanSoviak opened 1 year ago

RomanSoviak commented 1 year ago

I have this code and I don't know how to change text Color depends on the tab selection

bottomNavigationBar: StyleProvider(
              style: BookReaderNavigationBarStyle(),
              child: ConvexAppBar(
                style: TabStyle.react,
                items: bottomNavigationItems,
                color: Colors.white,
                backgroundColor: AppColors.greyColor,
                initialActiveIndex: _tabIndex,
                onTap: (int index) {
                  if (index != _tabIndex) {
                    setState(() => _tabIndex = index);
                  }
                },
              ),
            ),

And this is my style:


class BookReaderNavigationBarStyle extends InternalStyle {
  @override
  TextStyle textStyle(Color color, fontFamily) {
    return TextStyle(
      color: Colors.black,
      fontSize: sp(12),
      fontWeight: FontWeight.w400,
      fontFamily: "ReaderStyle",
    );
  }
}
image