mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 14:59:29 +01:00
fix: Keep display alive while recording
This commit is contained in:
parent
b3e3419508
commit
ddba6c2ad6
@ -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<RecordingDialog> {
|
||||
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<RecordingDialog> {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
Wakelock.disable();
|
||||
_recorderSubscription?.cancel();
|
||||
_audioRecorder.stop();
|
||||
super.dispose();
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user