ButtonBar class Null safety

An end-aligned row of buttons, laying out into a column if there is not enough horizontal space.

Places the buttons horizontally according to the buttonPadding. The children are laid out in a Row with MainAxisAlignment.end. When the Directionality is TextDirection.ltr, the button bar's children are right justified and the last child becomes the rightmost child. When the Directionality TextDirection.rtl the children are left justified and the last child becomes the leftmost child.

If the button bar's width exceeds the maximum width constraint on the widget, it aligns its buttons in a column. The key difference here is that the MainAxisAlignment will then be treated as a cross-axis/horizontal alignment. For example, if the buttons overflow and ButtonBar.alignment was set to MainAxisAlignment.start, the buttons would align to the horizontal start of the button bar.

The ButtonBar can be configured with a ButtonBarTheme. For any null property on the ButtonBar, the surrounding ButtonBarTheme's property will be used instead. If the ButtonBarTheme's property is null as well, the property will default to a value described in the field documentation below.

The children are wrapped in a ButtonTheme that is a copy of the surrounding ButtonTheme with the button properties overridden by the properties of the ButtonBar as described above. These properties include buttonTextTheme, buttonMinWidth, buttonHeight, buttonPadding, and buttonAlignedDropdown.

Used by Dialog to arrange the actions at the bottom of the dialog.

See also:



ButtonBar({Key? key, MainAxisAlignment? alignment, MainAxisSize? mainAxisSize, ButtonTextTheme? buttonTextTheme, double? buttonMinWidth, double? buttonHeight, EdgeInsetsGeometry? buttonPadding, bool? buttonAlignedDropdown, ButtonBarLayoutBehavior? layoutBehavior, VerticalDirection? overflowDirection, double? overflowButtonSpacing, List<Widget> children: const <Widget>[]})
Creates a button bar. [...]


alignment MainAxisAlignment?
How the children should be placed along the horizontal axis. [...]
buttonAlignedDropdown bool?
Overrides the surrounding ButtonThemeData.alignedDropdown to define whether a DropdownButton menu's width will match the button's width. [...]
buttonHeight double?
Overrides the surrounding ButtonThemeData.height to define a button's minimum height. [...]
buttonMinWidth double?
Overrides the surrounding ButtonThemeData.minWidth to define a button's minimum width. [...]
buttonPadding EdgeInsetsGeometry?
Overrides the surrounding ButtonThemeData.padding to define the padding for a button's child (typically the button's label). [...]
buttonTextTheme ButtonTextTheme?
Overrides the surrounding ButtonBarThemeData.buttonTextTheme to define a button's base colors, size, internal padding and shape. [...]
children List<Widget>
The buttons to arrange horizontally. [...]
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
key Key?
Controls how one widget replaces another widget in the tree. [...]
final, inherited
layoutBehavior ButtonBarLayoutBehavior?
Defines whether a ButtonBar should size itself with a minimum size constraint or with padding. [...]
mainAxisSize MainAxisSize?
How much horizontal space is available. See Row.mainAxisSize. [...]
overflowButtonSpacing double?
The spacing between buttons when the button bar overflows. [...]
overflowDirection VerticalDirection?
Defines the vertical direction of a ButtonBar's children if it overflows. [...]
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


build(BuildContext context) Widget
Describes the part of the user interface represented by this widget. [...]
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree. [...]
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
toString({DiagnosticLevel minLevel: DiagnosticLevel.info}) String
A string representation of this object. [...]
toStringDeep({String prefixLineOne: '', String? prefixOtherLines, DiagnosticLevel minLevel: DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants. [...]
toStringShallow({String joiner: ', ', DiagnosticLevel minLevel: DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object. [...]
toStringShort() String
A short, textual description of this widget.


operator ==(Object other) bool
The equality operator. [...]
@nonVirtual, inherited