onAnimatedButtonLongPress method

void onAnimatedButtonLongPress()

animated button on long press -> start recording a voice note

Implementation

void onAnimatedButtonLongPress() async {
  if (isText) return;

  final granted = await permissionService.requestMicrophone();
  if (!granted) return;

  _stopWatchTimer.onStartTimer();
  _timerSubscription ??= _stopWatchTimer.rawTime.listen((value) {
    _recordTime = value;
    notifyListeners();
  });

  textController.clear();
  await recordAudio();

  _isRecording = true;
  notifyListeners();
}