decodeRangeSliderTrackShape static method

RangeSliderTrackShape? decodeRangeSliderTrackShape(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the value to a RangeSliderTrackShape. Supported values are:

  • rectangular
  • rounded

Implementation

static RangeSliderTrackShape? decodeRangeSliderTrackShape(
  dynamic value, {
  bool validate = true,
}) {
  RangeSliderTrackShape? result;
  if (value is RangeSliderTrackShape) {
    result = value;
  } else {
    _checkSupported(
      'RangeSliderTrackShape',
      [
        'rectangular',
        'rounded',
      ],
      value,
    );

    if (value != null) {
      assert(SchemaValidator.validate(
        schemaId: '$_baseSchemaUrl/range_slider_track_shape',
        value: value,
        validate: validate,
      ));
      switch (value) {
        case 'rectangular':
          result = RectangularRangeSliderTrackShape();
          break;

        case 'rounded':
          result = RoundedRectRangeSliderTrackShape();
          break;
      }
    }
  }
  return result;
}