Last active
January 8, 2021 08:09
-
-
Save jtmuller5/5a22eaba9cc03e4ed0f0aab010b3b32b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StackedVideoView extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return ViewModelBuilder<StackedVideoViewModel>.reactive( | |
viewModelBuilder: () => StackedVideoViewModel(), | |
onModelReady: (model) { | |
model.initialize( | |
'https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4'); | |
}, | |
builder: (context, model, child) { | |
return FittedBox( | |
fit: BoxFit.cover, | |
child: SizedBox( | |
height: model.videoPlayerController.value.size?.height ?? 0, | |
width: model.videoPlayerController.value.size?.width ?? 0, | |
child: VideoPlayer(model.videoPlayerController), | |
), | |
); | |
}, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment