Merge pull request #149 from SMmest3r/dev

disable sleep while countdown is full screen (maybe?)
This commit is contained in:
Márton Kiss 2025-01-27 09:34:06 +01:00 committed by GitHub
commit 13e00f8462
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:animated_flip_counter/animated_flip_counter.dart';
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
import 'package:wakelock_plus/wakelock_plus.dart';
class HeadsUpCountdown extends StatefulWidget {
const HeadsUpCountdown(
@ -30,6 +31,7 @@ class _HeadsUpCountdownState extends State<HeadsUpCountdown> {
void initState() {
super.initState();
elapsed = widget.elapsedTime;
WakelockPlus.enable();
_timer = Timer.periodic(const Duration(seconds: 1), (timer) {
if (elapsed <= widget.maxTime) elapsed += 1;
setState(() {});
@ -46,6 +48,7 @@ class _HeadsUpCountdownState extends State<HeadsUpCountdown> {
void dispose() {
_timer.cancel();
super.dispose();
WakelockPlus.disable();
}
@override

View File

@ -76,6 +76,7 @@ dependencies:
file_picker: ^8.0.5
shake_flutter: ^17.0.0
qr_code_scanner_plus: ^2.0.6
wakelock_plus: ^1.2.10
dev_dependencies:
flutter_lints: ^4.0.0