ReactiveSleekCircularSlider<T> constructor Null safety

  1. {Key? key,
  2. String? formControlName,
  3. InputDecoration? decoration,
  4. FormControl<T>? formControl,
  5. ValidationMessagesFunction<T>? validationMessages,
  6. ControlValueAccessor<T, double>? valueAccessor,
  7. ShowErrorsFunction? showErrors,
  8. double min = 0,
  9. double max = 100,
  10. CircularSliderAppearance appearance = SleekCircularSlider.defaultAppearance,
  11. OnChange? onChangeStart,
  12. OnChange? onChange,
  13. OnChange? onChangeEnd,
  14. OnChangeMode onChangeMode = OnChangeMode.onChange,
  15. InnerWidget? innerWidget,
  16. Alignment alignment = Alignment.topCenter,
  17. double widthFactor = 1,
  18. double heightFactor = 1,
  19. Clip clipBehavior = Clip.hardEdge}

Creates a ReactiveSleekCircularSlider that contains a TouchSpin.

Can optionally provide a formControl to bind this widget to a control.

Can optionally provide a formControlName to bind this ReactiveFormField to a FormControl.

Must provide one of the arguments formControl or a formControlName, but not both at the same time.

Can optionally provide a validationMessages argument to customize a message for different kinds of validation errors.

Can optionally provide a valueAccessor to set a custom value accessors. See ControlValueAccessor.

Can optionally provide a showErrors function to customize when to show validation messages. Reactive Widgets make validation messages visible when the control is INVALID and TOUCHED, this behavior can be customized in the showErrors function.


Binds a text field.

final form ={'email': Validators.required});

  formControlName: 'email',

Binds a text field directly with a FormControl.

final form ={'email': Validators.required});

  formControl: form.control('email'),

Customize validation messages

  formControlName: 'email',
  validationMessages: {
    ValidationMessage.required: 'The email must not be empty', 'The email must be a valid email',

Customize when to show up validation messages.

  formControlName: 'email',
  showErrors: (control) => control.invalid && control.touched && control.dirty,

For documentation about the various parameters, see the TouchSpin class and new TouchSpin, the constructor.


  Key? key,
  String? formControlName,
  InputDecoration? decoration,
  FormControl<T>? formControl,
  ValidationMessagesFunction<T>? validationMessages,
  ControlValueAccessor<T, double>? valueAccessor,
  ShowErrorsFunction? showErrors,
  double min = 0,
  double max = 100,
  CircularSliderAppearance appearance = SleekCircularSlider.defaultAppearance,
  OnChange? onChangeStart,
  OnChange? onChange,
  OnChange? onChangeEnd,
  OnChangeMode onChangeMode = OnChangeMode.onChange,
  InnerWidget? innerWidget,
  Alignment alignment = Alignment.topCenter,
  double widthFactor = 1,
  double heightFactor = 1,
  Clip clipBehavior = Clip.hardEdge,
}) : super(
        key: key,
        formControl: formControl,
        formControlName: formControlName,
        valueAccessor: valueAccessor,
        validationMessages: validationMessages,
        showErrors: showErrors,
        builder: (field) {
          final InputDecoration effectiveDecoration = (decoration ??
                  const InputDecoration())

          return Listener(
            onPointerDown: (_) {
              if (field.control.enabled) {
            child: InputDecorator(
              decoration: effectiveDecoration.copyWith(
                errorText: field.errorText,
                enabled: field.control.enabled,
              child: ClipRect(
                clipBehavior: clipBehavior,
                child: Align(
                  alignment: alignment,
                  heightFactor: heightFactor,
                  widthFactor: widthFactor,
                  child: Padding(
                    // ClipRect for some reason clips shadow on top and bottom
                    padding: EdgeInsets.symmetric(
                      vertical: (appearance.customWidths?.shadowWidth ??
                              appearance.progressBarWidth) *
                    child: SleekCircularSlider(
                      initialValue: field.value ?? 0,
                      min: min,
                      max: max,
                      appearance: appearance,
                      onChange: onChangeMode == OnChangeMode.onChange
                          ? field.didChange
                          : onChange,
                          onChangeMode == OnChangeMode.onChangeStart
                              ? field.didChange
                              : onChangeStart,
                      onChangeEnd: onChangeMode == OnChangeMode.onChangeEnd
                          ? field.didChange
                          : onChangeEnd,
                      innerWidget: innerWidget,