ButtonGroup constructor

const ButtonGroup({
  1. Key? key,
  2. Axis direction = Axis.horizontal,
  3. required List<Widget> children,
})

Creates a ButtonGroup that arranges buttons with connected borders.

Parameters:

  • direction (Axis, default: Axis.horizontal): Layout direction for the buttons.
  • children (List

The group automatically handles:

  • Border radius adjustments for first/middle/last buttons
  • Proper sizing with IntrinsicHeight or IntrinsicWidth
  • Stretch alignment for consistent button heights/widths

Example:

ButtonGroup(
  direction: Axis.vertical,
  children: [
    Button.outline(child: Text('Option 1')),
    Button.outline(child: Text('Option 2')),
    Button.outline(child: Text('Option 3')),
  ],
);

Implementation

const ButtonGroup({
  super.key,
  this.direction = Axis.horizontal,
  required this.children,
});