decodeNavigationBarThemeData static method

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

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

{
  "backgroundColor": <Color>,
  "height": <double>,
  "iconTheme": <MaterialStateProperty<IconThemeData>>,
  "indicatorColor": <Color>,
  "labelBehavior": <NavigationDestinationLabelBehavior>,
  "labelTextStyle": <MaterialStateProperty<TextStyle>>
}

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,
      ),
      height: JsonClass.parseDouble(value['height']),
      iconTheme: decodeMaterialStatePropertyIconThemeData(
        value['iconTheme'],
        validate: false,
      ),
      indicatorColor: decodeColor(
        value['indicatorColor'],
        validate: false,
      ),
      labelBehavior: decodeNavigationDestinationLabelBehavior(
        value['labelBehavior'],
        validate: false,
      ),
      labelTextStyle: decodeMaterialStatePropertyTextStyle(
        value['labelTextStyle'],
        validate: false,
      ),
    );
  }

  return result;
}