Replies: 1 comment 1 reply
-
final controller = YoutubePlayerController();
YoutubePlayerScaffold(
controller: controller,
builder: (context, player) {
return NestedWidget();
}
),
NestedWidget{
initState() {
fetchIdFromRest.then((id) {
context.ytController.loadVideoById(videoId: id);
});
}
build(context) {
return Scaffold(
body: YoutubePlayer.of(context), // I'll add this in the next update.
);
}
}
@mark8044 Can you not do something like this ? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Right now I have an outer
Scaffold
with multiple levels of deeply nested widgets. Inside one of those deeply nested widgets (about 5-6 levels deep) is where myYoutubePlayer
widget sits. MyYoutubePlayer
widget is a stateful widget which dynamically gets itsvideoId
based on RESTful data pulled from a remote source.With this new
YoutTubePlayerScaffold
method, I have to place it above the mainScaffold
and define the controller very early on. Then I have to usebuilder
to pass aplayer
param down 5-6 levels of nesting. Then within the nested level I have to pass a Youtube video ID back up to the root, probably via some kind of state management system.This seems very very tedious. Is it possible to have the YoutubePlayerScaffold exist without the controller which can at least be controlled at the
YoutubePlayer
widget level?This part seemed to be working much better pre 3.x
Beta Was this translation helpful? Give feedback.
All reactions