fromDynamic static method

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

{
  alignment: <MainAxisAlignment>,
  buttonAlignedDropdown: <bool>,
  buttonHeight: <double>,
  buttonMinWidth: <double>,
  buttonPadding: <EdgeInsetsGeometry>,
  buttonTextTheme: <ButtonTextTheme>,
  layoutBehavior: <ButtonBarLayoutBehavior>,
  mainAxisSize: <MainAxisSize>,
  overflowButtonSpacing: <double>,
  overflowDirection: <VerticalDirection>,
}

See also:

  • ThemeDecoder.decodeTextBaseline

Implementation

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

  if (map != null) {
    result = JsonButtonBarBuilder(
      alignment: ThemeDecoder.decodeMainAxisAlignment(map['alignment']),
      buttonAlignedDropdown: map['buttonAlignedDropdown'] == null
          ? null
          : JsonClass.parseBool(map['buttonAlignedDropdown']),
      buttonHeight: JsonClass.parseDouble(map['buttonHeight']),
      buttonMinWidth: JsonClass.parseDouble(map['buttonMinWidth']),
      buttonPadding:
          ThemeDecoder.decodeEdgeInsetsGeometry(map['buttonPadding']),
      buttonTextTheme:
          ThemeDecoder.decodeButtonTextTheme(map['buttonTextTheme']),
      layoutBehavior:
          ThemeDecoder.decodeButtonBarLayoutBehavior(map['layoutBehavior']),
      mainAxisSize: ThemeDecoder.decodeMainAxisSize(map['mainAxisSize']),
      overflowButtonSpacing:
          JsonClass.parseDouble(map['overflowButtonSpacing']),
      overflowDirection:
          ThemeDecoder.decodeVerticalDirection(map['overflowDirection']),
    );
  }

  return result;
}