decodeNavigationBarThemeData static method

NavigationBarThemeData? decodeNavigationBarThemeData(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the given value to an NavigationBarThemeData. This expects the given value to be of the following structure:

{
  "backgroundColor": "<Color>",
  "elevation": "<double>",
  "height": "<double>",
  "iconTheme": "<WidgetStateProperty<IconThemeData>>",
  "indicatorColor": "<Color>",
  "indicatorShape": "<ShapeBorder>",
  "labelBehavior": "<NavigationDestinationLabelBehavior>",
  "labelTextStyle": "<WidgetStateProperty<TextStyle>>",
  "shadowColor": "<Color>",
  "surfaceTintColor": "<Color>"
}

See also:

Implementation

static NavigationBarThemeData? decodeNavigationBarThemeData(
  dynamic value, {
  bool validate = true,
}) {
  NavigationBarThemeData? result;

  if (value is NavigationBarThemeData) {
    result = value;
  } else if (value != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/navigation_bar_theme_data',
      value: value,
      validate: validate,
    ));
    result = NavigationBarThemeData(
      backgroundColor: decodeColor(
        value['backgroundColor'],
        validate: false,
      ),
      elevation: JsonClass.maybeParseDouble(value['elevation']),
      height: JsonClass.maybeParseDouble(value['height']),
      iconTheme: decodeWidgetStatePropertyIconThemeData(
        value['iconTheme'],
        validate: false,
      ),
      indicatorColor: decodeColor(
        value['indicatorColor'],
        validate: false,
      ),
      indicatorShape: decodeShapeBorder(
        value['indicatorShape'],
        validate: false,
      ),
      labelBehavior: decodeNavigationDestinationLabelBehavior(
        value['labelBehavior'],
        validate: false,
      ),
      labelTextStyle: decodeWidgetStatePropertyTextStyle(
        value['labelTextStyle'],
        validate: false,
      ),
      shadowColor: decodeColor(
        value['shadowColor'],
        validate: false,
      ),
      surfaceTintColor: decodeColor(
        value['surfaceTintColor'],
        validate: false,
      ),
    );
  }

  return result;
}