Florian

    Florian

    1 year ago
    If I want to enable dark theme directly in the app settings (that overrides the system settings), I store a Boolean in DataStore or SharedPreferences and pass that to my Theme composable? Is this the correct approach?
    adjpd

    adjpd

    1 year ago
    That's what I did. But now I'm thinking I should react to when the app user selects dark mode, not in my app, but on their phone. That is: give the user an option that says "mirror my phone's theme" and then change my theme accordingly.
    Florian

    Florian

    1 year ago
    yes, I have 3 options now
    light, dark, system default
    that's the most common approach
    the downside of this approach is that I have to wait for the value from preferences before we can render the first screen, right?
    but there is no way around this
    adjpd

    adjpd

    1 year ago
    You could use a default and render the first screen. I'd use the system set light or dark mode, then rerender if the preferences value is different.
    Florian

    Florian

    1 year ago
    yes but this will show a visible color switch when the app starts
    I don't know if that's better