GlassSegmentedControl constructor
const
GlassSegmentedControl({
- required List<
String> segments, - required int selectedIndex,
- required ValueChanged<
int> onSegmentSelected, - Key? key,
- double height = GlassDefaults.heightControl,
- double borderRadius = GlassDefaults.borderRadius,
- EdgeInsetsGeometry padding = const EdgeInsets.all(2),
- TextStyle? selectedTextStyle,
- TextStyle? unselectedTextStyle,
- Color? backgroundColor,
- Color? indicatorColor,
- LiquidGlassSettings? indicatorSettings,
- LiquidGlassSettings? glassSettings,
- bool useOwnLayer = false,
- GlassQuality quality = GlassQuality.standard,
- GlobalKey<
State< ? backgroundKey,StatefulWidget> >
Creates a glass segmented control.
Implementation
const GlassSegmentedControl({
required this.segments,
required this.selectedIndex,
required this.onSegmentSelected,
super.key,
this.height = GlassDefaults.heightControl,
this.borderRadius = GlassDefaults.borderRadius,
this.padding = const EdgeInsets.all(2),
this.selectedTextStyle,
this.unselectedTextStyle,
this.backgroundColor,
this.indicatorColor,
this.indicatorSettings,
this.glassSettings,
this.useOwnLayer = false,
this.quality = GlassQuality.standard,
this.backgroundKey,
}) : assert(
segments.length >= 2,
'GlassSegmentedControl requires at least 2 segments',
),
assert(
selectedIndex >= 0 && selectedIndex < segments.length,
'selectedIndex must be within bounds of segments list',
);