Feature Request: Add Custom Duration for Keeping the Screen Awake
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 66/100
Direzione di ricerca
Start by reading the implementation of WakelockPlus.enable() and its platform interfaces to see how wake lock requests are handled across Android, iOS, macOS, Windows, Linux, and web. Check the existing tests for enable and disable behavior, then trace how a duration could be applied consistently. Done means an optional duration automatically disables the wake lock, while manual disable and indefinite enable continue to work.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
It would be useful to support a custom duration when enabling the wake lock.
Currently, wakelock_plus allows keeping the screen awake indefinitely until WakelockPlus.disable() is called. However, there are use cases where developers only need to keep the screen on for a specific period.
I suggest introducing an optional duration parameter that automatically disables the wake lock after the specified time.
Proposed API
// Keep screen awake for 1 minute.
WakelockPlus.enable(
duration: const Duration(minutes: 1),
);
// Keep screen awake for 2 minutes.
WakelockPlus.enable(
duration: const Duration(minutes: 2),
);
// Keep screen awake indefinitely (current behavior).
WakelockPlus.enable();
Expected Behavior
Accept an optional Duration parameter when enabling the wake lock.
Automatically disable the wake lock when the specified duration expires.
If no duration is provided, preserve the current behavior (keep the screen awake until manually disabled).
Calling disable() manually should still work before the duration expires.
Use Case
For example, in reading or memorization applications, developers may want to prevent the screen from turning off while the user is actively reading, but only for a limited period (e.g., 1 or 2 minutes), without implementing their own timer and manually managing the wake lock lifecycle.
This would make the package more flexible and reduce the need for additional timer logic in applications.
- Lingua principale
- Dart
- Stelle
- 110
- Fork
- 100
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di fluttercommunity/wakelock_plus
-
Web: TypeError: null is not an object (evaluating '_nativeEnabledCompleter.completeError') on overlapping enable() callsForse già presa @FaizanUllahDev l’ha presa 18 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
fluttercommunity/wakelock_plus#117 · 2 commenti · 2 reazioni ·
-
window不能编译Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
Tutte le issue di fluttercommunity/wakelock_plus
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
OscillateLabsLLC/ovos-gui-visage#52 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Docs not reachableApertabug triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
fluttercommunity/plus_plugins#4018 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
VeryGoodOpenSource/vgv_ai_cli#150 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
PATILYASHH/XPENC#206 · 1 commento ·