generateThemeByMaterial static method

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