Skip to content

armgit / ente

Public Imported from GitHub
0

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

Merge branch 'main' into aman/file-details-sheet-redesign

aman-pilot8537b659f9e4
diff --cc mobile/apps/photos/lib/ui/viewer/file_details/file_properties_item_widget.dart
index 3e4d536dd0,ea38612d5f..e24c729f45
--- 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
@@@ -6,6 -5,9 +6,7 @@@ import 'package:path/path.dart' as path
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/theme/ente_theme.dart";
-import "package:photos/ui/components/info_item_widget.dart";
+ import "package:photos/utils/file_uploader_util.dart";
import "package:photos/utils/file_util.dart";
import "package:photos/utils/magic_util.dart";
@@@ -71,22 -54,44 +72,43 @@@ class _FilePropertiesItemWidgetState ex
);
}
- Future<List<Widget>> _subTitleSection() async {
- final textStyle = getEnteTextTheme(context).miniMuted;
+ Future<String> _subtitle() async {
+ final parts = <String>[];
final StringBuffer dimString = StringBuffer();
- if (widget.exifData["resolution"] != null &&
+ int? width;
+ int? height;
+ if (widget.file.hasDimensions) {
+ width = widget.file.width;
+ height = widget.file.height;
+ } else if (widget.isImage) {
+ // No saved public dimensions (local-only / not-yet-backed-up / removed
+ // from Ente). Derive from the actual current local file bytes so we show
+ // the real rendered size instead of the (often stale) EXIF tag. Uses the
+ // non-origin file (asset.file on iOS = the current rendered image).
+ try {
+ final localFile = await getFile(widget.file);
+ final decoded = localFile != null
+ ? await getImageHeightAndWith(imagePath: localFile.path)
+ : null;
+ if (decoded != null) {
+ width = decoded["width"];
+ height = decoded["height"];
+ }
+ } catch (_) {}
+ }
+ if (width != null && height != null && width != 0 && height != 0) {
+ final double megaPixels = (width * height) / 1000000;
+ final double roundedMegaPixels = (megaPixels * 10).round() / 10.0;
+ dimString.write('${roundedMegaPixels.toStringAsFixed(1)}MP ');
+ dimString.write('$width x $height');
+ } else if (widget.exifData["resolution"] != null &&
widget.exifData["megaPixels"] != null) {
dimString.write('${widget.exifData["megaPixels"]}MP ');
dimString.write('${widget.exifData["resolution"]}');
- } else if (widget.file.hasDimensions) {
- final double megaPixels =
- (widget.file.width * widget.file.height) / 1000000;
- final double roundedMegaPixels = (megaPixels * 10).round() / 10.0;
- dimString.write('${roundedMegaPixels.toStringAsFixed(1)}MP ');
- dimString.write('${widget.file.width} x ${widget.file.height}');
}
- final subSectionWidgets = <Widget>[];
+
if (dimString.isNotEmpty) {
- subSectionWidgets.add(Text(dimString.toString(), style: textStyle));
+ parts.add(dimString.toString());
}
int fileSize;
diff --cc mobile/apps/photos/lib/ui/viewer/file_details/preview_properties_item_widget.dart
index 93626eb695,0a5e105648..4a2ded9c35
--- 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
@@@ -52,17 -41,23 +52,21 @@@ class _PreviewPropertiesItemWidgetStat
}
Future<void> _getSection() async {
+ if (!mounted) return;
- final textStyle = getEnteTextTheme(context).miniMuted;
- final subSectionWidgets = <Widget>[];
++
+ final parts = <String>[];
final data = await VideoPreviewService.instance
.getPlaylist(widget.file)
.onError((error, stackTrace) {
- if (!mounted) return;
return null;
});
+ if (data == null) return;
- if (!mounted || data == null) return;
++ if (!mounted) return;
+
if (data.width != null && data.height != null) {
- subSectionWidgets.add(
- Text("${data.width}x${data.height}", style: textStyle),
- );
+ parts.add("${data.width!}x${data.height!}");
}
if (data.size != null) {