variantFor method

GlassThemeVariant variantFor(
  1. BuildContext context
)

Retrieves the appropriate theme variant based on the resolved brightness.

Uses the four-level cascade: brightness override → Cupertino pin → Material ThemeMode → system/device. This ensures the correct variant is selected even when the device OS and app theme differ.

Implementation

GlassThemeVariant variantFor(BuildContext context) {
  // Level 1: own brightness override takes absolute priority.
  // Levels 2-4: delegated to the package-private utility.
  final b = brightness ?? resolveGlassBrightness(context);
  return b == Brightness.dark ? dark : light;
}