decodeTabBarTheme static method

TabBarTheme? decodeTabBarTheme(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the given value to a TabBarTheme. This expects the value to have the following structure:

{
  "indicatorSize": <TabBarIndicatorSize>,
  "labelPadding": <EdgeInsetsGeometry>,
  "labelColor": <Color>,
  "labelStyle": <TextStyle>,
  "unselectedLabelColor": <Color>,
  "unselectedLabelStyle": <TextStyle>,
}

See also:

Implementation

static TabBarTheme? decodeTabBarTheme(
  dynamic value, {
  bool validate = true,
}) {
  TabBarTheme? result;

  if (value is TabBarTheme) {
    result = value;
  } else if (value != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/tab_bar_theme',
      value: value,
      validate: validate,
    ));
    assert(
      value['indicator'] == null,
      'TabBarTheme.indicator is not supported',
    );
    result = TabBarTheme(
      // @unencodable
      // indicator
      indicatorSize: decodeTabBarIndicatorSize(
        value['indicatorSize'],
        validate: false,
      ),
      labelPadding: decodeEdgeInsetsGeometry(
        value['labelPadding'],
        validate: false,
      ),
      labelColor: decodeColor(
        value['labelColor'],
        validate: false,
      ),
      labelStyle: decodeTextStyle(
        value['labelStyle'],
        validate: false,
      ),
      unselectedLabelColor: decodeColor(
        value['unselectedLabelColor'],
        validate: false,
      ),
      unselectedLabelStyle: decodeTextStyle(
        value['unselectedLabelStyle'],
        validate: false,
      ),
    );
  }

  return result;
}