Buttons TabBar

Pub

Open source Flutter package, tabbar where each tab indicator is a toggle button.

Made by Afonso Raposo.

See the full example here

Screenshots

Install and import the package. Then just customize its parameters.

dependencies:
  flutter:
    sdk: flutter
  buttons_tabbar: ^1.0.1

Default

ButtonsTabBar screen
ButtonsTabBar screen animation

ButtonsTabBar - Examples

Example #1

ButtonsTabBar - Example #1
DefaultTabController(
          length: ...,
          child: Column(
            children: <Widget>[
              ButtonsTabBar(
                unselectedBackgroundColor: Colors.grey[300],
                unselectedLabelStyle: TextStyle(color: Colors.black),
                labelStyle:
                    TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
                tabs: ...,
              ),
              Expanded(
                child: TabBarView(
                  children: ...,
                ),
              ),
            ],
          ),
        )

Example #2

ButtonsTabBar - Example #2
DefaultTabController(
          length: ...,
          child: Column(
            children: <Widget>[
              ButtonsTabBar(
                backgroundColor: Colors.blue[600],
                unselectedBackgroundColor: Colors.white,
                labelStyle:
                    TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
		unselectedLabelStyle: TextStyle(
                    color: Colors.blue[600], fontWeight: FontWeight.bold),
                borderWidth: 1,
                unselectedBorderColor: Colors.blue[600],
                radius: 100,
                tabs: ...,
              ),
              Expanded(
                child: TabBarView(
                  children: ...,
                ),
              ),
            ],
          ),
        )

ButtonsTabBar Parameters

ParameterTypeDescriptionDefault
tabsList<Widget>The tabs to display. Typically a list of two or more Tab widgets.@required
controllerTabControllerThis widget's selection and animation state.DefaultTabController.of
durationintThe duration in milliseconds of the transition animation.250
backgroundColorColorThe background color of the button on its selected state.Colors.blueAccent
unselectedBackgroundColorColorThe background color of the button on its unselected state.Colors.grey
borderWidthdoubleThe with of solid Border for each button. If the value is null, the border is not drawn.null
borderColorColorThe border color of the button on its selected state.Colors.black
unselectedBorderColorColorThe border color of the button on its unselected state. If it's value is null, the Color of borderColor is used.null
labelStyleTextStyleThe TextStyle of the button's Text on its selected state. The color provided on the TextStyle will be used for the Icon's color.TextStyle(color: Colors.white)
unselectedLabelStyleTextStyleThe TextStyle of the button's Text on its unselected state. The color provided on the TextStyle will be used for the Icon's color.TextStyle(color: Colors.black)
physicsScrollPhysicsThe physics used for the ScrollControllerof the tabs list.BouncingScrollPhysics
contentPaddingEdgeInsetsThe EdgeInsets used for the Padding of the buttons' content.EdgeInsets.all(4)
buttonMarginEdgeInsetsThe EdgeInsets used for the Margin of the buttons.EdgeInsets.all(4)
labelSpacingdoubleThe spacing between the Icon and the Text. If only one of those is provided, no spacing is applied.4.0
radiusdoubleThe value of the BorderRadius.circular applied to each button.7.0

Future

If you have any suggestion or problem, let me know and I'll try to improve or fix it.

Versioning

  • v1.0.1 - 21 October 2020
  • v1.0.0+1 - 07 August 2020
  • v0.1.2+1 - 02 August 2020
  • v0.1.1+1 - 16 May 2020
  • v0.1.0+2 - 24 April 2020
  • v0.1.0+1 - 24 April 2020

License

GNU General Public License v3.0, see the LICENSE.md file for details.

Libraries

buttons_tabbar