decodeBottomNavigationBarThemeData static method
Decodes the given value
to an BottomNavigationBarThemeData. This
expects the given value
to follow the structure below:
{
"backgroundColor": <Color>,
"elevation": <double>,
"enableFeedback": <bool>,
"landscapeLayout": <BottomNavigationBarLandscapeLayout>,
"selectedIconTheme": <IconThemeData>,
"selectedIconColor": <Color>,
"selectedLabelStyle": <TextStyle>,
"showSelectedLabels": <bool>,
"showUnselectedLabels": <bool>,
"type": <BottomNavigationBarType>,
"unselectedIconTheme": <IconThemeData>,
"unselectedItemColor": <Color>,
"unselectedLabelStyle": <TextStyle>,
}
See also:
Implementation
static BottomNavigationBarThemeData? decodeBottomNavigationBarThemeData(
dynamic value, {
bool validate = true,
}) {
BottomNavigationBarThemeData? result;
if (value is BottomNavigationBarThemeData) {
result = value;
} else if (value != null) {
result = BottomNavigationBarThemeData(
backgroundColor: decodeColor(
value['backgroundColor'],
validate: false,
),
elevation: JsonClass.parseDouble(value['elevation']),
enableFeedback: value['enableFeedback'] == null
? null
: JsonClass.parseBool(value['enableFeedback']),
landscapeLayout:
decodeBottomNavigationBarLandscapeLayout(value['landscapeLayout']),
selectedIconTheme: decodeIconThemeData(
value['selectedIconTheme'],
validate: false,
),
selectedItemColor: decodeColor(
value['selectedItemColor'],
validate: false,
),
selectedLabelStyle: decodeTextStyle(
value['selectedLabelStyle'],
validate: false,
),
showSelectedLabels: value['showSelectedLabels'] == null
? null
: JsonClass.parseBool(value['showSelectedLabels']),
showUnselectedLabels: value['showUnselectedLabels'] == null
? null
: JsonClass.parseBool(value['showUnselectedLabels']),
type: decodeBottomNavigationBarType(
value['type'],
validate: false,
),
unselectedIconTheme: decodeIconThemeData(
value['unselectedIconTheme'],
validate: false,
),
unselectedItemColor: decodeColor(
value['unselectedItemColor'],
validate: false,
),
unselectedLabelStyle: decodeTextStyle(
value['unselectedLabelStyle'],
validate: false,
),
);
}
return result;
}