Skip to content

Instantly share code, notes, and snippets.

@jtmuller5
Created January 12, 2021 23:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtmuller5/f9230ad629f3edceba1e2c5a47a053bd to your computer and use it in GitHub Desktop.
Save jtmuller5/f9230ad629f3edceba1e2c5a47a053bd to your computer and use it in GitHub Desktop.
class VideoControlOverlay extends ViewModelWidget<StackedVideoViewModel> {
@override
Widget build(BuildContext context, StackedVideoViewModel model) {
return Container(
height: model.thumbnailHeight,
width: model.thumbnailWidth,
child: Stack(
children: <Widget>[
AnimatedSwitcher(
duration: Duration(milliseconds: 50),
reverseDuration: Duration(milliseconds: 200),
child: model.videoPlayerController.value.isPlaying
? SizedBox.shrink()
: Container(
color: Colors.black26,
child: Center(
child: Icon(
Icons.play_arrow,
color: Colors.white,
size: model.thumbnailHeight/4,
),
),
),
),
GestureDetector(
onTap: () {
model.videoPlayerController.value.isPlaying
? model.pauseVideo()
: model.playVideo();
},
),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment