decodeSliderStyle static method
Decodes the object from a Map-like dynamic structure. This expects the JSON format to be of the following structure:
{
"fillColor": <Color>,
"handleOffset": <Point>,
"handlePosition": <SliderHandlePosition>,
"handleSize": <Rectangle>,
"strokeColor": <Color>,
}
See also:
Implementation
static charts.SliderStyle? decodeSliderStyle(
dynamic map, {
bool validate = true,
}) {
charts.SliderStyle? result;
if (map is charts.SliderStyle) {
result = map;
} else if (map != null) {
assert(SchemaValidator.validate(
schemaId: '$_baseSchemaUrl/slider_style',
value: map,
validate: validate,
));
result = charts.SliderStyle(
fillColor: decodeColor(
map['fillColor'],
validate: false,
),
handleOffset: map['point'] == null
? const Point<double>(0, 0)
: Point<double>(
JsonClass.parseDouble(map['point']['x'])!,
JsonClass.parseDouble(map['point']['y'])!,
),
handlePosition: decodeSliderHandlePosition(
map['handlePosition'],
validate: false,
) ??
common.SliderHandlePosition.middle,
handleSize: map['handleSize'] == null
? const Rectangle(0, 0, 10, 20)
: Rectangle(
JsonClass.parseInt(map['handleSize']['left'])!,
JsonClass.parseInt(map['handleSize']['top'])!,
JsonClass.parseInt(map['handleSize']['width'])!,
JsonClass.parseInt(map['handleSize']['height'])!,
),
strokeColor: decodeColor(
map['strokeColor'],
validate: false,
),
);
}
return result;
}