mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-24 04:59:26 +01:00
fix: Missing null check
This commit is contained in:
parent
47bce19d4a
commit
8ca1151f3e
@ -42,10 +42,11 @@ class _RecordingDialogState extends State<RecordingDialog> {
|
|||||||
path: _recordedPath, encoder: AudioEncoder.AAC);
|
path: _recordedPath, encoder: AudioEncoder.AAC);
|
||||||
setState(() => _duration = Duration.zero);
|
setState(() => _duration = Duration.zero);
|
||||||
_recorderSubscription?.cancel();
|
_recorderSubscription?.cancel();
|
||||||
_recorderSubscription = Timer.periodic(Duration(seconds: 1), (_) async {
|
_recorderSubscription =
|
||||||
|
Timer.periodic(Duration(milliseconds: 100), (_) async {
|
||||||
_amplitude = await _audioRecorder.getAmplitude();
|
_amplitude = await _audioRecorder.getAmplitude();
|
||||||
setState(() {
|
setState(() {
|
||||||
_duration += Duration(seconds: 1);
|
_duration += Duration(milliseconds: 100);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
@ -71,8 +72,9 @@ class _RecordingDialogState extends State<RecordingDialog> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
const maxDecibalWidth = 64.0;
|
const maxDecibalWidth = 64.0;
|
||||||
final decibalWidth = ((_amplitude.current / _amplitude.max) * 2) *
|
final decibalWidth =
|
||||||
(maxDecibalWidth / 4).toDouble();
|
((_amplitude == null ? 0 : _amplitude.current / _amplitude.max) * 2) *
|
||||||
|
(maxDecibalWidth / 4).toDouble();
|
||||||
final time =
|
final time =
|
||||||
'${_duration.inMinutes.toString().padLeft(2, '0')}:${(_duration.inSeconds % 60).toString().padLeft(2, '0')}';
|
'${_duration.inMinutes.toString().padLeft(2, '0')}:${(_duration.inSeconds % 60).toString().padLeft(2, '0')}';
|
||||||
|
|
||||||
@ -86,7 +88,7 @@ class _RecordingDialogState extends State<RecordingDialog> {
|
|||||||
height: maxDecibalWidth,
|
height: maxDecibalWidth,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: AnimatedContainer(
|
child: AnimatedContainer(
|
||||||
duration: Duration(seconds: 1),
|
duration: Duration(milliseconds: 100),
|
||||||
width: decibalWidth,
|
width: decibalWidth,
|
||||||
height: decibalWidth,
|
height: decibalWidth,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
Loading…
Reference in New Issue
Block a user