Skip to content

Commit

Permalink
[mob][photos] Fix UX issue with video controls when viewing a video m…
Browse files Browse the repository at this point in the history
…emory (#4294)
  • Loading branch information
ashilkn authored Dec 3, 2024
2 parents 129d110 + a905a1f commit 7b002c8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
1 change: 0 additions & 1 deletion mobile/lib/ui/home/memories/full_screen_memory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
backgroundDecoration: const BoxDecoration(
color: Colors.transparent,
),
isFromMemories: true,
),
);
},
Expand Down
1 change: 0 additions & 1 deletion mobile/lib/ui/viewer/file/detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ class _DetailPageState extends State<DetailPage> {
});
},
backgroundDecoration: const BoxDecoration(color: Colors.black),
isFromMemories: false,
);
return GestureDetector(
onTap: () {
Expand Down
2 changes: 0 additions & 2 deletions mobile/lib/ui/viewer/file/file_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class FileWidget extends StatelessWidget {
final Function(bool)? playbackCallback;
final BoxDecoration? backgroundDecoration;
final bool? autoPlay;
final bool isFromMemories;

const FileWidget(
this.file, {
Expand All @@ -21,7 +20,6 @@ class FileWidget extends StatelessWidget {
this.playbackCallback,
this.tagPrefix,
this.backgroundDecoration,
required this.isFromMemories,
super.key,
});

Expand Down
28 changes: 18 additions & 10 deletions mobile/lib/ui/viewer/file/video_widget_native.dart
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: widget.playbackCallback != null
? () {
_showControls.value = !_showControls.value;
widget.playbackCallback!(!_showControls.value);
}
: null,
onTap: () {
_showControls.value = !_showControls.value;
if (widget.playbackCallback != null) {
widget.playbackCallback!(!_showControls.value);
}
},
child: Container(
constraints: const BoxConstraints.expand(),
),
Expand Down Expand Up @@ -310,7 +310,9 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
return;
}
_showControls.value = false;
widget.playbackCallback!(true);
if (widget.playbackCallback != null) {
widget.playbackCallback!(true);
}
}
});
}
Expand All @@ -321,15 +323,17 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
return;
}
if (_controller!.playbackInfo?.status == PlaybackStatus.playing) {
if (widget.playbackCallback != null && mounted) {
if (mounted) {
_debouncer.run(() async {
if (mounted) {
if (_isSeeking.value ||
_controller!.playbackInfo?.status != PlaybackStatus.playing) {
return;
}
_showControls.value = false;
widget.playbackCallback!(true);
if (widget.playbackCallback != null) {
widget.playbackCallback!(true);
}
}
});
}
Expand Down Expand Up @@ -379,7 +383,11 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
_setFilePathForNativePlayer(file.path);
}
}).onError((error, stackTrace) {
showErrorDialog(context, S.of(context).error, S.of(context).failedToDownloadVideo);
showErrorDialog(
context,
S.of(context).error,
S.of(context).failedToDownloadVideo,
);
});
}

Expand Down

0 comments on commit 7b002c8

Please sign in to comment.