π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Refactor file details widgets to enhance UI consistency and improve code readability
AmanRajSinghMourya2306d740e389
diff --git a/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dart b/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dartindex 4791f234d8..2d66342588 100644--- a/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dart@@ -309,12 +309,6 @@ class _FileDetailsWidgetState extends State<FileDetailsWidget> {}}- if (file.uploadedFileID != null && file.updationTime != null) {- fileDetailsTiles.addAll([- BackedUpTimeItemWidget(file),- const FileDetailsDivider(),- ]);- }if (!file.isTrash) {fileDetailsTiles.add(AlbumsItemWidget(file, _currentUserID));}diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/creation_time_item_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/creation_time_item_widget.dartindex 2b155979e0..adbf53d9b1 100644--- a/mobile/apps/photos/lib/ui/viewer/file_details/creation_time_item_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/file_details/creation_time_item_widget.dart@@ -1,11 +1,12 @@+import "package:ente_components/ente_components.dart";import "package:ente_pure_utils/ente_pure_utils.dart";import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";import "package:intl/intl.dart";import "package:photos/core/event_bus.dart";import "package:photos/events/pause_video_event.dart";import "package:photos/models/file/extensions/file_props.dart";import 'package:photos/models/file/file.dart';-import "package:photos/theme/ente_theme.dart";import "package:photos/ui/components/info_item_widget.dart";import "package:photos/ui/viewer/date/edit_date_sheet.dart";import "package:photos/ui/viewer/gallery/jump_to_date_gallery.dart";@@ -22,7 +23,13 @@ class CreationTimeItem extends StatefulWidget {class _CreationTimeItemState extends State<CreationTimeItem> {@overrideWidget build(BuildContext context) {+ final colors = context.componentColors;final dateTime = _dateTimeForDisplay(widget.file);+ final canEdit =+ (widget.file.ownerID == null ||+ widget.file.ownerID == widget.currentUserID) &&+ widget.file.uploadedFileID != null &&+ !widget.file.isTrash;return GestureDetector(behavior: HitTestBehavior.translucent,onTap: () {@@ -31,25 +38,22 @@ class _CreationTimeItemState extends State<CreationTimeItem> {},child: InfoItemWidget(key: const ValueKey("Creation time"),- leadingIcon: Icons.calendar_today_outlined,+ leadingIconWidget: HugeIcon(+ icon: HugeIcons.strokeRoundedCalendar04,+ size: IconSizes.small,+ color: colors.textLight,+ ),title: DateFormat.yMMMEd(Localizations.localeOf(context).languageCode,).format(dateTime),subtitleSection: Future.value([Text(getTimeIn12hrFormat(dateTime),- style: getEnteTextTheme(context).miniMuted,+ style: TextStyles.mini.copyWith(color: colors.textLight),),]),- editOnTap:- ((widget.file.ownerID == null ||- widget.file.ownerID == widget.currentUserID) &&- widget.file.uploadedFileID != null &&- !widget.file.isTrash)- ? () {- _showDateTimePicker(widget.file);- }- : null,+ editOnTap: canEdit ? () => _showDateTimePicker(widget.file) : null,+ useMenuStyle: true,),);}diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/exif_item_widgets.dart b/mobile/apps/photos/lib/ui/viewer/file_details/exif_item_widgets.dartindex 3cae984df4..a5ba6548a8 100644--- a/mobile/apps/photos/lib/ui/viewer/file_details/exif_item_widgets.dart+++ b/mobile/apps/photos/lib/ui/viewer/file_details/exif_item_widgets.dart@@ -1,3 +1,4 @@+import "package:ente_components/ente_components.dart";import "package:exif_reader/exif_reader.dart";import "package:flutter/material.dart";import "package:hugeicons/hugeicons.dart";@@ -15,24 +16,27 @@ class BasicExifItemWidget extends StatelessWidget {@overrideWidget build(BuildContext context) {- final subtitleTextTheme = getEnteTextTheme(context).miniMuted;+ final colors = context.componentColors;+ final subtitleTextStyle = TextStyles.mini.copyWith(color: colors.textLight);return InfoItemWidget(key: const ValueKey("Basic EXIF"),- leadingIconWidget: const HugeIcon(icon: HugeIcons.strokeRoundedLicense),+ leadingIconWidget: HugeIcon(+ icon: HugeIcons.strokeRoundedCamera01,+ size: IconSizes.small,+ color: colors.textLight,+ ),title: exifData["takenOnDevice"] ?? "--",subtitleSection: Future.value([if (exifData["fNumber"] != null)- Text('Ζ/' + exifData["fNumber"].toString(), style: subtitleTextTheme),+ Text('Ζ/${exifData["fNumber"]}', style: subtitleTextStyle),if (exifData["exposureTime"] != null)- Text(exifData["exposureTime"], style: subtitleTextTheme),+ Text(exifData["exposureTime"].toString(), style: subtitleTextStyle),if (exifData["focalLength"] != null)- Text(- exifData["focalLength"].toString() + "mm",- style: subtitleTextTheme,- ),+ Text('${exifData["focalLength"]}mm', style: subtitleTextStyle),if (exifData["ISO"] != null)- Text("ISO" + exifData["ISO"].toString(), style: subtitleTextTheme),+ Text('ISO${exifData["ISO"]}', style: subtitleTextStyle),]),+ useMenuStyle: true,);}}diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/file_properties_item_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/file_properties_item_widget.dartindex 14e785d002..bf2e81e6c9 100644--- a/mobile/apps/photos/lib/ui/viewer/file_details/file_properties_item_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/file_details/file_properties_item_widget.dart@@ -1,3 +1,4 @@+import "package:ente_components/ente_components.dart";import "package:ente_pure_utils/ente_pure_utils.dart";import "package:flutter/material.dart";import "package:hugeicons/hugeicons.dart";@@ -6,7 +7,6 @@ import "package:photos/models/file/extensions/file_props.dart";import 'package:photos/models/file/file.dart';import 'package:photos/models/file/file_type.dart';import "package:photos/module/download/file.dart";-import "package:photos/theme/ente_theme.dart";import "package:photos/ui/components/info_item_widget.dart";import "package:photos/utils/image_util.dart";import "package:photos/utils/magic_util.dart";@@ -31,12 +31,15 @@ class FilePropertiesItemWidget extends StatefulWidget {class _FilePropertiesItemWidgetState extends State<FilePropertiesItemWidget> {@overrideWidget build(BuildContext context) {+ final colors = context.componentColors;return InfoItemWidget(key: const ValueKey("File properties"),leadingIconWidget: HugeIcon(icon: widget.isImage? HugeIcons.strokeRoundedImage01: HugeIcons.strokeRoundedVideo02,+ size: IconSizes.small,+ color: colors.textLight,),title:path.basenameWithoutExtension(widget.file.displayName) +@@ -51,11 +54,14 @@ class _FilePropertiesItemWidgetState extends State<FilePropertiesItemWidget> {await editFilename(context, widget.file);setState(() {});},+ useMenuStyle: true,);}Future<List<Widget>> _subTitleSection() async {- final textStyle = getEnteTextTheme(context).miniMuted;+ final textStyle = TextStyles.mini.copyWith(+ color: context.componentColors.textLight,+ );final StringBuffer dimString = StringBuffer();int? width;int? height;diff --git a/mobile/apps/photos/lib/ui/viewer/file_details/preview_properties_item_widget.dart b/mobile/apps/photos/lib/ui/viewer/file_details/preview_properties_item_widget.dartindex 0a5e105648..14c033e3ae 100644--- a/mobile/apps/photos/lib/ui/viewer/file_details/preview_properties_item_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/file_details/preview_properties_item_widget.dart@@ -1,11 +1,12 @@+import "package:ente_components/ente_components.dart";import "package:ente_pure_utils/ente_pure_utils.dart";import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";import "package:photos/generated/l10n.dart";import "package:photos/models/ffmpeg/ffprobe_props.dart";import 'package:photos/models/file/file.dart';import "package:photos/models/file/file_type.dart";import "package:photos/services/video_preview_service.dart";-import "package:photos/theme/ente_theme.dart";import "package:photos/ui/components/info_item_widget.dart";class PreviewPropertiesItemWidget extends StatefulWidget {@@ -42,7 +43,9 @@ class _PreviewPropertiesItemWidgetStateFuture<void> _getSection() async {if (!mounted) return;- final textStyle = getEnteTextTheme(context).miniMuted;+ final textStyle = TextStyles.mini.copyWith(+ color: context.componentColors.textLight,+ );final subSectionWidgets = <Widget>[];final data = await VideoPreviewService.instance@@ -81,9 +84,14 @@ class _PreviewPropertiesItemWidgetStatechild = InfoItemWidget(key: const ValueKey("Stream properties"),- leadingIcon: Icons.play_circle_outline,+ leadingIconWidget: HugeIcon(+ icon: HugeIcons.strokeRoundedPlay,+ size: IconSizes.small,+ color: context.componentColors.textLight,+ ),title: AppLocalizations.of(context).streamDetails,subtitleSection: Future.value(subSectionWidgets),+ useMenuStyle: true,);if (mounted) {setState(() {});