[mob][photos] Open file info bottom sheet when tapped on file description/caption

This commit is contained in:
ashilkn
2025-03-10 17:29:02 +05:30
parent dbb14f0a24
commit 3593a8e545
3 changed files with 55 additions and 36 deletions

View File

@@ -5,6 +5,7 @@ import "package:media_kit_video/media_kit_video.dart";
import "package:photos/models/file/file.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/common/loading_widget.dart";
import "package:photos/ui/viewer/file/preview_status_widget.dart";
import "package:photos/utils/standalone/date_time.dart";
@@ -140,7 +141,7 @@ class _VideoWidgetState extends State<VideoWidget> {
SeekBarAndDuration(
controller: widget.controller,
isSeekingNotifier: _isSeekingNotifier,
caption: widget.file.caption,
file: widget.file,
),
],
),
@@ -252,13 +253,13 @@ class _PlayPauseButtonState extends State<PlayPauseButtonMediaKit> {
class SeekBarAndDuration extends StatelessWidget {
final VideoController? controller;
final ValueNotifier<bool> isSeekingNotifier;
final String? caption;
final EnteFile file;
const SeekBarAndDuration({
super.key,
required this.controller,
required this.isSeekingNotifier,
required this.caption,
required this.file,
});
@override
@@ -286,7 +287,7 @@ class SeekBarAndDuration extends StatelessWidget {
),
child: Column(
children: [
caption != null && caption!.isNotEmpty
file.caption != null && file.caption!.isNotEmpty
? Padding(
padding: const EdgeInsets.fromLTRB(
0,
@@ -294,11 +295,16 @@ class SeekBarAndDuration extends StatelessWidget {
0,
12,
),
child: Text(
caption!,
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: getEnteTextTheme(context).mini,
child: GestureDetector(
onTap: () {
showDetailsSheet(context, file);
},
child: Text(
file.caption!,
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: getEnteTextTheme(context).mini,
),
),
)
: const SizedBox.shrink(),

View File

@@ -370,7 +370,7 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
showControls: _showControls,
isSeeking: _isSeeking,
position: position,
caption: widget.file.caption,
file: widget.file,
)
: const SizedBox();
},
@@ -658,7 +658,7 @@ class _SeekBarAndDuration extends StatelessWidget {
final ValueNotifier<bool> showControls;
final ValueNotifier<bool> isSeeking;
final int position;
final String? caption;
final EnteFile file;
const _SeekBarAndDuration({
required this.controller,
@@ -666,7 +666,7 @@ class _SeekBarAndDuration extends StatelessWidget {
required this.showControls,
required this.isSeeking,
required this.position,
required this.caption,
required this.file,
});
@override
@@ -709,7 +709,7 @@ class _SeekBarAndDuration extends StatelessWidget {
),
child: Column(
children: [
caption != null && caption!.isNotEmpty
file.caption != null && file.caption!.isNotEmpty
? Padding(
padding: const EdgeInsets.fromLTRB(
0,
@@ -717,11 +717,16 @@ class _SeekBarAndDuration extends StatelessWidget {
0,
12,
),
child: Text(
caption!,
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: getEnteTextTheme(context).mini,
child: GestureDetector(
onTap: () {
showDetailsSheet(context, file);
},
child: Text(
file.caption!,
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: getEnteTextTheme(context).mini,
),
),
)
: const SizedBox.shrink(),

View File

@@ -198,25 +198,33 @@ class _ZoomableImageState extends State<ZoomableImage> {
return AnimatedOpacity(
opacity: doNotShowCaption ? 0.0 : 1.0,
duration: const Duration(milliseconds: 200),
child: Container(
color: Colors.black.withOpacity(0.1),
width: double.infinity,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.symmetric(
vertical: 4.0,
horizontal: 8.0,
),
child: Text(
widget.photo.caption!,
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: getEnteTextTheme(context).mini,
),
child: IgnorePointer(
ignoring: doNotShowCaption,
child: GestureDetector(
onTap: () {
showDetailsSheet(context, widget.photo);
},
child: Container(
color: Colors.black.withOpacity(0.1),
width: double.infinity,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.symmetric(
vertical: 4.0,
horizontal: 8.0,
),
child: Text(
widget.photo.caption!,
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: getEnteTextTheme(context).mini,
),
),
],
),
],
),
),
),
);