diff --git a/lib/ui/viewer/file/file_widget.dart b/lib/ui/viewer/file/file_widget.dart index 7b89f532b..65d3afb45 100644 --- a/lib/ui/viewer/file/file_widget.dart +++ b/lib/ui/viewer/file/file_widget.dart @@ -40,7 +40,10 @@ class FileWidget extends StatelessWidget { // tagPrefix: tagPrefix, // playbackCallback: playbackCallback, // ); - return VideoWidgetNew(file); + return VideoWidgetNew( + file, + tagPrefix: tagPrefix, + ); } else { Logger('FileWidget').severe('unsupported file type ${file.fileType}'); return const Icon(Icons.error); diff --git a/lib/ui/viewer/file/video_widget_new.dart b/lib/ui/viewer/file/video_widget_new.dart index edaf71903..e786efc97 100644 --- a/lib/ui/viewer/file/video_widget_new.dart +++ b/lib/ui/viewer/file/video_widget_new.dart @@ -17,7 +17,12 @@ import "package:photos/utils/toast_util.dart"; class VideoWidgetNew extends StatefulWidget { final EnteFile file; - const VideoWidgetNew(this.file, {super.key}); + final String? tagPrefix; + const VideoWidgetNew( + this.file, { + this.tagPrefix, + super.key, + }); @override State createState() => _VideoWidgetNewState(); @@ -25,9 +30,7 @@ class VideoWidgetNew extends StatefulWidget { class _VideoWidgetNewState extends State { static const verticalMargin = 100.0; - // Create a [Player] to control playback. late final player = Player(); - // Create a [VideoController] to handle video output from [Player]. VideoController? controller; final _progressNotifier = ValueNotifier(null); @@ -72,35 +75,38 @@ class _VideoWidgetNewState extends State { @override Widget build(BuildContext context) { final colorScheme = getEnteColorScheme(context); - return GestureDetector( - //This gestureDetector is to stop swiping the pageView when seeking the - //video using the seekbar. - onHorizontalDragUpdate: (details) {}, - child: MaterialVideoControlsTheme( - normal: MaterialVideoControlsThemeData( - seekBarMargin: const EdgeInsets.only(bottom: verticalMargin), - bottomButtonBarMargin: const EdgeInsets.only(bottom: 112), - controlsHoverDuration: const Duration(seconds: 3), - seekBarHeight: 4, - seekBarBufferColor: Colors.transparent, - seekBarThumbColor: backgroundElevatedLight, - seekBarColor: fillMutedDark, - seekBarPositionColor: colorScheme.primary300.withOpacity(0.8), - topButtonBarMargin: const EdgeInsets.only(top: verticalMargin), - bottomButtonBar: [ - const Spacer(), - PausePlayAndDuration(controller?.player), - const Spacer(), - ], - primaryButtonBar: [], - ), - fullscreen: const MaterialVideoControlsThemeData(), - child: Center( - child: controller != null - ? Video( - controller: controller!, - ) - : _getLoadingWidget(), + return Hero( + tag: widget.tagPrefix! + widget.file.tag, + child: GestureDetector( + //This gestureDetector is to stop swiping the pageView when seeking the + //video using the seekbar. + onHorizontalDragUpdate: (details) {}, + child: MaterialVideoControlsTheme( + normal: MaterialVideoControlsThemeData( + seekBarMargin: const EdgeInsets.only(bottom: verticalMargin), + bottomButtonBarMargin: const EdgeInsets.only(bottom: 112), + controlsHoverDuration: const Duration(seconds: 3), + seekBarHeight: 4, + seekBarBufferColor: Colors.transparent, + seekBarThumbColor: backgroundElevatedLight, + seekBarColor: fillMutedDark, + seekBarPositionColor: colorScheme.primary300.withOpacity(0.8), + topButtonBarMargin: const EdgeInsets.only(top: verticalMargin), + bottomButtonBar: [ + const Spacer(), + PausePlayAndDuration(controller?.player), + const Spacer(), + ], + primaryButtonBar: [], + ), + fullscreen: const MaterialVideoControlsThemeData(), + child: Center( + child: controller != null + ? Video( + controller: controller!, + ) + : _getLoadingWidget(), + ), ), ), );