I recently implemented WillPopScope on the VideoPlayer package in my app:
child: WillPopScope(
onWillPop: () async => false,
child: VideoPlayer(_controller),
),
I use this to stop the swipe back, that was occurring before. Which works fine.
However it has resulted in another error. When the VideoPlayer completes it should close the screen and this is no longer happening. It worked fine before.
Here is my exit screen code:
void closeScreen() async {
final _exercises = Provider.of<Exercises>(context, listen: false);
_exercises.increasePlayCount(widget.exercise.id);
print('VIDEO FINISHED ... CLOSE!!');
widget.exercise.setRecentPlayed(widget.exercise);
Navigator.of(context).maybePop();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: [SystemUiOverlay.top]);
}
This method is being called fine as the print statement is being executed as expected.
I hav tried changing the placement of the WillPopScope but that hasn't fixed the problem. Could someone please let me know how I can correct this.
Many thanks