From 4b0b1f3dbd732e6bca3619699c0822342c87ec9b Mon Sep 17 00:00:00 2001 From: Roscoe Rubin-Rottenberg Date: Wed, 10 Jun 2026 11:46:56 -0400 Subject: [PATCH] fix: play button pop in on play --- .../feed/ui/widgets/videos/video_player.dart | 45 ++++++++++++------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/lib/src/features/feed/ui/widgets/videos/video_player.dart b/lib/src/features/feed/ui/widgets/videos/video_player.dart index 78bd458a..528e2813 100644 --- a/lib/src/features/feed/ui/widgets/videos/video_player.dart +++ b/lib/src/features/feed/ui/widgets/videos/video_player.dart @@ -51,6 +51,7 @@ class PostVideoPlayerState extends ConsumerState BetterPlayerController? videoController; bool _userInteracted = false; bool _showThumbnailOverlay = true; + bool _showPlayButton = false; late AnimationController _bounceController; late Animation _bounceAnimation; @@ -99,6 +100,7 @@ class PostVideoPlayerState extends ConsumerState videoController?.pause(); setState(() { _userInteracted = true; + _showPlayButton = true; }); } } @@ -116,6 +118,7 @@ class PostVideoPlayerState extends ConsumerState super.didUpdateWidget(oldWidget); if (oldWidget.videoUrl != widget.videoUrl) { _showThumbnailOverlay = true; + _showPlayButton = false; } if (oldWidget.videoAspectRatio != widget.videoAspectRatio) { _syncPlayerLayout(); @@ -145,6 +148,11 @@ class PostVideoPlayerState extends ConsumerState _bounceController ..stop() ..value = 1.0; + if (_showPlayButton) { + setState(() { + _showPlayButton = false; + }); + } } final progress = @@ -451,31 +459,38 @@ class PostVideoPlayerState extends ConsumerState onTap: () { _userInteracted = true; if (isPlaying) { + setState(() { + _showPlayButton = true; + }); videoController?.pause(); } else { + setState(() { + _showPlayButton = false; + }); videoController?.play(); } }, child: Container(color: Colors.transparent), ), ), - Center( - child: IgnorePointer( - child: AnimatedBuilder( - animation: _bounceAnimation, - builder: (context, child) { - return Transform.scale( - scale: isPlaying ? 0.0 : _bounceAnimation.value, - child: SizedBox( - width: 50, - height: 50, - child: AppIcons.play(), - ), - ); - }, + if (_showPlayButton) + Center( + child: IgnorePointer( + child: AnimatedBuilder( + animation: _bounceAnimation, + builder: (context, child) { + return Transform.scale( + scale: isPlaying ? 0.0 : _bounceAnimation.value, + child: SizedBox( + width: 50, + height: 50, + child: AppIcons.play(), + ), + ); + }, + ), ), ), - ), if (videoController != null) Positioned( bottom: 0, -- 2.51.2