updateColors method

void updateColors(
  1. Color buttonColor
)

Updates the colors based on the given buttonColor.

Implementation

void updateColors(Color buttonColor) {
  Color grad1;
  Color grad2;
  Color grad3;
  Color grad4;
  Color innerBg;
  Color buttons;
  if (SettingsSharedPref.getTheme() == 'dark') {
    grad1 = Color.fromARGB(255, 34, 34, 34);
    grad2 = Color.fromARGB(255, 34, 34, 34);
    grad3 = Color.fromARGB(255, 68, 68, 68);
    grad4 = Color.fromARGB(255, 102, 102, 102);
    innerBg = Color.fromARGB(255, 26, 26, 26);
    buttons = Color.fromARGB(255, 85, 85, 85);
  } else if (SettingsSharedPref.getTheme() == 'light') {
    grad1 = Color(0xFFF9F9F8);
    grad2 = Color(0xFFF2F3F2);
    grad3 = Color(0xFFECECEB);
    grad4 = Color(0xFFE5E6E4);

    innerBg = Colors.white;
    if (isNearWhite(buttonColor)) {
      buttons = Color.fromARGB(255, 210, 208, 208);
    } else {
      buttons = buttonColor;
    }
    // buttons = buttonColor;
  } else {
    grad1 = adjustColor(buttonColor, 0.4);
    grad2 = adjustColor(buttonColor, 0.6);
    grad3 = adjustColor(buttonColor, 0.8);
    grad4 = adjustColor(buttonColor, 1.0);
    innerBg = Colors.white;
    buttons = buttonColor;
  }

  gradient4 = grad4;
  gradient3 = grad3;
  gradient2 = grad2;
  gradient1 = grad1;
  innerBackground = innerBg;
  buttonColors = buttons;

  if (SettingsSharedPref.getTheme() == 'light') {
    darkShadow = Colors.white;
    midShadow = Colors.white;
    shadow = Colors.white;
  } else {
    darkShadow = lightenColor(buttons, 0.4); // Light shadow
    midShadow = lightenColor(buttons, 0.6); // Medium shadow
    shadow = lightenColor(buttons, 0.8); // Dark shadow
  }
}