Open surajgju opened 3 months ago
I'm having the same problem.
PopScope( canPop: false, onPopInvoked: (didPop) { // <== Replace this function with onPopInvokedWithResult: (didPop, result) as this has been deprecated final controller = widget.player.controller; if (controller.value.isFullScreen) { widget.player.controller.toggleFullScreenMode(); } else { Navigator.pop(context); } }, child: widget.player, ), );
Is there an existing issue for this?
Package
youtube_player_flutter
What happened?
i switch version from 8.1.2 to 9.0.3 and i am unable to navigate back to previous screen from screen where video is playing.
here log : he following assertion was thrown while handling a gesture: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 5277 pos 12: '!_debugLocked': is not true.
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause. In either case, please report this assertion by filing a bug on GitHub: https://github.com/flutter/flutter/issues/new?template=2_bug.yml
When the exception was thrown, this was the stack:
2 NavigatorState.pop (package:flutter/src/widgets/navigator.dart:5277:12)
3 Navigator.pop (package:flutter/src/widgets/navigator.dart:2573:27)
4 _YoutubePlayerBuilderState.build. (package:youtube_player_flutter/src/widgets/youtube_player_builder.dart:77:23)
What is the expected behaviour?
i should easily navigate back using icon button in leading app bar by Navigator.of(context).pop() .
How to reproduce?
1.when tap on navigate back leading in appbar which is inside widget YoutubePlayerBuilder it throw the error Failed assertion: line 5277 pos 12: '!_debugLocked': is not true.
code snippet: Widget build(BuildContext context) { ScreenUtil.init(context); // final _chapterDetailProvider = Provider.of(context);
return Consumer(
builder: (context, _chapterDetailProvider, child) {
return chaptersTopicsList.isNotEmpty
? YoutubePlayerBuilder(
// key: UniqueKey(),
player: YoutubePlayer(
controller: videoController!,
onReady: () {
// isPlayerReady = true;
},
//aspectRatio:videoController!.value.isFullScreen ? 3/3 : 16 / 9 ,
aspectRatio: 16 / 8,
Flutter Doctor Output