diff --git a/lib/pages/recording_dialog.dart b/lib/pages/recording_dialog.dart index c575c6d9..f79a116b 100644 --- a/lib/pages/recording_dialog.dart +++ b/lib/pages/recording_dialog.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:path_provider/path_provider.dart'; import 'package:record/record.dart'; +import 'package:wakelock/wakelock.dart'; class RecordingDialog extends StatefulWidget { static const String recordingFileType = 'aac'; @@ -35,6 +36,7 @@ class _RecordingDialogState extends State { setState(() => error = true); return; } + await Wakelock.enable(); await _audioRecorder.start( path: _recordedPath, encoder: AudioEncoder.AAC); setState(() => _duration = Duration.zero); @@ -55,6 +57,7 @@ class _RecordingDialogState extends State { @override void dispose() { + Wakelock.disable(); _recorderSubscription?.cancel(); _audioRecorder.stop(); super.dispose(); diff --git a/pubspec.lock b/pubspec.lock index a57b3990..565b8f0f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1501,7 +1501,7 @@ packages: source: hosted version: "1.2.0+11" wakelock: - dependency: transitive + dependency: "direct main" description: name: wakelock url: "https://pub.dartlang.org" diff --git a/pubspec.yaml b/pubspec.yaml index a563af8a..561a76c3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -68,6 +68,7 @@ dependencies: universal_html: ^2.0.8 url_launcher: ^6.0.9 vrouter: 1.2.0+11 + wakelock: ^0.5.3+3 dev_dependencies: dapackages: ^1.6.0