feat: Update audio_players to newest version

This commit is contained in:
Christian Pauly 2021-05-18 12:10:53 +02:00
parent c0d446b41e
commit 6432b4cd4b
3 changed files with 22 additions and 22 deletions

View File

@ -26,12 +26,12 @@ class AudioPlayerWidget extends StatefulWidget {
: super(key: key); : super(key: key);
@override @override
_AudioPlayerState createState() => _AudioPlayerState(); _PlayerState createState() => _PlayerState();
} }
enum AudioPlayerStatus { notDownloaded, downloading, downloaded } enum AudioPlayerStatus { notDownloaded, downloading, downloaded }
class _AudioPlayerState extends State<AudioPlayerWidget> { class _PlayerState extends State<AudioPlayerWidget> {
AudioPlayerStatus status = AudioPlayerStatus.notDownloaded; AudioPlayerStatus status = AudioPlayerStatus.notDownloaded;
final AudioPlayer audioPlayer = AudioPlayer(); final AudioPlayer audioPlayer = AudioPlayer();
@ -64,7 +64,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();
@ -106,7 +106,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);
} }
@ -114,13 +114,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) {
@ -172,12 +172,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

@ -77,7 +77,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:
@ -217,7 +217,7 @@ packages:
name: emoji_picker_flutter name: emoji_picker_flutter
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.3" version: "1.0.5"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
@ -324,7 +324,7 @@ packages:
name: flutter_cache_manager name: flutter_cache_manager
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.1" version: "3.0.2"
flutter_highlight: flutter_highlight:
dependency: transitive dependency: transitive
description: description:
@ -359,7 +359,7 @@ packages:
name: flutter_local_notifications name: flutter_local_notifications
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.0.0+1" version: "5.0.0+4"
flutter_local_notifications_platform_interface: flutter_local_notifications_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -439,7 +439,7 @@ packages:
name: flutter_typeahead name: flutter_typeahead
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.1" version: "3.1.3"
flutter_web_plugins: flutter_web_plugins:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -514,7 +514,7 @@ packages:
name: image_picker name: image_picker
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.7.4" version: "0.7.5"
image_picker_for_web: image_picker_for_web:
dependency: transitive dependency: transitive
description: description:
@ -633,7 +633,7 @@ packages:
name: moor name: moor
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.2.1" version: "4.3.0"
native_imaging: native_imaging:
dependency: "direct main" dependency: "direct main"
description: description:
@ -691,7 +691,7 @@ packages:
name: open_file name: open_file
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.2.0" version: "3.2.1"
open_noti_settings: open_noti_settings:
dependency: "direct main" dependency: "direct main"
description: description:
@ -789,7 +789,7 @@ packages:
name: permission_handler_platform_interface name: permission_handler_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.2.0" version: "3.3.0"
petitparser: petitparser:
dependency: transitive dependency: transitive
description: description:
@ -1018,7 +1018,7 @@ packages:
name: sqlite3 name: sqlite3
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.1.1"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -1095,7 +1095,7 @@ packages:
name: tuple name: tuple
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0-nullsafety.0" version: "2.0.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -1130,7 +1130,7 @@ packages:
name: unifiedpush name: unifiedpush
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "1.0.3"
universal_html: universal_html:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@ -11,7 +11,7 @@ dependencies:
adaptive_page_layout: ^0.2.4 adaptive_page_layout: ^0.2.4
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