createSplashPathMaskClipper method

Path createSplashPathMaskClipper(
  1. Size size
)

Implementation

Path createSplashPathMaskClipper(Size size) {
  // show black screen while initializing
  if (!isInitialized) {
    return Path();
  }

  if (_cachedClipPath != null) {
    return _cachedClipPath!;
  }

  final clippedSpoilerPath = Path.combine(
    PathOperation.intersect,
    // If the fade radius is 0 or the fade animation is disabled, we clip to the entire spoiler region.
    _splashRect == Rect.zero || _config.fadeConfig == null
        ? (Path()..addRect(spoilerBounds))
        : (Path()..addOval(_splashRect)),
    _spoilerPath,
  );

  final finalClipPath = Path.combine(
    PathOperation.difference,
    Path()..addRect(Offset.zero & size),
    clippedSpoilerPath,
  );

  _cachedClipPath = finalClipPath;
  return finalClipPath;
}