chore: Update audioplayers

This commit is contained in:
Christian Pauly 2021-06-06 10:50:26 +02:00
parent 91c29ae266
commit f82ce1b000
3 changed files with 9 additions and 9 deletions

View File

@ -45,7 +45,7 @@ class _AudioPlayerState extends State<AudioPlayerWidget> {
@override @override
void dispose() { void dispose() {
if (audioPlayer.state == AudioPlayerState.PLAYING) { if (audioPlayer.state == PlayerState.PLAYING) {
audioPlayer.stop(); audioPlayer.stop();
} }
onAudioPositionChanged?.cancel(); onAudioPositionChanged?.cancel();
@ -87,7 +87,7 @@ class _AudioPlayerState extends State<AudioPlayerWidget> {
void _playAction() async { void _playAction() async {
if (AudioPlayerWidget.currentId != widget.event.eventId) { if (AudioPlayerWidget.currentId != widget.event.eventId) {
if (AudioPlayerWidget.currentId != null) { if (AudioPlayerWidget.currentId != null) {
if (audioPlayer.state != AudioPlayerState.STOPPED) { if (audioPlayer.state != PlayerState.STOPPED) {
await audioPlayer.stop(); await audioPlayer.stop();
setState(() => null); setState(() => null);
} }
@ -95,13 +95,13 @@ class _AudioPlayerState extends State<AudioPlayerWidget> {
AudioPlayerWidget.currentId = widget.event.eventId; AudioPlayerWidget.currentId = widget.event.eventId;
} }
switch (audioPlayer.state) { switch (audioPlayer.state) {
case AudioPlayerState.PLAYING: case PlayerState.PLAYING:
await audioPlayer.pause(); await audioPlayer.pause();
break; break;
case AudioPlayerState.PAUSED: case PlayerState.PAUSED:
await audioPlayer.resume(); await audioPlayer.resume();
break; break;
case AudioPlayerState.STOPPED: case PlayerState.STOPPED:
default: default:
onAudioPositionChanged ??= onAudioPositionChanged ??=
audioPlayer.onAudioPositionChanged.listen((state) { audioPlayer.onAudioPositionChanged.listen((state) {
@ -143,12 +143,12 @@ class _AudioPlayerState extends State<AudioPlayerWidget> {
? CircularProgressIndicator(strokeWidth: 2) ? CircularProgressIndicator(strokeWidth: 2)
: IconButton( : IconButton(
icon: Icon( icon: Icon(
audioPlayer.state == AudioPlayerState.PLAYING audioPlayer.state == PlayerState.PLAYING
? Icons.pause_outlined ? Icons.pause_outlined
: Icons.play_arrow_outlined, : Icons.play_arrow_outlined,
color: widget.color, color: widget.color,
), ),
tooltip: audioPlayer.state == AudioPlayerState.PLAYING tooltip: audioPlayer.state == PlayerState.PLAYING
? L10n.of(context).audioPlayerPause ? L10n.of(context).audioPlayerPause
: L10n.of(context).audioPlayerPlay, : L10n.of(context).audioPlayerPlay,
onPressed: () { onPressed: () {

View File

@ -70,7 +70,7 @@ packages:
name: audioplayers name: audioplayers
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.18.3" version: "0.19.0"
base58check: base58check:
dependency: transitive dependency: transitive
description: description:

View File

@ -10,7 +10,7 @@ dependencies:
adaptive_dialog: ^0.10.0+5 adaptive_dialog: ^0.10.0+5
adaptive_theme: ^2.2.0 adaptive_theme: ^2.2.0
android_path_provider: ^0.2.1 android_path_provider: ^0.2.1
audioplayers: ^0.18.3 audioplayers: ^0.19.0
cached_network_image: ^3.0.0 cached_network_image: ^3.0.0
cupertino_icons: any cupertino_icons: any
desktop_notifications: ^0.4.0 desktop_notifications: ^0.4.0