frostedEffect method

Color frostedEffect({
  1. double opacity = 0.5,
  2. double frostingFactor = 0.1,
})

Creates a frosted glass effect with a slight blur and transparency. opacity determines transparency and frostingFactor applies the blur-like effect.

Implementation

Color frostedEffect({double opacity = 0.5, double frostingFactor = 0.1}) {
  assert(opacity >= 0.0 && opacity <= 1.0, "Opacity must be between 0.0 and 1.0");
  assert(frostingFactor >= 0.0 && frostingFactor <= 1.0, "Frosting factor must be between 0.0 and 1.0");
  final frostedColor = Color.lerp(this, Colors.grey.shade200, frostingFactor)!;
  return frostedColor.withOpacity(opacity);
}