Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Wrong theme applied on first app launch until backgrounded

Aperta Adatta ai principianti
#699 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@akshadpai ci sta già lavorando.

Dal 12/6/2026.

  • #700 di @akshadpai — aperta

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
86/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
dart, flutter
Ambito
mobile-dev

Direzione di ricerca

Inizia in lib/service/styles.dart, in Styles._getSelectedTheme(), e segui il percorso del primo avvio quando Storage().selectedTheme è null. Assicurati che il tema di sistema predefinito sia disponibile per la selezione locale prima della risoluzione, quindi verifica che una nuova installazione selezioni il tema chiaro o scuro del dispositivo senza mandare l’app in background.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

When an app is launched for the very first time after a fresh install (no persisted theme preference), the wrong theme is applied (e.g. the light theme while the device is in dark mode). Sending the app to the background and reopening it corrects the theme.

Root Cause

Styles._getSelectedTheme() in lib/service/styles.dart:

String? selectedTheme = Storage().selectedTheme;
if (selectedTheme == null) {
  Storage().selectedTheme = AppThemes.system;   // persists default, but local var stays null
}

if (selectedTheme == AppThemes.system) {        // still null on first launch -> skipped
  ...resolve to light/dark...
}
return selectedTheme;                            // returns null on first launch

On first launch Storage().selectedTheme is null. The default AppThemes.system is written to storage but the local selectedTheme variable is not updated, so the system->light/dark resolution is skipped and the method returns null. _applySelectedTheme() then falls back to the un-themed 'default' theme instead of the device-appropriate one.

On a later resume, updateFromNet() -> build() -> _getSelectedTheme() runs again; by then Storage().selectedTheme is persisted as 'system', resolution succeeds, and notifyChanged rebuilds with the correct theme — which is why backgrounding 'fixes' it.

Fix

Update the local variable when defaulting:

if (selectedTheme == null) {
  selectedTheme = Storage().selectedTheme = AppThemes.system;
}
Lingua principale
Dart
Stelle
3
Fork
4
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rokwire/app-flutter-plugin

Tutte le issue di rokwire/app-flutter-plugin

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.