decodeButtonBarThemeData static method

ButtonBarThemeData? decodeButtonBarThemeData(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the given value to an ButtonBarThemeData. This expects the given value to follow the structure below:

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

See also:

Implementation

static ButtonBarThemeData? decodeButtonBarThemeData(
  dynamic value, {
  bool validate = true,
}) {
  ButtonBarThemeData? result;

  if (value is ButtonBarThemeData) {
    result = value;
  } else if (value != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/button_bar_theme_data',
      value: value,
      validate: validate,
    ));
    result = ButtonBarThemeData(
      alignment: decodeMainAxisAlignment(
        value['alignment'],
        validate: false,
      ),
      buttonAlignedDropdown: JsonClass.maybeParseBool(
        value['buttonAlignedDropdown'],
      ),
      buttonHeight: JsonClass.maybeParseDouble(value['buttonHeight']),
      buttonMinWidth: JsonClass.maybeParseDouble(value['buttonMinWidth']),
      buttonPadding: decodeEdgeInsetsGeometry(
        value['buttonPadding'],
        validate: false,
      ),
      buttonTextTheme: decodeButtonTextTheme(
        value['buttonTextTheme'],
        validate: false,
      ),
      layoutBehavior: decodeButtonBarLayoutBehavior(
        value['layoutBehavior'],
        validate: false,
      ),
      mainAxisSize: decodeMainAxisSize(
        value['mainAxisSize'],
        validate: false,
      ),
      overflowDirection: decodeVerticalDirection(
        value['overflowDirection'],
        validate: false,
      ),
    );
  }

  return result;
}