diff --git a/lib/Listen.dart b/lib/Listen.dart index fea2530..e19688b 100644 --- a/lib/Listen.dart +++ b/lib/Listen.dart @@ -19,7 +19,11 @@ class PlayControls extends StatefulWidget { State createState() => _PlayControlsState(); } -class _PlayControlsState extends State { +class _PlayControlsState extends State + with AutomaticKeepAliveClientMixin { + @override + bool get wantKeepAlive => true; + bool isPlaying = false; late final AudioPlayer player; @@ -47,6 +51,8 @@ class _PlayControlsState extends State { @override Widget build(BuildContext context) { + super.build(context); + if (isPlaying) { player.resume(); } else {