qr_screen_brightness

Minimal Flutter plugin for controlling screen brightness while showing a QR code.

API

QrScreenBrightness.isSupported;
await QrScreenBrightness.getBrightness();
await QrScreenBrightness.setBrightness(1.0);
await QrScreenBrightness.setMaxBrightness();
await QrScreenBrightness.resetBrightness();

setBrightness accepts values from 0.0 to 1.0.

Platform behavior

Android changes only the current activity window brightness. It does not write global system brightness and does not require WRITE_SETTINGS. On reset, Android releases the native window brightness override and lets the system brightness rules take over again.

iOS uses UIScreen.main.brightness. When setting brightness, the plugin remembers both the previous and desired values. resetBrightness restores the previous value only if the current brightness still approximately matches the desired value. This is a best-effort approximation of Android's native override release behavior, while avoiding overwriting manual or external brightness changes.