
| foregroundColor | color for the selection | Theme.of(context). | curve | the curve for the animation | Curves.fastOutSlowIn | | children | A list of ButtonBarEntry to display | required | | borderWidth | width of the border | borderColor != null ? 1.0 : 0.0 | | borderColor | color of the border | null | | backgroundColor | main color of the widget | Theme.of(context).backgroundColor | | animationDuration | animation duration when tap | const Duration(milliseconds: 200) | You can populate it with different types of widgets like IconīackgroundColor: 800,įoregroundColor: 300,īuttonBarEntry(onTap: () => print('First item tapped'), child: Icon(Icons.person)),īuttonBarEntry(onTap: () => print('Second item tapped'), child: Icon(Icons.people)), ButtonBar widget contains three properties: alignment, children, and mainAxisSize. The ButtonBar widget has multiple properties to use however our tutorials. When a widget uses ButtonBarTheme.of, it is automatically rebuilt if the. Descendant widgets obtain the current theme's ButtonBarTheme object using ButtonBarTheme.of. When the directionality is set as ltr ( left to right ) it will arrange the buttons from left to right. We can use any button like FlatButton or Raised button etc., inside this widget. A button bar theme describes the layout and properties for the buttons contained in a ButtonBar. Flutter button bar is used to arrange buttons in a particular order. MainAxisAlignment: MainAxisAlignment.center,īuttonBarEntry(onTap: () => print('First item tapped'), child: Text('Day')),īuttonBarEntry(onTap: () => print('Second item tapped'), child: Text('Week')),īuttonBarEntry(onTap: () => print('Third item tapped'), child: Text('Month')),īuttonBarEntry(onTap: () => print('Fourth item tapped'), child: Text('Year')) Flutter provides the flexibility to arrange the buttons in a bar or a row. Looking for a clean way to show and style multiple buttons ButtonBar is the answer. Applies a button bar theme to descendant ButtonBar widgets. When the Directionality is TextDirection.ltr, the button bar’s children are right justified and the last child becomes the rightmost child.

The children are laid out in a Row with MainAxisAlignment.end.

Then you have to import the package with: import 'package:animated_button_bar/animated_button_bar.dart' Īnd use an AnimatedBarButton like this: Column( In flutter, ButtonBar places the buttons horizontally according to the buttonPadding. Getting started #Īdd this to your app's pubspec.yaml file: dependencies: AnimatedButtonBar is a flutter library that allows you to create a row of buttons with an animation on selection.
