diff --git a/example/lib/pages/components/stepper_input_example.dart b/example/lib/pages/components/stepper_input_example.dart index e3ae6cfc..f03fa351 100644 --- a/example/lib/pages/components/stepper_input_example.dart +++ b/example/lib/pages/components/stepper_input_example.dart @@ -28,7 +28,7 @@ class _StepperInputExampleState extends State { ), ZetaStepperInput(rounded: false), ZetaStepperInput( - size: ZetaWidgetSize.large, + size: ZetaStepperInputSize.large, onChange: (_) {}, ), ].divide(const SizedBox(height: 16)).toList(), diff --git a/example/widgetbook/pages/components/stepper_input_widgetbook.dart b/example/widgetbook/pages/components/stepper_input_widgetbook.dart index 810e325c..e57fb11f 100644 --- a/example/widgetbook/pages/components/stepper_input_widgetbook.dart +++ b/example/widgetbook/pages/components/stepper_input_widgetbook.dart @@ -8,12 +8,12 @@ import '../../utils/utils.dart'; Widget stepperInputUseCase(BuildContext context) { return WidgetbookTestWidget( widget: ZetaStepperInput( - initialValue: context.knobs.intOrNull.input(label: 'Initial value'), - min: context.knobs.intOrNull.input(label: 'Minimum value'), - max: context.knobs.intOrNull.input(label: 'Maximum value'), + initialValue: context.knobs.int.input(label: 'Initial value'), + min: context.knobs.int.input(label: 'Minimum value'), + max: context.knobs.int.input(label: 'Maximum value'), size: context.knobs.list( label: 'Size', - options: ZetaWidgetSize.values, + options: ZetaStepperInputSize.values, labelBuilder: enumLabelBuilder, ), rounded: context.knobs.boolean(label: 'Rounded', initialValue: true), diff --git a/lib/src/components/stepper_input/stepper_input.dart b/lib/src/components/stepper_input/stepper_input.dart index 8530341d..417cc1ff 100644 --- a/lib/src/components/stepper_input/stepper_input.dart +++ b/lib/src/components/stepper_input/stepper_input.dart @@ -4,12 +4,21 @@ import 'package:flutter/services.dart'; import '../../../zeta_flutter.dart'; +/// Sizes for [ZetaStepperInput] +enum ZetaStepperInputSize { + /// Medium + medium, + + /// Large + large, +} + /// A stepper input, also called numeric stepper, is a common UI element that allows uers to input a number or value simply by clicking the plus and minus buttons. class ZetaStepperInput extends StatefulWidget { /// Creates a new [ZetaStepperInput] const ZetaStepperInput({ this.rounded = true, - this.size = ZetaWidgetSize.medium, + this.size = ZetaStepperInputSize.medium, this.initialValue, this.min, this.max, @@ -24,7 +33,7 @@ class ZetaStepperInput extends StatefulWidget { final bool rounded; /// The size of the stepper input. - final ZetaWidgetSize size; + final ZetaStepperInputSize size; /// The initial value of the stepper input. /// @@ -47,7 +56,7 @@ class ZetaStepperInput extends StatefulWidget { super.debugFillProperties(properties); properties ..add(DiagnosticsProperty('rounded', rounded)) - ..add(EnumProperty('size', size)) + ..add(EnumProperty('size', size)) ..add(IntProperty('initialValue', initialValue)) ..add(IntProperty('min', min)) ..add(IntProperty('max', max)) @@ -88,7 +97,7 @@ class _ZetaStepperInputState extends State { } double get _height { - if (widget.size != ZetaWidgetSize.large) { + if (widget.size != ZetaStepperInputSize.large) { return ZetaSpacing.x10; } else { return ZetaSpacing.x12; @@ -128,7 +137,7 @@ class _ZetaStepperInputState extends State { ? ZetaIcons.remove_round : ZetaIcons.remove_sharp, type: ZetaButtonType.outlineSubtle, - size: widget.size == ZetaWidgetSize.small ? ZetaWidgetSize.medium : widget.size, + size: widget.size == ZetaStepperInputSize.medium ? ZetaWidgetSize.medium : ZetaWidgetSize.large, borderType: widget.rounded ? ZetaWidgetBorder.rounded : ZetaWidgetBorder.sharp, onPressed: !_disabled ? () => _onChange(