decodeSliderTrackShape static method
Decodes the given value
to a SliderTrackShape. This expects the
value
to have an attribute named "type" that is one of the following
values:
rectangular
rounded
The schema for the rest of the attributes depends on the "type".
Type: rectangular
{
"type": "rectangular"
}
Type: rounded
{
"type": "rounded"
}
See also:
Implementation
static SliderTrackShape? decodeSliderTrackShape(
dynamic value, {
bool validate = true,
}) {
SliderTrackShape? result;
if (value is SliderTrackShape) {
result = value;
} else {
assert(value == null || value['type'] is String);
_checkSupported(
'type',
[
'rectangular',
'rounded',
],
value == null ? null : value['type'],
);
if (value != null) {
assert(SchemaValidator.validate(
schemaId: '$_baseSchemaUrl/slider_track_shape',
value: value,
validate: validate,
));
String? type = value['type'];
switch (type) {
case 'rectangular':
result = RectangularSliderTrackShape();
break;
case 'rounded':
result = RoundedRectSliderTrackShape();
break;
}
}
}
return result;
}