decodeTabBarTheme static method
Decodes the given value
to a TabBarTheme. This expects the
value
to have the following structure:
{
"indicatorSize": <TabBarIndicatorSize>,
"labelPadding": <EdgeInsetsGeometry>,
"labelColor": <Color>,
"labelStyle": <TextStyle>,
"mouseCursor": <MaterialStateProperty<MouseCursor>>,
"overlayColor": <MaterialStateProperty<Color>>,
"splashFactory": <InteractiveInkSplashFactory>,
"unselectedLabelColor": <Color>,
"unselectedLabelStyle": <TextStyle>,
}
See also:
Implementation
static TabBarTheme? decodeTabBarTheme(
dynamic value, {
bool validate = true,
}) {
TabBarTheme? result;
if (value is TabBarTheme) {
result = value;
} else if (value != null) {
assert(SchemaValidator.validate(
schemaId: '$_baseSchemaUrl/tab_bar_theme',
value: value,
validate: validate,
));
assert(
value['indicator'] == null,
'TabBarTheme.indicator is not supported',
);
result = TabBarTheme(
// @unencodable
// indicator
indicatorSize: decodeTabBarIndicatorSize(
value['indicatorSize'],
validate: false,
),
labelPadding: decodeEdgeInsetsGeometry(
value['labelPadding'],
validate: false,
),
labelColor: decodeColor(
value['labelColor'],
validate: false,
),
labelStyle: decodeTextStyle(
value['labelStyle'],
validate: false,
),
mouseCursor: decodeMaterialStatePropertyMouseCursor(
value['mouseCursor'],
validate: false,
),
overlayColor: decodeMaterialStatePropertyColor(
value['overlayColor'],
validate: false,
),
splashFactory: decodeInteractiveInkFeatureFactory(
value['splashFactory'],
validate: false,
),
unselectedLabelColor: decodeColor(
value['unselectedLabelColor'],
validate: false,
),
unselectedLabelStyle: decodeTextStyle(
value['unselectedLabelStyle'],
validate: false,
),
);
}
return result;
}