SwitchBarWidget constructor
const
SwitchBarWidget({
- Key? key,
- required List<
SwitchItem> items, - int initialIndex = 0,
- double height = 60,
- BorderRadiusGeometry? borderRadius = const BorderRadius.all(Radius.circular(20)),
- double borderWidth = 1,
- Color? borderColor = Colors.transparent,
- Color? backgroundColor,
- Color? selectedColor = Colors.blueAccent,
- Color? unselectedColor,
- TextStyle? selectedLabelStyle = const TextStyle(color: Colors.blueAccent, fontSize: 12),
- TextStyle? unselectedLabelStyle = const TextStyle(color: Colors.black54, fontSize: 12),
- Duration duration = const Duration(milliseconds: 280),
- bool isCupertinoStyle = false,
- bool isVertical = true,
- EdgeInsetsGeometry padding = EdgeInsets.zero,
- EdgeInsetsGeometry margin = const EdgeInsets.only(top: 10, bottom: 10),
- double itemSpacing = 5,
- void onSelected(
- SwitchItem item,
- int index
- EdgeInsetsGeometry pagePadding = const EdgeInsets.only(top: 10),
- BorderRadiusGeometry pageBorderRadius = const BorderRadius.all(Radius.circular(5)),
- bool isSwipToChangePage = true,
- double? itemBoxHeight,
- IndicatorType indicatorType = IndicatorType.oval,
- double indicatorWidthFactor = 0.6,
- double indicatorHeight = 2.0,
- double dotSize = 6.0,
- double indicatorOvalBorder = 10,
- bool isShowLabel = false,
- double? indicatorSpace = 4,
Implementation
const SwitchBarWidget({
super.key,
required this.items,
this.initialIndex = 0,
this.height = 60,
this.borderRadius = const BorderRadius.all(Radius.circular(20)),
this.borderWidth = 1,
this.borderColor = Colors.transparent,
this.backgroundColor,
this.selectedColor = Colors.blueAccent,
this.unselectedColor,
this.selectedLabelStyle = const TextStyle(
color: Colors.blueAccent,
fontSize: 12,
),
this.unselectedLabelStyle = const TextStyle(
color: Colors.black54,
fontSize: 12,
),
this.duration = const Duration(milliseconds: 280),
this.isCupertinoStyle = false,
this.isVertical = true,
this.padding = EdgeInsets.zero,
this.margin = const EdgeInsets.only(top: 10, bottom: 10),
this.itemSpacing = 5,
this.onSelected,
this.pagePadding = const EdgeInsets.only(top: 10),
this.pageBorderRadius = const BorderRadius.all(Radius.circular(5)),
this.isSwipToChangePage = true,
this.itemBoxHeight,
this.indicatorType = IndicatorType.oval,
this.indicatorWidthFactor = 0.6,
this.indicatorHeight = 2.0,
this.dotSize = 6.0,
this.indicatorOvalBorder = 10,
this.isShowLabel = false,
this.indicatorSpace = 4,
});