fromDynamic static method

JsonLinearProgressIndicatorBuilder? 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:

{
  "backgroundColor": <Color>,
  "color": <Color>,
  "minHeight": <double>,
  "semanticsLabel": <String>,
  "semanticsValue": <String>,
  "value": <double>,
  "valueColor": <Animation<Color> | Color>
}

See also:

  • ThemeDecoder.decodeTextBaseline

Implementation

static JsonLinearProgressIndicatorBuilder? fromDynamic(
  dynamic map, {
  JsonWidgetRegistry? registry,
}) {
  JsonLinearProgressIndicatorBuilder? result;

  if (map != null) {
    result = JsonLinearProgressIndicatorBuilder(
      backgroundColor: ThemeDecoder.decodeColor(
        map['backgroundColor'],
        validate: false,
      ),
      color: ThemeDecoder.decodeColor(
        map['color'],
        validate: false,
      ),
      minHeight: JsonClass.parseDouble(map['minHeight']),
      semanticsLabel: map['semanticsLabel'],
      semanticsValue: map['semanticsValue'],
      value: JsonClass.parseDouble(map['value']),
      valueColor: map['valueColor'] == null
          ? null
          : map['valueColor'] is Animation
              ? map['valueColor']
              : AlwaysStoppedAnimation(
                  ThemeDecoder.decodeColor(
                    map['valueColor'],
                    validate: false,
                  )!,
                ),
    );
  }

  return result;
}