sampleLuminance static method

double? sampleLuminance(
  1. BuildContext context,
  2. Rect rect
)

Average WCAG relative luminance (0.0 dark – 1.0 light) of the content behind rect (in global/screen coordinates).

Returns null when there is no enclosing GlassContentAwareScope, no GlassContentAwareContent registered with it, or no capture has completed yet (the first frame or two after the scope mounts).

Implementation

static double? sampleLuminance(BuildContext context, Rect rect) {
  return GlassContentAwareScope.maybeOf(context)?.luminanceAt(rect);
}