CupertinoMultipleSegmentedControl constructor

CupertinoMultipleSegmentedControl({
  1. Key? key,
  2. required List<Widget> children,
  3. required List<bool> isSelected,
  4. required dynamic onPressed(
    1. int index
    )?,
  5. Color? unselectedColor,
  6. Color? selectedColor,
  7. Color? borderColor,
  8. Color? pressedColor,
  9. EdgeInsetsGeometry? padding,
})

Creates an iOS-style segmented control bar.

The children and onValueChanged arguments must not be null. The children argument must be an ordered Map such as a LinkedHashMap. Further, the length of the children list must be greater than one.

Each widget value in the map of children must have an associated key that uniquely identifies this widget. This key is what will be returned in the onValueChanged callback when a new value from the children map is selected.

The groupValue is the currently selected value for the segmented control. If no groupValue is provided, or the groupValue is null, no widget will appear as selected. The groupValue must be either null or one of the keys in the children map.

Implementation

CupertinoMultipleSegmentedControl({
  Key? key,
  required this.children,
  required this.isSelected,
  required this.onPressed,
  this.unselectedColor,
  this.selectedColor,
  this.borderColor,
  this.pressedColor,
  this.padding,
})  : assert(children.length == isSelected.length,
          'The children and isSelected parameters must have the same length'),
      super(key: key);