π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
update preview properties
aman-pilot3eb9a400511d
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 cc0c2bf1fb..93626eb695 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,12 +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 {final EnteFile file;@@ -27,7 +27,7 @@ class PreviewPropertiesItemWidget extends StatefulWidget {class _PreviewPropertiesItemWidgetStateextends State<PreviewPropertiesItemWidget> {- Widget? child;+ String? _subtitle;@overridevoid initState() {@@ -37,51 +37,53 @@ class _PreviewPropertiesItemWidgetState@overrideWidget build(BuildContext context) {- return child ?? const SizedBox();+ if (_subtitle == null) return const SizedBox();+ final colors = context.componentColors;+ return MenuComponent(+ key: const ValueKey("Stream properties"),+ leading: HugeIcon(+ icon: HugeIcons.strokeRoundedPlay,+ size: IconSizes.small,+ color: colors.textLight,+ ),+ title: AppLocalizations.of(context).streamDetails,+ subtitle: _subtitle,+ );}Future<void> _getSection() async {- 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 (data!.width != null && data.height != null) {- subSectionWidgets.add(- Text("${data.width!}x${data.height!}", style: textStyle),- );+ if (data.width != null && data.height != null) {+ parts.add("${data.width!}x${data.height!}");}if (data.size != null) {- subSectionWidgets.add(Text(formatBytes(data.size!), style: textStyle));+ parts.add(formatBytes(data.size!));}if ((widget.file.fileType == FileType.video) &&(widget.file.localID != null || widget.file.duration != 0) &&data.size != null) {- // show bitrate, i.e. size * 8 / duration formattedfinal result = FFProbeProps.formatBitrate(data.size! * 8 / widget.file.duration!,"b/s",);if (result != null) {- subSectionWidgets.add(Text(result, style: textStyle));+ parts.add(result);}}- if (subSectionWidgets.isEmpty) return;+ if (parts.isEmpty) return;- child = InfoItemWidget(- key: const ValueKey("Stream properties"),- leadingIcon: Icons.play_circle_outline,- title: AppLocalizations.of(context).streamDetails,- subtitleSection: Future.value(subSectionWidgets),- );+ _subtitle = parts.join(" ");if (mounted) {setState(() {});}