generateThemeByMaterial static method
UpThemeData
generateThemeByMaterial({
- bool isDark = false,
- required MaterialColor primaryColor,
- required MaterialColor baseColor,
- MaterialColor? secondaryColor,
- MaterialColor? tertiaryColor,
- MaterialColor? warnColor,
- MaterialColor? linkColor,
- MaterialColor? successColor,
Implementation
static UpThemeData generateThemeByMaterial({
bool isDark = false,
required MaterialColor primaryColor,
required MaterialColor baseColor,
MaterialColor? secondaryColor,
MaterialColor? tertiaryColor,
MaterialColor? warnColor,
MaterialColor? linkColor,
MaterialColor? successColor,
}) {
UpThemeData theme = UpThemeData(
isDark: isDark,
baseColor: baseColor,
primaryColor: primaryColor,
secondaryColor: secondaryColor,
tertiaryColor: tertiaryColor,
warnColor: warnColor,
linkColor: linkColor,
successColor: successColor,
primaryStyle: generateStyleByMaterial(
inputColor: primaryColor,
contrastColor: generateMaterialFromSingleColor(
getContrastColor(primaryColor),
),
baseColor: baseColor,
),
basicStyle: generateStyleByMaterial(
inputColor: generateMaterialFromSingleColor(baseColor.shade100),
contrastColor: generateMaterialFromSingleColor(
getContrastColor(baseColor.shade100),
),
baseColor: baseColor,
),
secondaryStyle: generateStyleByMaterial(
inputColor: secondaryColor ?? Colors.purple,
contrastColor: generateMaterialFromSingleColor(
getContrastColor(
secondaryColor ?? Colors.purple,
),
),
baseColor: baseColor,
),
tertiaryStyle: generateStyleByMaterial(
inputColor: tertiaryColor ?? Colors.cyan,
contrastColor: generateMaterialFromSingleColor(
getContrastColor(
tertiaryColor ?? Colors.cyan,
),
),
baseColor: baseColor,
),
warnStyle: generateStyleByMaterial(
inputColor: warnColor ?? Colors.orange,
contrastColor: generateMaterialFromSingleColor(
getContrastColor(
warnColor ?? Colors.orange,
),
),
baseColor: baseColor,
),
linkStyle: generateStyleByMaterial(
inputColor: linkColor ?? Colors.grey,
contrastColor: generateMaterialFromSingleColor(
getContrastColor(
linkColor ?? Colors.grey,
),
),
baseColor: baseColor,
),
successStyle: generateStyleByMaterial(
inputColor: successColor ?? Colors.green,
contrastColor: generateMaterialFromSingleColor(
getContrastColor(
successColor ?? Colors.green,
),
),
baseColor: baseColor,
),
);
return theme;
}