SwitchBarWidget constructor

const SwitchBarWidget({
  1. Key? key,
  2. required List<SwitchItem> items,
  3. int initialIndex = 0,
  4. double height = 60,
  5. BorderRadiusGeometry? borderRadius = const BorderRadius.all(Radius.circular(20)),
  6. double borderWidth = 1,
  7. Color? borderColor = Colors.transparent,
  8. Color? backgroundColor,
  9. Color? selectedColor = Colors.blueAccent,
  10. Color? unselectedColor,
  11. TextStyle? selectedLabelStyle = const TextStyle(color: Colors.blueAccent, fontSize: 12),
  12. TextStyle? unselectedLabelStyle = const TextStyle(color: Colors.black54, fontSize: 12),
  13. Duration duration = const Duration(milliseconds: 280),
  14. bool isCupertinoStyle = false,
  15. bool isVertical = true,
  16. EdgeInsetsGeometry padding = EdgeInsets.zero,
  17. EdgeInsetsGeometry margin = const EdgeInsets.only(top: 10, bottom: 10),
  18. double itemSpacing = 5,
  19. void onSelected(
    1. SwitchItem item,
    2. int index
    )?,
  20. EdgeInsetsGeometry pagePadding = const EdgeInsets.only(top: 10),
  21. BorderRadiusGeometry pageBorderRadius = const BorderRadius.all(Radius.circular(5)),
  22. bool isSwipToChangePage = true,
  23. double? itemBoxHeight,
  24. IndicatorType indicatorType = IndicatorType.oval,
  25. double indicatorWidthFactor = 0.6,
  26. double indicatorHeight = 2.0,
  27. double dotSize = 6.0,
  28. double indicatorOvalBorder = 10,
  29. bool isShowLabel = false,
  30. 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,
});