resolveDisplayCornerRadius static method

double resolveDisplayCornerRadius(
  1. BuildContext context
)

Resolves the native iOS display corner radius (UIScreen._displayCornerRadius) from the ambient MediaQuery geometry.

Mirrors UIKit's _UIParallaxTransitionCardView UICornerConfiguration, which matches the physical hardware screen bezel radius:

  • 62.0 pt on 6.3" / 6.9" Pro models (iPhone 16/17/18 Pro & Pro Max)
  • 55.0 pt on Dynamic Island iPhones (iPhone 14 Pro, 15, 16)
  • 47.33 pt on Notch iPhones (iPhone 12/13/14)
  • 18.0 pt on rounded-screen iPads with a home indicator
  • GlassDefaults.pageTransitionCornerRadius (55.0 pt) when no hardware safe-area insets are present (e.g. desktop previews or widget tests).

Implementation

static double resolveDisplayCornerRadius(BuildContext context) {
  final viewPadding = MediaQuery.maybeViewPaddingOf(context);
  final size = MediaQuery.maybeSizeOf(context);
  if (viewPadding == null || size == null) {
    return GlassDefaults.pageTransitionCornerRadius;
  }

  // Rectangular display or test surface without hardware home indicator.
  if (viewPadding.bottom <= 0.0 && viewPadding.top <= 24.0) {
    return GlassDefaults.pageTransitionCornerRadius;
  }

  final shortestSide = size.shortestSide;
  final longestSide = size.longestSide;

  // Rounded-screen iPads with home indicator.
  if (shortestSide >= 600.0) {
    return viewPadding.bottom > 0.0 ? 18.0 : 0.0;
  }

  // iPhone 16/17/18 Pro & Pro Max (top inset >= 60pt or height >= 870pt).
  if (viewPadding.top >= 60.0 || longestSide >= 870.0) {
    return 62.0;
  }

  // Dynamic Island iPhones (top inset >= 54pt or height >= 800pt).
  if (viewPadding.top >= 54.0 || longestSide >= 800.0) {
    return GlassDefaults.pageTransitionCornerRadius; // 55.0
  }

  // Notch iPhones (iPhone X / 11 / 12 / 13 / 14).
  if (viewPadding.top >= 44.0) {
    return 47.33;
  }

  return GlassDefaults.pageTransitionCornerRadius;
}