fix: RecordingDialog

This commit is contained in:
Christian Pauly 2021-05-01 15:49:29 +02:00
parent f3b0092bf0
commit e74b102ecf

View File

@ -1,6 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
@ -18,10 +17,8 @@ class RecordingDialog extends StatefulWidget {
} }
class _RecordingDialogState extends State<RecordingDialog> { class _RecordingDialogState extends State<RecordingDialog> {
String time = '00:00:00';
Timer _recorderSubscription; Timer _recorderSubscription;
Duration _duration; Duration _duration = Duration.zero;
bool error = false; bool error = false;
String _recordedPath; String _recordedPath;
@ -70,7 +67,10 @@ class _RecordingDialogState extends State<RecordingDialog> {
} }
const maxDecibalWidth = 64.0; const maxDecibalWidth = 64.0;
final decibalWidth = final decibalWidth =
min(_duration.inSeconds % 2 / 2, maxDecibalWidth).toDouble(); ((_duration.inSeconds % 2) + 1) * (maxDecibalWidth / 2).toDouble();
final time =
'${_duration.inMinutes.toString().padLeft(2, '0')}:${(_duration.inSeconds % 60).toString().padLeft(2, '0')}';
return AlertDialog( return AlertDialog(
content: Row( content: Row(
children: <Widget>[ children: <Widget>[