fromDynamic static method

JsonScrollbarBuilder? fromDynamic(
  1. dynamic map, {
  2. JsonWidgetRegistry? registry,
})

Builds the builder from a Map-like dynamic structure. This expects the JSON format to be of the following structure:

{
  "controller": <ScrollController>,
  "hoverThickness": <double>,
  "interactive": <bool>,
  "isAlwaysShown": <bool>,
  "notificationPredicate": <ScrollNotificationPredicate>,
  "radius": <Radius>,
  "scrollbarOrientation": <ScrollbarOrientation>,
  "showTrackOnHover": <bool>,
  "thickness": <double>,
  "trackVisibility": <bool>
}

See also:

  • ThemeDecoder.decodeRadius
  • ThemeDecoder.decodeScrollbarOrientation

Implementation

static JsonScrollbarBuilder? fromDynamic(
  dynamic map, {
  JsonWidgetRegistry? registry,
}) {
  JsonScrollbarBuilder? result;
  if (map != null) {
    result = JsonScrollbarBuilder(
      controller: map['controller'],
      hoverThickness: JsonClass.parseDouble(map['hoverThickness']),
      interactive: map['interactive'] == null
          ? null
          : JsonClass.parseBool(
              map['interactive'],
            ),
      isAlwaysShown: map['isAlwaysShown'] == null
          ? null
          : JsonClass.parseBool(
              map['isAlwaysShown'],
            ),
      notificationPredicate: map['notificationPredicate'],
      radius: ThemeDecoder.decodeRadius(
        map['radius'],
        validate: false,
      ),
      scrollbarOrientation: ThemeDecoder.decodeScrollbarOrientation(
        map['scrollbarOrientation'],
        validate: false,
      ),
      showTrackOnHover: map['showTrackOnHover'] == null
          ? null
          : JsonClass.parseBool(
              map['showTrackOnHover'],
            ),
      thickness: JsonClass.parseDouble(map['thickness']),
    );
  }

  return result;
}