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>",
  "indicatorColor": "<Color>",
  "indicatorShape": "<ShapeBorder>",
  "labelType": "<NavigationRailLabelType>",
  "minExtendedWidth": "<double>",
  "minWidth": "<double>",
  "selectedIconTheme": "<IconThemeData>",
  "selectedLabelTextStyle": "<TextStyle>",
  "unselectedIconTheme": "<IconThemeData>",
  "unselectedLabelTextStyle": "<TextStyle>",
  "useIndicator": "<bool>"
}

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.maybeParseDouble(value['elevation']),
      groupAlignment: JsonClass.maybeParseDouble(value['groupAlignment']),
      indicatorColor: decodeColor(
        value['indicatorColor'],
        validate: false,
      ),
      indicatorShape: decodeShapeBorder(
        value['indicatorShape'],
        validate: false,
      ),
      labelType: decodeNavigationRailLabelType(
        value['labelType'],
        validate: false,
      ),
      minExtendedWidth: JsonClass.maybeParseDouble(value['minExtendedWidth']),
      minWidth: JsonClass.maybeParseDouble(value['minWidth']),
      selectedIconTheme: decodeIconThemeData(
        value['selectedIconTheme'],
        validate: false,
      ),
      selectedLabelTextStyle: decodeTextStyle(
        value['selectedLabelTextStyle'],
        validate: false,
      ),
      unselectedIconTheme: decodeIconThemeData(
        value['unselectedIconTheme'],
        validate: false,
      ),
      unselectedLabelTextStyle: decodeTextStyle(
        value['unselectedLabelTextStyle'],
        validate: false,
      ),
      useIndicator: JsonClass.maybeParseBool(value['useIndicator']),
    );
  }

  return result;
}