decodeNavigationRailThemeData static method

NavigationRailThemeData? decodeNavigationRailThemeData(
  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>,
  "elevation": <double>,
  "groupAlignment": <double>,
  "labelType": <NavigationRailLabelType>,
  "selectedIconTheme": <IconThemeData>,
  "selectedLabelTextStyle": <TextStyle>,
  "unselectedIconTheme": <IconThemeData>,
  "unselectedLabelTextStyle": <TextStyle>
}

See also:

Implementation

static NavigationRailThemeData? decodeNavigationRailThemeData(
  dynamic value, {
  bool validate = true,
}) {
  NavigationRailThemeData? result;

  if (value is NavigationRailThemeData) {
    result = value;
  } else if (value != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/navigation_rail_theme_data',
      value: value,
      validate: validate,
    ));
    result = NavigationRailThemeData(
      backgroundColor: decodeColor(
        value['backgroundColor'],
        validate: false,
      ),
      elevation: JsonClass.parseDouble(value['elevation']),
      groupAlignment: JsonClass.parseDouble(value['groupAlignment']),
      labelType: decodeNavigationRailLabelType(
        value['labelType'],
        validate: false,
      ),
      selectedIconTheme: decodeIconThemeData(
        value['selectedIconTheme'],
        validate: false,
      ),
      selectedLabelTextStyle: decodeTextStyle(
        value['selectedLabelTextStyle'],
        validate: false,
      ),
      unselectedIconTheme: decodeIconThemeData(
        value['unselectedIconTheme'],
        validate: false,
      ),
      unselectedLabelTextStyle: decodeTextStyle(
        value['unselectedLabelTextStyle'],
        validate: false,
      ),
    );
  }

  return result;
}