ScreenBrightness Service

Provides access to control and observe system and application screen brightness.

**Platform Support:**

  • Android
  • iOS
  • **Android Configuration:** To adjust system brightness on Android, add the following permission in pyproject.toml:

    [tool.flet.android.permission]
    "android.permission.WRITE_SETTINGS" = true
    

    **Inheritance:** Inherits from Service.

    Events

  • **on_application_screen_brightness_change** (EventHandler | None)
  • * Type: ScreenBrightnessChangeEvent * Description: Called when the application screen brightness changes.
  • **on_system_screen_brightness_change** (EventHandler | None)
  • * Type: ScreenBrightnessChangeEvent * Description: Called when the system screen brightness changes.

    Methods

  • **can_change_system_screen_brightness()** -> bool
  • * Returns whether the app is allowed to change the system screen brightness.
  • **get_application_screen_brightness()** -> float
  • * Returns the current application screen brightness, in range 0.0..1.0.
  • **get_system_screen_brightness()** -> float
  • * Returns the current system screen brightness, in range 0.0..1.0.
  • **is_animate()** -> bool
  • * Returns True if brightness changes are animated (platform dependent).
  • **is_auto_reset()** -> bool
  • * Returns True if brightness resets automatically on lifecycle changes.
  • **reset_application_screen_brightness()**
  • * Resets the application screen brightness back to the system value.
  • **set_animate(animate: bool)**
  • * Enables or disables animation for brightness changes.
  • **set_application_screen_brightness(brightness: Number)**
  • * Sets the application screen brightness. Accepts values between 0.0 and 1.0.
  • **set_auto_reset(auto_reset: bool)**
  • * Enables or disables automatic reset to system brightness on lifecycle changes.
  • **set_system_screen_brightness(brightness: Number)**
  • * Sets the system screen brightness. Accepts values between 0.0 and 1.0.