decodeNavigationRailThemeData static method
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>,
"labelType": <NavigationRailLabelType>,
"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.parseDouble(value['elevation']),
groupAlignment: JsonClass.parseDouble(value['groupAlignment']),
indicatorColor: decodeColor(
value['indicatorColor'],
validate: false,
),
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,
),
useIndicator: value['useIndicator'] == null
? null
: JsonClass.parseBool(value['useIndicator']),
);
}
return result;
}