isFilled property

bool isFilled

Whether the chip's has solid background color or not

Implementation

bool get isFilled {
  Color? color = backgroundColor;
  final opacity = backgroundOpacity;
  final alpha = backgroundAlpha;

  const kOpacityThreshold = 0.4;
  const kAlphaThreshold = 102;

  if (color != null) {
    color = colorWithOpacity(color, opacity);
    color = colorWithAlpha(color, alpha);
    final colorIsNotTransparent = color != colorTransparent;
    final colorIsSolid = color.opacity > kOpacityThreshold;
    return colorIsNotTransparent && colorIsSolid;
  }

  final isSolidByOpacity = opacity != null && opacity > kOpacityThreshold;
  final isSolidByAlpha = alpha != null && alpha > kAlphaThreshold;

  return isSolidByOpacity || isSolidByAlpha;
}