generateThemeByMaterial static method

UpThemeData generateThemeByMaterial({
  1. required MaterialColor primaryColor,
  2. MaterialColor? secondaryColor,
  3. MaterialColor? tertiaryColor,
  4. MaterialColor? warnColor,
  5. MaterialColor? linkColor,
  6. 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;
}