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": "<WidgetStateProperty<double>>",
  "thumbColor": "<WidgetStateProperty<Color>>",
  "thumbVisibility": "<WidgetStateProperty<bool>>",
  "trackBorderColor": "<WidgetStateProperty<Color>>",
  "trackColor": "<WidgetStateProperty<Color>>",
  "trackVisibility": "<WidgetStateProperty<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.maybeParseDouble(value['crossAxisMargin']),
      interactive: JsonClass.maybeParseBool(value['interactive']),
      mainAxisMargin: JsonClass.maybeParseDouble(value['mainAxisMargin']),
      minThumbLength: JsonClass.maybeParseDouble(value['minThumbLength']),
      radius: decodeRadius(
        value['radius'],
        validate: false,
      ),
      // showTrackOnHover: @deprecated
      thickness: decodeWidgetStatePropertyDouble(
        value['thickness'],
        validate: false,
      ),
      thumbColor: decodeWidgetStatePropertyColor(
        value['thumbColor'],
        validate: false,
      ),
      thumbVisibility: decodeWidgetStatePropertyBool(
        value['thumbVisibility'],
        validate: false,
      ),
      trackBorderColor: decodeWidgetStatePropertyColor(
        value['trackBorderColor'],
        validate: false,
      ),
      trackColor: decodeWidgetStatePropertyColor(
        value['trackColor'],
        validate: false,
      ),
      trackVisibility: decodeWidgetStatePropertyBool(
        value['trackVisibility'],
        validate: false,
      ),
    );
  }

  return result;
}