onAnimatedButtonLongPressEnd method
animated button on Long Press End
Implementation
void onAnimatedButtonLongPressEnd(LongPressEndDetails details) async {
final source = await stopRecord();
// Stop
_stopWatchTimer.onStopTimer();
// Reset
_stopWatchTimer.onResetTimer();
if (!isText && await micPermission.isGranted) {
if (_position > cancelPosition - _height || source == null) {
log('canceled');
handleRecord(null, true);
onSlideToCancelRecord();
} else {
final audioMessage = ChatMessage(
isSender: true,
chatMedia: ChatMedia(
url: source,
mediaType: MediaType.audioMediaType(),
),
);
handleRecord(audioMessage, false);
}
_duration = 600;
_position = 0;
_isRecording = false;
notifyListeners();
}
}