buttons_tabbar 0.1.1+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 89

Buttons TabBar #

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: ^0.1.1+1

Default

ButtonsTabBar screen
ButtonsTabBar screen animation

Example #

ButtonsTabBar - Example

ButtonsTabBar - Example
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: ...,
                ),
              ),
            ],
          ),
        )


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
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 #

  • 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.

[0.1.1+1] - 16 May 2020 #

Added the possibility of having tabs with no Icon.

[0.1.0+2] - 24 April 2020 #

Added repository to pubspec.

[0.1.0+1] - 24 April 2020 #

Initial release.

example/example.dart

import 'package:buttons_tabbar/buttons_tabbar.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Example(),
    );
  }
}

class Example extends StatefulWidget {
  Example({Key key}) : super(key: key);

  @override
  _ExampleState createState() => _ExampleState();
}

class _ExampleState extends State<Example> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: DefaultTabController(
          length: 6,
          child: Column(
            children: <Widget>[
              ButtonsTabBar(
                backgroundColor: Colors.red,
                unselectedBackgroundColor: Colors.grey[300],
                unselectedLabelStyle: TextStyle(color: Colors.black),
                labelStyle:
                    TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
                tabs: [
                  Tab(
                    icon: Icon(Icons.directions_car),
                    text: "car",
                  ),
                  Tab(
                    icon: Icon(Icons.directions_transit),
                    text: "transit",
                  ),
                  Tab(icon: Icon(Icons.directions_bike)),
                  Tab(icon: Icon(Icons.directions_car)),
                  Tab(icon: Icon(Icons.directions_transit)),
                  Tab(icon: Icon(Icons.directions_bike)),
                ],
              ),
              Expanded(
                child: TabBarView(
                  children: <Widget>[
                    Center(
                      child: Icon(Icons.directions_car),
                    ),
                    Center(
                      child: Icon(Icons.directions_transit),
                    ),
                    Center(
                      child: Icon(Icons.directions_bike),
                    ),
                    Center(
                      child: Icon(Icons.directions_car),
                    ),
                    Center(
                      child: Icon(Icons.directions_transit),
                    ),
                    Center(
                      child: Icon(Icons.directions_bike),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  buttons_tabbar: ^0.1.1+1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:buttons_tabbar/buttons_tabbar.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
77
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
89
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • buttons_tabbar that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test