WOIStepper.icons constructor

WOIStepper.icons({
  1. Key? key,
  2. Widget? activeSeparatorWidget,
  3. Widget? inactiveSeparatorWidget,
  4. required int activeStateIndex,
  5. required List<IconData> iconData,
  6. IconStepperItemStyle? activeIconTheme,
  7. IconStepperItemStyle? inactiveIconTheme,
  8. IconStepperItemStyle? completedIconTheme,
  9. EdgeInsets? itemsPadding,
  10. EdgeInsets? saperatorsPadding,
  11. EdgeInsets? backgroundPadding,
  12. BoxDecoration? backgroundDecorator,
  13. Axis axis = Axis.horizontal,
  14. EdgeInsets? itemsMargin,
  15. double? height,
  16. double? width,
})

Creates an instance of WOIStepper as icons as their items.

The activeIconTheme, inactiveIconTheme and completedIconTheme will be responsible for defining the themes of icons in those states. Here is the small example for this:

Padding(
  padding: const EdgeInsets.all(10),
  child: WOIStepper.icons(
    activeStateIndex: currentStepperIndex,
    activeSeparatorWidget: Container(
      height: 2,
      color: Colors.black,
    ),
    iconData: const [
      Icons.home,
      Icons.person,
      Icons.check,
    ],
    completedIconTheme: IconStepperItemStyle(
      boxDecoration: const BoxDecoration(
        color: Colors.black,
        shape: BoxShape.circle,
      ),
      iconThemeData: const IconThemeData(
        color: Colors.white,
      ),
    ),
  ),
),

Implementation

WOIStepper.icons({
  super.key,
  this.activeSeparatorWidget,
  this.inactiveSeparatorWidget,
  required this.activeStateIndex,
  required List<IconData> iconData,
  IconStepperItemStyle? activeIconTheme,
  IconStepperItemStyle? inactiveIconTheme,
  IconStepperItemStyle? completedIconTheme,
  this.itemsPadding,
  this.saperatorsPadding,
  this.backgroundPadding,
  this.backgroundDecorator,
  this.axis = Axis.horizontal,
  this.itemsMargin,
  this.height,
  this.width,
})  : assert(
          iconData.length > 1, '[iconData] length should be greater then 1'),
      textPadding = null,
      suffixWidgetItemsList = List.generate(
        iconData.length,
        (index) => SuffixWidgetStepper(
          widget: Icon(iconData[index]),
          activeState: (activeIconTheme?.iconThemeData != null)
              ? (IconTheme(
                  data: activeIconTheme!.iconThemeData!,
                  child: Icon(iconData[index]),
                ))
              : null,
          inactiveState: (inactiveIconTheme?.iconThemeData != null)
              ? (IconTheme(
                  data: inactiveIconTheme!.iconThemeData!,
                  child: Icon(iconData[index]),
                ))
              : null,
          completedState: (completedIconTheme?.iconThemeData != null)
              ? (IconTheme(
                  data: completedIconTheme!.iconThemeData!,
                  child: Icon(iconData[index]),
                ))
              : null,
        ),
      ),
      itemActiveDecorator = activeIconTheme?.boxDecoration ??
          BoxDecoration(
            shape: BoxShape.circle,
            color: Colors.white,
            border: Border.all(
              color: Colors.black,
            ),
          ),
      itemInactiveDecorator = inactiveIconTheme?.boxDecoration ??
          BoxDecoration(
            shape: BoxShape.circle,
            color: Colors.white,
            border: Border.all(
              color: Colors.white,
            ),
          ),
      itemCompletedDecorator = completedIconTheme?.boxDecoration ??
          BoxDecoration(
            shape: BoxShape.circle,
            border: Border.all(
              color: Colors.black,
            ),
          ),
      inactiveState = null,
      activeState = null,
      textItemsList = List.generate(
        iconData.length,
        (index) => '',
      ),
      completedState = null,
      subtextList = null,
      subtextStyle = null;