generateThemeByMaterial static method
UpThemeData
generateThemeByMaterial({
- required MaterialColor primaryColor,
- MaterialColor? secondaryColor,
- MaterialColor? tertiaryColor,
- MaterialColor? warnColor,
- MaterialColor? linkColor,
- MaterialColor? successColor,
Implementation
static UpThemeData generateThemeByMaterial({
required MaterialColor primaryColor,
MaterialColor? secondaryColor,
MaterialColor? tertiaryColor,
MaterialColor? warnColor,
MaterialColor? linkColor,
MaterialColor? successColor,
}) {
MaterialColor contrast = generateMaterialFromSingleColor(Colors.white);
// ThemeData.estimateBrightnessForColor(inputColor[700]!) == Brightness.light
// ? generateMaterialFromSingleColor(Colors.white)
// : generateMaterialFromSingleColor(Colors.black);
UpThemeData theme = UpThemeData(
primaryColor: primaryColor,
secondaryColor: secondaryColor,
tertiaryColor: tertiaryColor,
warnColor: warnColor,
linkColor: linkColor,
successColor: successColor,
primaryStyle: generateStyleByMaterial(primaryColor, contrast),
secondaryStyle:
generateStyleByMaterial(secondaryColor ?? Colors.purple, contrast),
tertiaryStyle:
generateStyleByMaterial(tertiaryColor ?? Colors.cyan, contrast),
warnStyle: generateStyleByMaterial(warnColor ?? Colors.orange, contrast),
linkStyle: generateStyleByMaterial(linkColor ?? Colors.grey, contrast),
successStyle:
generateStyleByMaterial(successColor ?? Colors.green, contrast),
);
return theme;
}