Home > Enterprise >  How to use tabbar as a bottom navigation bar in flutter?
How to use tabbar as a bottom navigation bar in flutter?

Time:01-17

enter image description here

 DefaultTabController(
          length: 3,
          child: Scaffold(
            backgroundColor: ColorConstant.whiteColor,
            body: const TabBarView(
              children: [
                Container(),
                Container(),
                Container(),
              ],
            ),
            bottomNavigationBar: Container(
              height: 9.0.h,
              decoration: const BoxDecoration(
                color: ColorConstant.yellowColor,
                borderRadius: BorderRadius.only(
                  topLeft: Radius.circular(24),
                  topRight: Radius.circular(24),
                ),
              ),
              child: TabBar(
                indicatorSize: TabBarIndicatorSize.tab,
                indicatorPadding: const EdgeInsets.all(12),
                indicator: BoxDecoration(
                  color: ColorConstant.lightYellowColor,
                  borderRadius: BorderRadius.circular(24),
                ),
                tabs: [
                  Tab(
                    child: Image.asset(homeIcon),
                  ),
                  Tab(
                    child: Image.asset(addPostIcon),
                  ),
                  Tab(
                    child: Image.asset(feedIcon),
                  ),
                ],
              ),
            ),
          ),
        );
  • Related