decodeScrollbarThemeData static method

ScrollbarThemeData? decodeScrollbarThemeData(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the given value to an ScrollbarThemeData. This expects the given value to follow the structure below:

{
  "crossAxisMargin": <double>,
  "interactive": <bool>,
  "mainAxisMargin": <double>,
  "minThumbLength": <double>,
  "radius": <Radius>,
  "thickness": <MaterialStateProperty<double>>,
  "thumbColor": <MaterialStateProperty<Color>>,
  "thumbVisibility": <MaterialStateProperty<bool>>,
  "trackBorderColor": <MaterialStateProperty<Color>>,
  "trackColor": <MaterialStateProperty<Color>>,
  "trackVisibility": <MaterialStateProperty<bool>>,
}

See also:

Implementation

static ScrollbarThemeData? decodeScrollbarThemeData(
  dynamic value, {
  bool validate = true,
}) {
  ScrollbarThemeData? result;

  if (value is ScrollbarThemeData) {
    result = value;
  } else if (value != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/scrollbar_theme_data',
      value: value,
      validate: validate,
    ));
    result = ScrollbarThemeData(
      crossAxisMargin: JsonClass.parseDouble(value['crossAxisMargin']),
      interactive: value['interactive'] == null
          ? null
          : JsonClass.parseBool(value['interactive']),
      mainAxisMargin: JsonClass.parseDouble(value['mainAxisMargin']),
      minThumbLength: JsonClass.parseDouble(value['minThumbLength']),
      radius: decodeRadius(
        value['radius'],
        validate: false,
      ),
      thickness: decodeMaterialStatePropertyDouble(
        value['thickness'],
        validate: false,
      ),
      thumbColor: decodeMaterialStatePropertyColor(
        value['thumbColor'],
        validate: false,
      ),
      thumbVisibility: decodeMaterialStatePropertyBool(
        value['thumbVisibility'],
      ),
      trackBorderColor: decodeMaterialStatePropertyColor(
        value['trackBorderColor'],
        validate: false,
      ),
      trackColor: decodeMaterialStatePropertyColor(
        value['trackColor'],
        validate: false,
      ),
      trackVisibility: decodeMaterialStatePropertyBool(
        value['trackVisibility'],
        validate: false,
      ),
    );
  }

  return result;
}