Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Fix UX/UX issue when a video is opened that has a caption/description

ashilkn9a891535630a
diff --git a/mobile/lib/ui/viewer/file/file_bottom_bar.dart b/mobile/lib/ui/viewer/file/file_bottom_bar.dart
index a9c0d38ab0..9fead0ca82 100644
--- a/mobile/lib/ui/viewer/file/file_bottom_bar.dart
+++ b/mobile/lib/ui/viewer/file/file_bottom_bar.dart
@@ -12,8 +12,7 @@ import 'package:photos/models/file/file.dart';
import 'package:photos/models/file/file_type.dart';
import 'package:photos/models/file/trash_file.dart';
import 'package:photos/models/selected_files.dart';
-import "package:photos/theme/colors.dart";
-import "package:photos/theme/ente_theme.dart";
+
import "package:photos/ui/actions/file/file_actions.dart";
import 'package:photos/ui/collections/collection_action_sheet.dart';
import 'package:photos/utils/delete_file_util.dart';
@@ -208,42 +207,9 @@ class FileBottomBarState extends State<FileBottomBar> {
top: false,
left: false,
right: false,
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- widget.file.caption?.isNotEmpty ?? false
- ? Padding(
- padding: const EdgeInsets.fromLTRB(
- 16,
- 12,
- 16,
- 0,
- ),
- child: GestureDetector(
- onTap: () async {
- await _displayDetails(widget.file);
- await Future.delayed(
- const Duration(milliseconds: 500),
- ); //Waiting for some time till the caption gets updated in db if the user closes the bottom sheet without pressing 'done'
- safeRefresh();
- },
- child: Text(
- widget.file.caption!,
- overflow: TextOverflow.ellipsis,
- maxLines: 1,
- style: getEnteTextTheme(context)
- .mini
- .copyWith(color: textBaseDark),
- textAlign: TextAlign.center,
- ),
- ),
- )
- : const SizedBox.shrink(),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: children,
- ),
- ],
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: children,
),
),
),
diff --git a/mobile/lib/ui/viewer/file/video_widget_media_kit_new.dart b/mobile/lib/ui/viewer/file/video_widget_media_kit_new.dart
index ab38112d07..bce3f395ea 100644
--- a/mobile/lib/ui/viewer/file/video_widget_media_kit_new.dart
+++ b/mobile/lib/ui/viewer/file/video_widget_media_kit_new.dart
@@ -136,6 +136,7 @@ class _VideoWidgetMediaKitNewState extends State<VideoWidgetMediaKitNew>
child: Center(
child: controller != null
? _VideoWidget(
+ widget.file,
controller!,
widget.playbackCallback,
isFromMemories: widget.isFromMemories,
@@ -239,10 +240,12 @@ class _VideoWidgetMediaKitNewState extends State<VideoWidgetMediaKitNew>
}
class _VideoWidget extends StatefulWidget {
+ final EnteFile file;
final VideoController controller;
final Function(bool)? playbackCallback;
final bool isFromMemories;
const _VideoWidget(
+ this.file,
this.controller,
this.playbackCallback, {
required this.isFromMemories,
@@ -347,9 +350,32 @@ class __VideoWidgetState extends State<_VideoWidget> {
padding: EdgeInsets.only(
bottom: widget.isFromMemories ? 32 : 0,
),
- child: _SeekBarAndDuration(
- controller: widget.controller,
- isSeekingNotifier: _isSeekingNotifier,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 8,
+ ),
+ child: Text(
+ widget.file.caption!,
+ overflow: TextOverflow.ellipsis,
+ maxLines: 1,
+ style:
+ getEnteTextTheme(context).mini.copyWith(
+ color: textBaseDark,
+ ),
+ textAlign: TextAlign.center,
+ ),
+ ),
+ _SeekBarAndDuration(
+ controller: widget.controller,
+ isSeekingNotifier: _isSeekingNotifier,
+ ),
+ ],
),
),
),
diff --git a/mobile/lib/ui/viewer/file/video_widget_native.dart b/mobile/lib/ui/viewer/file/video_widget_native.dart
index eeec81346d..8c3e0b7710 100644
--- a/mobile/lib/ui/viewer/file/video_widget_native.dart
+++ b/mobile/lib/ui/viewer/file/video_widget_native.dart
@@ -274,92 +274,155 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
bottom: widget.isFromMemories ? 32 : 0,
),
child: Column(
- crossAxisAlignment: CrossAxisAlignment.end,
+ crossAxisAlignment: CrossAxisAlignment.center,
children: [
- Platform.isAndroid
- ? ValueListenableBuilder(
- valueListenable: _showControls,
- builder: (context, value, _) {
- return AnimatedOpacity(
- duration: const Duration(
- milliseconds: 200,
+ Row(
+ mainAxisAlignment: Platform.isAndroid
+ ? MainAxisAlignment.spaceBetween
+ : MainAxisAlignment.center,
+ children: [
+ widget.file.caption?.isNotEmpty ?? false
+ ? Expanded(
+ child: ValueListenableBuilder(
+ valueListenable: _showControls,
+ builder: (context, value, _) {
+ return AnimatedOpacity(
+ duration: const Duration(
+ milliseconds: 200,
+ ),
+ curve: Curves.easeInQuad,
+ opacity: value ? 1 : 0,
+ child: Padding(
+ padding: const EdgeInsets
+ .fromLTRB(
+ 16,
+ 12,
+ 16,
+ 8,
+ ),
+ child: Text(
+ widget.file.caption!,
+ overflow:
+ TextOverflow.ellipsis,
+ maxLines: 1,
+ style: getEnteTextTheme(
+ context,
+ ).mini.copyWith(
+ color: textBaseDark,
+ ),
+ textAlign:
+ TextAlign.center,
+ ),
+ ),
+ );
+ },
),
- curve: Curves.easeInQuad,
- opacity: value ? 1 : 0,
- child: ElTooltip(
- padding: const EdgeInsets.all(12),
- distance: 4,
- controller: _elTooltipController,
- content: GestureDetector(
- onLongPress: () {
- Bus.instance.fire(
- UseMediaKitForVideo(),
- );
- HapticFeedback.vibrate();
- _elTooltipController.hide();
- },
- child: const Text(
- "Trouble playing video? Long press here to use different player.",
- ),
- ),
- position:
- ElTooltipPosition.topEnd,
- color: backgroundElevatedDark,
- appearAnimationDuration:
- const Duration(
- milliseconds: 200,
- ),
- disappearAnimationDuration:
- const Duration(
- milliseconds: 200,
- ),
- child: GestureDetector(
- onTap: () {
- if (_elTooltipController
- .value ==
- ElTooltipStatus.hidden) {
- _elTooltipController.show();
- } else {
- _elTooltipController.hide();
- }
- _controller?.pause();
- },
- behavior:
- HitTestBehavior.translucent,
- onLongPress: () {
- Bus.instance.fire(
- UseMediaKitForVideo(),
- );
- HapticFeedback.vibrate();
- },
- child: Padding(
- padding:
- const EdgeInsets.fromLTRB(
- 12,
- 0,
- 0,
- 4,
+ )
+ : const SizedBox.shrink(),
+ Platform.isAndroid
+ ? ValueListenableBuilder(
+ valueListenable: _showControls,
+ builder: (context, value, _) {
+ return IgnorePointer(
+ ignoring: !value,
+ child: AnimatedOpacity(
+ duration: const Duration(
+ milliseconds: 200,
),
- child: Container(
+ curve: Curves.easeInQuad,
+ opacity: value ? 1 : 0,
+ child: ElTooltip(
padding:
const EdgeInsets.all(
12,
),
- child: Icon(
- Icons
- .question_mark_rounded,
- size: 16,
- color: Colors.white
- .withOpacity(0.15),
+ distance: 4,
+ controller:
+ _elTooltipController,
+ content: GestureDetector(
+ onLongPress: () {
+ Bus.instance.fire(
+ UseMediaKitForVideo(),
+ );
+ HapticFeedback
+ .vibrate();
+ _elTooltipController
+ .hide();
+ },
+ child: const Text(
+ "Trouble playing this video? Long press here to use different player.",
+ ),
+ ),
+ position: ElTooltipPosition
+ .topEnd,
+ color:
+ backgroundElevatedDark,
+ appearAnimationDuration:
+ const Duration(
+ milliseconds: 200,
+ ),
+ disappearAnimationDuration:
+ const Duration(
+ milliseconds: 200,
+ ),
+ child: GestureDetector(
+ onTap: () {
+ if (_elTooltipController
+ .value ==
+ ElTooltipStatus
+ .hidden) {
+ _elTooltipController
+ .show();
+ } else {
+ _elTooltipController
+ .hide();
+ }
+ _controller?.pause();
+ },
+ behavior: HitTestBehavior
+ .translucent,
+ onLongPress: () {
+ Bus.instance.fire(
+ UseMediaKitForVideo(),
+ );
+ HapticFeedback
+ .vibrate();
+ },
+ child: Padding(
+ padding:
+ const EdgeInsets
+ .fromLTRB(
+ 12,
+ 0,
+ 0,
+ 4,
+ ),
+ child: Container(
+ padding:
+ const EdgeInsets
+ .all(
+ 12,
+ ),
+ child: Icon(
+ Icons
+ .question_mark_rounded,
+ size: 16,
+ color: Colors.white
+ .withOpacity(
+ 0.15,
+ ),
+ ),
+ ),
+ ),
),
),
),
- ),
- ),
- );
- },
- )
- : const SizedBox.shrink(),
+ );
+ },
+ )
+ : const SizedBox.shrink(),
+ ],
+ ),
ValueListenableBuilder(
valueListenable: _isPlaybackReady,
builder: