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>,
  "isAlwaysShown": <bool>,
  "mainAxisMargin": <double>,
  "minThumbLength": <double>,
  "radius": <Radius>,
  "showTrackOnHover": <bool>
  "thickness": <MaterialStateProperty<double>>,
  "thumbColor": <MaterialStateProperty<Color>>,
  "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']),
        isAlwaysShown: value['isAlwaysShown'] == null
            ? null
            : JsonClass.parseBool(value['isAlwaysShown']),
        mainAxisMargin: JsonClass.parseDouble(value['mainAxisMargin']),
        minThumbLength: JsonClass.parseDouble(value['minThumbLength']),
        radius: decodeRadius(
          value['radius'],
          validate: false,
        ),
        showTrackOnHover: value['showTrackOnHover'] == null
            ? null
            : JsonClass.parseBool(value['showTrackOnHover']),
        thickness: decodeMaterialStatePropertyDouble(
          value['thickness'],
          validate: false,
        ),
        thumbColor: decodeMaterialStatePropertyColor(
          value['thumbColor'],
          validate: false,
        ),
        trackBorderColor: decodeMaterialStatePropertyColor(
          value['trackBorderColor'],
          validate: false,
        ),
        trackColor: decodeMaterialStatePropertyColor(
          value['trackColor'],
          validate: false,
        ),
        trackVisibility: decodeMaterialStatePropertyBool(
          value['trackVisibility'],
          validate: false,
        ));
  }

  return result;
}