From fd16ff5ec30ec266157e5c8a9d4a6090c91717f6 Mon Sep 17 00:00:00 2001 From: Tommy Chow Date: Sat, 6 Sep 2025 17:45:00 -0700 Subject: [PATCH] refactor: improve text overlay transition in VideoChat for better user experience --- lib/screens/channel/channel.dart | 47 ++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/lib/screens/channel/channel.dart b/lib/screens/channel/channel.dart index ff39d713..e3112364 100644 --- a/lib/screens/channel/channel.dart +++ b/lib/screens/channel/channel.dart @@ -536,29 +536,34 @@ class _VideoChatState extends State ), ), ), - // Simple text overlay that follows the video - if (_isPipDragging && - !_videoStore.isInPipMode) + // Simple text overlay that follows the video with smooth transition + if (!_videoStore.isInPipMode) Positioned.fill( - child: Container( - color: Colors.black.withValues( - alpha: 0.4, + child: AnimatedOpacity( + opacity: _isPipDragging ? 1.0 : 0.0, + duration: const Duration( + milliseconds: 150, ), - child: Center( - child: AnimatedOpacity( - opacity: _pipDragDistance > 20 - ? 1.0 - : 0.0, - duration: const Duration( - milliseconds: 200, - ), - child: const Text( - 'Swipe down to enter picture-in-picture', - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.w500, + child: Container( + color: Colors.black.withValues( + alpha: 0.4, + ), + child: Center( + child: AnimatedOpacity( + opacity: _pipDragDistance > 20 + ? 1.0 + : 0.0, + duration: const Duration( + milliseconds: 200, + ), + child: const Text( + 'Swipe down to enter picture-in-picture', + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontSize: 16, + fontWeight: FontWeight.w500, + ), ), ), ),