Skip to content

Broken Dark Mode Toggle (The State Management Leak) #945

@vibhutomer

Description

@vibhutomer

Description

In hover_preset_button.dart, the background color is assigned using a reactive GetX variable (themeController.primaryColor.value). However, the widget itself is not wrapped in an Obx stream observer.

Because of this state management leak, if the user switches the app's theme from Light Mode to Dark Mode (or vice versa), this specific button fails to rebuild. It remains stuck displaying the old theme's color palette, resulting in an unreadable UI glitch until the app is fully restarted.

Steps to Reproduce

  1. Navigate to the screen containing the HoverPresetButton (e.g., settings or alarm configuration).
  2. Toggle the application theme from Light Mode to Dark Mode.
  3. Observe that the rest of the UI updates, but the HoverPresetButton background color remains stuck on the Light Mode color.

Expected Behavior

The button should reactively listen to theme changes and update its background color immediately without requiring an app restart.

Proposed Solution

Wrap the widget returning the themeController.primaryColor.value inside an Obx(() => ...) widget so it actively listens to the theme controller's state changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions