mirror of
https://github.com/meditohq/medito-app.git
synced 2024-09-11 20:17:19 +03:00
Fix type null error (#647)
* fix: type null is not a subtype of double error * chore: try/catch removed * chore: fixed naming convention
This commit is contained in:
parent
060b225957
commit
3acf683cb8
@ -173,13 +173,14 @@ class AudioPlayerNotifier extends BaseAudioHandler
|
||||
) {
|
||||
var isEnding = maxDuration.inSeconds > 0 &&
|
||||
position.inSeconds > maxDuration.inSeconds - fadeDurationInSeconds;
|
||||
|
||||
if (isEnding) {
|
||||
_setBgVolumeFadeAtEnd();
|
||||
} else {
|
||||
Future.delayed(Duration(milliseconds: 500), () {
|
||||
setBackgroundSoundVolume(bgVolume);
|
||||
});
|
||||
if (bgVolume != null) {
|
||||
Future.delayed(Duration(milliseconds: 500), () {
|
||||
setBackgroundSoundVolume(bgVolume);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return isEnding;
|
||||
|
@ -29,6 +29,7 @@ final rootCombineProvider = Provider.family<void, BuildContext>((ref, context) {
|
||||
|
||||
void _handleAudioCompletion(Ref ref, BuildContext context) {
|
||||
final audioProvider = ref.read(audioPlayerNotifierProvider);
|
||||
final bgSoundProvider = ref.read(backgroundSoundsNotifierProvider);
|
||||
var extras = audioProvider.mediaItem.value?.extras;
|
||||
if (extras != null) {
|
||||
ref.read(playerProvider.notifier).handleAudioCompletionEvent(
|
||||
@ -38,7 +39,7 @@ void _handleAudioCompletion(Ref ref, BuildContext context) {
|
||||
|
||||
audioProvider.seekValueFromSlider(0);
|
||||
audioProvider.pause();
|
||||
audioProvider.setBackgroundSoundVolume(audioProvider.bgVolume);
|
||||
audioProvider.setBackgroundSoundVolume(bgSoundProvider.volume);
|
||||
audioProvider.stop();
|
||||
ref.invalidate(packProvider);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
|
Loading…
Reference in New Issue
Block a user