decodeButtonBarLayoutBehavior static method

ButtonBarLayoutBehavior? decodeButtonBarLayoutBehavior(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the value to a ButtonBarLayoutBehavior. Supported values are:

  • constrained
  • padded

Implementation

static ButtonBarLayoutBehavior? decodeButtonBarLayoutBehavior(
  dynamic value, {
  bool validate = true,
}) {
  ButtonBarLayoutBehavior? result;

  if (value is ButtonBarLayoutBehavior) {
    result = value;
  } else {
    _checkSupported(
      'ButtonBarLayoutBehavior',
      [
        'constrained',
        'padded',
      ],
      value,
    );

    if (value != null) {
      assert(SchemaValidator.validate(
        schemaId: '$_baseSchemaUrl/button_bar_layout_behavior',
        value: value,
        validate: validate,
      ));
      switch (value) {
        case 'constrained':
          result = ButtonBarLayoutBehavior.constrained;
          break;
        case 'padded':
          result = ButtonBarLayoutBehavior.padded;
          break;
      }
    }
  }

  return result;
}