device_screen_brightness 0.2.0
device_screen_brightness: ^0.2.0 copied to clipboard
Control the screen brightness from Flutter. Provides getBrightness, setBrightness, incrementBrightness, decrementBrightness and streamBrightness with synchronous and compute-based async variants. Uses [...]
0.2.0 #
BrightnessModeenum — all brightness methods now accept an optionalmodeparameter (BrightnessMode.apporBrightnessMode.system).BrightnessMode.app(Android): adjusts the current Activity window brightness — no permission required.BrightnessMode.system(Android, default): writesSettings.System.SCREEN_BRIGHTNESS— requiresWRITE_SETTINGS.- On iOS, macOS, Linux and Windows the parameter is ignored.
- Added
hasPermission()andrequestPermission()— AndroidWRITE_SETTINGShelpers (no-op on other platforms). - Updated example app with a
SegmentedButtonto toggle between app and system mode.
0.1.0 #
- Unified C API:
device_screen_brightness_get,_set,_increment,_decrement. - Backend pattern:
DeviceScreenBrightnessBackendabstract class withFfiBackendandAndroidBackend. - All brightness values normalized to int 0–100.
abstract final class DeviceScreenBrightnesspublic facade.streamBrightness()with 250 ms polling.*Computevariants viaFlutter.compute.- 6 typed exceptions:
UnsupportedOperationException,InvalidBrightnessValueException,NativeBackendException,BrightnessObservationException,BackendNotAvailableException,PermissionDeniedException. - iOS: UIScreen.mainScreen.brightness (UIKit).
- macOS: IOKit (IODisplayGetFloatParameter).
- Linux: sysfs backlight (no external dependencies).
- Windows: Physical Monitor API (dxva2).
- Android: Settings.System via JNIgen.
- CI: analyze, dry-run, build-linux, build-windows.
- CD: OIDC Trusted Publisher via
dart-lang/setup-dart.