WOIStepper.iconText constructor

WOIStepper.iconText({
  1. Key? key,
  2. required List<String> textItemsList,
  3. Widget? activeSeparatorWidget,
  4. Widget? inactiveSeparatorWidget,
  5. required int activeStateIndex,
  6. EdgeInsets? itemsPadding,
  7. EdgeInsets? saperatorsPadding,
  8. EdgeInsets? backgroundPadding,
  9. BoxDecoration? backgroundDecorator,
  10. EdgeInsets? itemsMargin,
  11. List<Icon>? iconList,
  12. Color? activeColor,
  13. Color? completedColor,
  14. Color? inactiveColor,
  15. Widget? completedIcon,
  16. Widget? activeIcon,
  17. Widget? inactiveIcon,
  18. TextStyle? textStyle,
  19. Axis axis = Axis.horizontal,
  20. double? height,
  21. double? width,
  22. EdgeInsets? textPadding,
})

Creates an instance of WOIStepper as combinations for (optional) icons and text as their items.

The iconList would be used to provide the icons with the items. if iconList is provided then its lenght needs to be equal to that of the textItemsList otherwise it would through error.

activeIcon, inactiveIcon and completedIcon will be displaed based on the state for the item.

Here is a small example on how to use that:

Padding(
  padding: const EdgeInsets.all(10),
  child: WOIStepper.iconText(
    activeStateIndex: currentStepperIndex,
    activeSeparatorWidget: Container(
      height: 2,
      color: Colors.black,
    ),
    textItemsList: const [
      'Step1',
      'Step2',
      'Step3',
    ],
  ),
),

Implementation

WOIStepper.iconText({
  super.key,
  required this.textItemsList,
  this.activeSeparatorWidget,
  this.inactiveSeparatorWidget,
  required this.activeStateIndex,
  this.itemsPadding,
  this.saperatorsPadding,
  this.backgroundPadding,
  this.backgroundDecorator,
  this.itemsMargin,
  List<Icon>? iconList,
  Color? activeColor,
  Color? completedColor,
  Color? inactiveColor,
  Widget? completedIcon,
  Widget? activeIcon,
  Widget? inactiveIcon,
  TextStyle? textStyle,
  this.axis = Axis.horizontal,
  this.height,
  this.width,
  this.textPadding,
})  : assert(textItemsList.length > 1,
          '[textItemsList] length should be greater then 1'),
      assert(
          iconList == null ||
              ((iconList.length == textItemsList.length) || iconList.isEmpty),
          '\n[iconData] length should be equal to [textItemsList]'),
      subtextList = null,
      subtextStyle = null,
      suffixWidgetItemsList = List.generate(
        textItemsList.length,
        (index) => SuffixWidgetStepper(
          widget: iconList != null ? iconList[index] : const SizedBox(),
          inactiveState: inactiveIcon,
          activeState: activeIcon ??
              const Icon(
                Icons.check_circle,
                color: Colors.black,
              ),
          completedState: completedIcon ??
              const Icon(
                Icons.check_circle,
                color: Colors.black,
              ),
        ),
      ),
      inactiveState = StepperStyle(
        textStyle: (textStyle ?? const TextStyle()).copyWith(
          color: inactiveColor,
        ),
      ),
      activeState = StepperStyle(
        textStyle: (textStyle ?? const TextStyle()).copyWith(
          color: activeColor,
        ),
      ),
      completedState = StepperStyle(
        textStyle: (textStyle ?? const TextStyle()).copyWith(
          color: completedColor,
        ),
      ),
      itemActiveDecorator = null,
      itemInactiveDecorator = null,
      itemCompletedDecorator = null;