Skip to main content

Stepper

C2CStepper is a custom Flutter widget that provides an interface for inputting numeric or array values through incremental steps. It supports different types of steppers, such as number and array steppers, and offers customizable visual components and behaviors.

Installation

cpub add c2c_stepper

or

flutter pub add c2c_stepper --hosted-url=https://pub.csp.scrum-dev.com

Example

Number Stepper

C2CStepper.numberStepper(
value: 5.0,
step: 1.0,
minNumberStep: 0.0,
maxNumberStep: 10.0,
onChanged: (value) {
// Handle value change
},
// Additional customizations
);

Array Stepper

C2CStepper.arrayStepper(
steppers: ['Option1', 'Option2', 'Option3'],
maxIndexStep: 2,
minIndexStep: 0,
onChanged: (value) {
// Handle value change
},
// Additional customizations
);

Properties

PropertyDescriptionType
valueThe initial value of the stepper.T?
stepperDelegateA delegate that handles the stepper logic.C2CStepperDelegate
valueViewBuilderCustom widget builder for displaying the stepper's value.C2CStepperValueBuilder<T>?
addButtonViewBuilderCustom widget builder for the "add" button.C2CStepperAddBuilder<T>?
minusButtonViewBuilderCustom widget builder for the "minus" button.C2CStepperMinusBuilder<T>?
isExpandedWidgetExpands the widget if set to true.bool
onChangedCallback when a selection is made.ValueChanged<T?>?
enabledDetermines if the stepper is enabled.bool
valueTextStyleStyle for the value text.TextStyle?
valueDisableColorColor for the value text when the stepper is disabled.Color?
descriptionDisableColorColor for the description text when the stepper is disabled.Color?
descriptionA description that can be either a String or a Widget.dynamic
descriptionTextStyleStyle for the description text.TextStyle?
helperTextHelper text that can be either a String or a Widget.dynamic
errorAn error message that can be either a String or a Widget.dynamic
showErrorMessageShows an error message if true.bool
errorTextStyleStyle for the error text.TextStyle?
helperTextStyleStyle for the helper text.TextStyle?
errorMaxLinesMaximum number of lines for the error text.int?
helperMaxLinesMaximum number of lines for the helper text.int?

C2CStepperValueBuilder<T>

typedef C2CStepperValueBuilder<T> = Widget Function(BuildContext context, bool enabled, T? value);
  • A builder function that creates a custom widget for displaying the stepper's value.
  • context: The build context.
  • enabled: Whether the stepper is enabled.
  • value: The current value of the stepper.

C2CStepperAddBuilder<T>

typedef C2CStepperAddBuilder<T> = Widget Function(BuildContext context, bool enabled, T? value, VoidCallback onPress);
  • A builder function to create a custom widget for the "add" button.
  • context: The build context.
  • enabled: Whether the stepper is enabled.
  • value: The current value of the stepper.
  • onPress: The callback function to execute when the "add" button is pressed.

C2CStepperMinusBuilder<T>

typedef C2CStepperMinusBuilder<T> = Widget Function(BuildContext context, bool enabled, T? value, VoidCallback onPress);
  • A builder function to create a custom widget for the "minus" button.
  • context: The build context.
  • enabled: Whether the stepper is enabled.
  • value: The current value of the stepper.
  • onPress: The callback function to execute when the "minus" button is pressed.