π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add Rewind stats charts
laurenspriem88e2f9f8054c
diff --git a/mobile/apps/photos/lib/services/wrapped/builders/stats_candidate_builder.dart b/mobile/apps/photos/lib/services/wrapped/builders/stats_candidate_builder.dartindex 8f318ffc00..51a701daf3 100644--- a/mobile/apps/photos/lib/services/wrapped/builders/stats_candidate_builder.dart+++ b/mobile/apps/photos/lib/services/wrapped/builders/stats_candidate_builder.dart@@ -148,24 +148,7 @@ class StatsCandidateBuilder extends WrappedCandidateBuilder {"Longest breather: ${numberFormat.format(snapshot.longestGapDays)} days",]);- final List<int> rhythmIds = _collectUniqueIds(- <List<int>>[- snapshot.streakStartUploadedIDs,- snapshot.busiestMonthHighlightUploadedIDs,- snapshot.breakReturnUploadedIDs,- ],- selectionTarget: 6,- );-- final List<int> rhythmCandidates = limitSelectorCandidates(rhythmIds);-- final List<MediaRef> media = WrappedMediaSelector.selectMediaRefs(- context: context,- candidateUploadedFileIDs: rhythmCandidates,- maxCount: 3,- preferNamedPeople: true,- minimumSpacing: const Duration(days: 21),- );+ const List<MediaRef> media = <MediaRef>[];final Map<String, Object?> meta = <String, Object?>{"year": snapshot.year,@@ -181,6 +164,7 @@ class StatsCandidateBuilder extends WrappedCandidateBuilder {entry.key.toString(): entry.value,},"dailyCounts": snapshot.dailyCounts,+ "formatCounts": snapshot.formatCounts,"detailChips": chips,if (snapshot.longestStreakStart != null)"longestStreakStart": snapshot.longestStreakStart!.toIso8601String(),@@ -324,6 +308,7 @@ class _StatsSnapshot {required this.otherCount,required this.storageBytes,required this.monthCounts,+ required this.formatCounts,required this.dailyCounts,required this.elapsedDays,required this.daysWithCaptures,@@ -366,6 +351,7 @@ class _StatsSnapshot {final int otherCount;final int storageBytes;final Map<int, int> monthCounts;+ final Map<String, int> formatCounts;final Map<String, int> dailyCounts;final int elapsedDays;final int daysWithCaptures;@@ -408,6 +394,7 @@ class _StatsSnapshot {for (int month = 1; month <= 12; month += 1) month: 0,};final Map<int, _DayAggregate> dayAggregates = <int, _DayAggregate>{};+ final Map<String, int> formatCounts = <String, int>{};int totalCount = 0;int photoCount = 0;@@ -457,6 +444,13 @@ class _StatsSnapshot {if (uploadedId != null) {aggregate.uploadedFileIDs.add(uploadedId);}++ final String formatLabel = _resolveFormatLabel(file);+ formatCounts.update(+ formatLabel,+ (int current) => current + 1,+ ifAbsent: () => 1,+ );}final List<_DayAggregate> sortedAggregates = dayAggregates.values@@ -632,6 +626,7 @@ class _StatsSnapshot {otherCount: otherCount,storageBytes: storageBytes,monthCounts: Map<int, int>.unmodifiable(monthCounts),+ formatCounts: Map<String, int>.unmodifiable(formatCounts),dailyCounts: Map<String, int>.unmodifiable(dailyCounts),elapsedDays: elapsedDays,daysWithCaptures: daysWithCaptures,@@ -666,6 +661,55 @@ class _StatsSnapshot {heatmapMaxCount: heatmapMaxCount,);}++ static String _resolveFormatLabel(EnteFile file) {+ final String? candidateName = _firstNonEmpty(+ <String?>[+ file.title,+ file.pubMagicMetadata?.editedName,+ ],+ );+ final String rawExtension = candidateName != null+ ? p.extension(candidateName).replaceFirst(".", "")+ : "";+ final String normalizedExtension = rawExtension.toLowerCase();+ if (normalizedExtension.isEmpty) {+ return _fallbackLabelForType(file.fileType);+ }++ const Map<String, String> overrides = <String, String>{+ "jpg": "JPEG",+ "jpeg": "JPEG",+ "heif": "HEIC",+ };++ return overrides[normalizedExtension] ?? normalizedExtension.toUpperCase();+ }++ static String _fallbackLabelForType(FileType type) {+ switch (type) {+ case FileType.video:+ return "VIDEO";+ case FileType.livePhoto:+ return "LIVE PHOTO";+ case FileType.image:+ return "IMAGE";+ default:+ return "OTHER";+ }+ }++ static String? _firstNonEmpty(Iterable<String?> values) {+ for (final String? value in values) {+ if (value != null) {+ final String trimmed = value.trim();+ if (trimmed.isNotEmpty) {+ return trimmed;+ }+ }+ }+ return null;+ }}class _DayAggregate {diff --git a/mobile/apps/photos/lib/services/wrapped/candidate_builders.dart b/mobile/apps/photos/lib/services/wrapped/candidate_builders.dartindex 93e0e5810d..6af89488fd 100644--- a/mobile/apps/photos/lib/services/wrapped/candidate_builders.dart+++ b/mobile/apps/photos/lib/services/wrapped/candidate_builders.dart@@ -5,6 +5,7 @@ import "package:flutter/foundation.dart" show immutable;import "package:intl/intl.dart";import "package:ml_linalg/dtype.dart";import "package:ml_linalg/vector.dart";+import "package:path/path.dart" as p;import "package:photos/models/file/file.dart";import "package:photos/models/file/file_type.dart";import "package:photos/models/location/location.dart";diff --git a/mobile/apps/photos/lib/ui/wrapped/cards/stats_card_content.dart b/mobile/apps/photos/lib/ui/wrapped/cards/stats_card_content.dartindex db1770cf46..b255a1fa6b 100644--- a/mobile/apps/photos/lib/ui/wrapped/cards/stats_card_content.dart+++ b/mobile/apps/photos/lib/ui/wrapped/cards/stats_card_content.dart@@ -96,6 +96,14 @@ class _RhythmCardContent extends StatelessWidget {@overrideWidget build(BuildContext context) {final List<String> chips = _stringListFromMeta(card.meta, "detailChips");+ final Map<int, int> monthCounts =+ _parseMonthCounts(card.meta["monthCounts"]);+ final Map<String, int> formatCounts =+ _parseFormatCounts(card.meta["formatCounts"]);+ final int totalFormatCount = formatCounts.values.fold(+ 0,+ (int sum, int value) => sum + value,+ );return Column(crossAxisAlignment: CrossAxisAlignment.start,@@ -110,11 +118,21 @@ class _RhythmCardContent extends StatelessWidget {textTheme.bodyMuted,padding: const EdgeInsets.only(top: 12),),- if (card.media.isNotEmpty) ...[- const SizedBox(height: 22),- _MediaRow(- media: card.media.take(3).toList(growable: false),+ if (monthCounts.isNotEmpty) ...[+ const SizedBox(height: 24),+ _MonthlyCaptureChart(+ monthCounts: monthCounts,colorScheme: colorScheme,+ textTheme: textTheme,+ ),+ ],+ if (formatCounts.isNotEmpty && totalFormatCount > 0) ...[+ const SizedBox(height: 24),+ _FormatDistributionChart(+ formatCounts: formatCounts,+ totalCount: totalFormatCount,+ colorScheme: colorScheme,+ textTheme: textTheme,),],if (chips.isNotEmpty) ...[@@ -131,6 +149,689 @@ class _RhythmCardContent extends StatelessWidget {}}+Map<int, int> _parseMonthCounts(Object? raw) {+ if (raw is Map) {+ final Map<int, int> result = <int, int>{};+ raw.forEach((dynamic key, dynamic value) {+ int? month;+ if (key is int) {+ month = key;+ } else if (key is String) {+ month = int.tryParse(key);+ }+ if (month == null || month < 1 || month > 12) {+ return;+ }+ if (value is num) {+ result[month] = value.toInt();+ }+ });+ return result;+ }+ return const <int, int>{};+}++Map<String, int> _parseFormatCounts(Object? raw) {+ if (raw is Map) {+ final Map<String, int> result = <String, int>{};+ raw.forEach((dynamic key, dynamic value) {+ if (key == null || value is! num) {+ return;+ }+ final String label = key.toString();+ if (label.isEmpty) {+ return;+ }+ result[label] = value.toInt();+ });+ return result;+ }+ return const <String, int>{};+}++double _resolveAxisMax(double rawMax) {+ if (rawMax <= 0) {+ return 1;+ }+ return math.max(1, _niceCeiling(rawMax));+}++List<_ChartTick> _buildAxisTicks(double axisMax) {+ if (axisMax <= 0) {+ return const <_ChartTick>[+ _ChartTick(value: 0, label: "0"),+ ];+ }++ const int divisions = 2; // top, mid, baseline+ final double step = axisMax / divisions;+ final NumberFormat compactFormat = NumberFormat.compact();+ final NumberFormat integerFormat = NumberFormat.decimalPattern();++ final List<_ChartTick> ticks = <_ChartTick>[];+ for (int i = 0; i <= divisions; i += 1) {+ final double value = axisMax - (step * i);+ final double normalized = i == divisions ? 0 : value.clamp(0, axisMax);++ final String label;+ if (normalized <= 0) {+ label = "0";+ } else if (axisMax >= 1000) {+ label = compactFormat.format(normalized);+ } else {+ label = integerFormat.format(normalized.round());+ }++ ticks.add(+ _ChartTick(+ value: normalized,+ label: label,+ ),+ );+ }+ return ticks;+}++double _niceCeiling(double value) {+ if (value <= 0) {+ return 1;+ }+ final double log10 = math.log(value) / math.ln10;+ final double exponent = math.pow(10, log10.floor()).toDouble();+ final double fraction = value / exponent;+ double niceFraction;+ if (fraction <= 1) {+ niceFraction = 1;+ } else if (fraction <= 2) {+ niceFraction = 2;+ } else if (fraction <= 5) {+ niceFraction = 5;+ } else {+ niceFraction = 10;+ }+ final double niceValue = niceFraction * exponent;+ if (niceValue < value) {+ return niceValue * 2;+ }+ return niceValue;+}++const String _otherLabel = "Other";++List<MapEntry<String, int>> _limitFormatEntries(+ List<MapEntry<String, int>> entries,+ int maxEntries,+) {+ if (entries.length <= maxEntries) {+ return entries;+ }+ final List<MapEntry<String, int>> limited =+ entries.take(maxEntries).toList(growable: true);+ final int remainder = entries.skip(maxEntries).fold<int>(+ 0,+ (int sum, MapEntry<String, int> entry) => sum + entry.value,+ );+ if (remainder > 0) {+ limited.add(MapEntry<String, int>(_otherLabel, remainder));+ }+ return limited;+}++class _ChartTick {+ const _ChartTick({+ required this.value,+ required this.label,+ });++ final double value;+ final String label;++ @override+ bool operator ==(Object other) {+ if (identical(this, other)) return true;+ return other is _ChartTick && value == other.value && label == other.label;+ }++ @override+ int get hashCode => Object.hash(value, label);+}++class _MonthlyCaptureChart extends StatelessWidget {+ const _MonthlyCaptureChart({+ required this.monthCounts,+ required this.colorScheme,+ required this.textTheme,+ });++ final Map<int, int> monthCounts;+ final EnteColorScheme colorScheme;+ final EnteTextTheme textTheme;++ static const double _axisLabelWidth = 44;+ static const double _axisLabelSpacing = 6;+ static const List<String> _labels = <String>[+ "J",+ "F",+ "M",+ "A",+ "M",+ "J",+ "J",+ "A",+ "S",+ "O",+ "N",+ "D",+ ];++ @override+ Widget build(BuildContext context) {+ final List<int> orderedCounts = List<int>.generate(+ 12,+ (int index) => monthCounts[index + 1] ?? 0,+ growable: false,+ );+ final double rawMaxValue = orderedCounts.fold<double>(+ 0,+ (double currentMax, int value) => math.max(currentMax, value.toDouble()),+ );+ final double axisMax = _resolveAxisMax(rawMaxValue);+ final List<_ChartTick> ticks = _buildAxisTicks(axisMax);++ final Color accent = colorScheme.primary500;+ final Color gridColor = colorScheme.fillMuted.withValues(alpha: 0.35);+ final Color background = colorScheme.fillMuted.withValues(alpha: 0.12);+ final Color axisColor = colorScheme.fillMuted.withValues(alpha: 0.45);+ final Color outlineColor = colorScheme.backgroundElevated;++ return Container(+ width: double.infinity,+ decoration: BoxDecoration(+ color: background,+ borderRadius: BorderRadius.circular(20),+ ),+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ SizedBox(+ height: 160,+ width: double.infinity,+ child: CustomPaint(+ painter: _MonthlyCaptureChartPainter(+ values: orderedCounts+ .map((int value) => value.toDouble())+ .toList(growable: false),+ maxValue: axisMax <= 0 ? 1 : axisMax,+ lineColor: accent,+ fillColor: accent.withValues(alpha: 0.18),+ gridColor: gridColor,+ axisColor: axisColor,+ pointColor: accent,+ pointOutlineColor: outlineColor,+ axisLabelStyle: textTheme.miniMuted,+ axisLabelWidth: _axisLabelWidth,+ axisLabelSpacing: _axisLabelSpacing,+ ticks: ticks,+ ),+ ),+ ),+ const SizedBox(height: 12),+ Padding(+ padding: const EdgeInsets.only(+ left: _axisLabelWidth + _axisLabelSpacing,+ right: 8,+ ),+ child: Row(+ children: [+ for (final String label in _labels)+ Expanded(+ child: Text(+ label,+ textAlign: TextAlign.center,+ style: textTheme.tinyMuted,+ ),+ ),+ ],+ ),+ ),+ ],+ ),+ );+ }+}++class _MonthlyCaptureChartPainter extends CustomPainter {+ _MonthlyCaptureChartPainter({+ required this.values,+ required this.maxValue,+ required this.lineColor,+ required this.fillColor,+ required this.gridColor,+ required this.axisColor,+ required this.pointColor,+ required this.pointOutlineColor,+ required this.axisLabelStyle,+ required this.axisLabelWidth,+ required this.axisLabelSpacing,+ required this.ticks,+ });++ final List<double> values;+ final double maxValue;+ final Color lineColor;+ final Color fillColor;+ final Color gridColor;+ final Color axisColor;+ final Color pointColor;+ final Color pointOutlineColor;+ final TextStyle axisLabelStyle;+ final double axisLabelWidth;+ final double axisLabelSpacing;+ final List<_ChartTick> ticks;++ @override+ void paint(Canvas canvas, Size size) {+ if (values.isEmpty) {+ return;+ }++ const double rightPadding = 12;+ const double topPadding = 12;+ const double bottomPadding = 12;+ final double leftPadding = axisLabelWidth + axisLabelSpacing;+ final double chartHeight = math.max(+ 0,+ size.height - topPadding - bottomPadding,+ );+ final double chartWidth = math.max(+ 0,+ size.width - leftPadding - rightPadding,+ );+ final double baselineY = topPadding + chartHeight;++ final Paint gridPaint = Paint()+ ..color = gridColor+ ..strokeWidth = 1;++ for (final _ChartTick tick in ticks) {+ final double fraction =+ maxValue <= 0 ? 0 : (tick.value / maxValue).clamp(0, 1);+ final double y = baselineY - (fraction * chartHeight);++ if (tick.value > 0) {+ canvas.drawLine(+ Offset(leftPadding, y),+ Offset(size.width - rightPadding, y),+ gridPaint,+ );+ }++ final TextPainter labelPainter = TextPainter(+ text: TextSpan(+ text: tick.label,+ style: axisLabelStyle,+ ),+ textAlign: TextAlign.right,+ textDirection: ui.TextDirection.ltr,+ )..layout();++ labelPainter.paint(+ canvas,+ Offset(+ axisLabelWidth - axisLabelSpacing - labelPainter.width,+ y - (labelPainter.height / 2),+ ),+ );+ }++ final List<Offset> points = <Offset>[];+ final double stepX =+ values.length <= 1 ? 0 : chartWidth / (values.length - 1);+ for (int i = 0; i < values.length; i += 1) {+ final double fraction =+ maxValue <= 0 ? 0 : (values[i] / maxValue).clamp(0, 1);+ final double x = values.length <= 1+ ? leftPadding + (chartWidth / 2)+ : leftPadding + (stepX * i);+ final double y = baselineY - (fraction * chartHeight);+ points.add(Offset(x, y));+ }++ if (points.isEmpty) {+ return;+ }++ final Path fillPath = Path()..moveTo(points.first.dx, baselineY);+ for (final Offset point in points) {+ fillPath.lineTo(point.dx, point.dy);+ }+ fillPath+ ..lineTo(points.last.dx, baselineY)+ ..close();++ final Rect fillBounds = Rect.fromLTWH(+ leftPadding,+ topPadding,+ chartWidth,+ chartHeight,+ );+ final Paint fillPaint = Paint()+ ..shader = LinearGradient(+ colors: <Color>[+ fillColor,+ fillColor.withValues(alpha: 0.02),+ ],+ begin: Alignment.topCenter,+ end: Alignment.bottomCenter,+ ).createShader(fillBounds);+ canvas.drawPath(fillPath, fillPaint);++ final Paint axisPaint = Paint()+ ..color = axisColor+ ..strokeWidth = 1.2;+ canvas.drawLine(+ Offset(leftPadding, topPadding),+ Offset(leftPadding, baselineY),+ axisPaint,+ );+ canvas.drawLine(+ Offset(leftPadding, baselineY),+ Offset(size.width - rightPadding, baselineY),+ axisPaint,+ );++ final Path linePath = Path()..moveTo(points.first.dx, points.first.dy);+ for (int i = 1; i < points.length; i += 1) {+ linePath.lineTo(points[i].dx, points[i].dy);+ }++ final Paint linePaint = Paint()+ ..color = lineColor+ ..style = PaintingStyle.stroke+ ..strokeWidth = 3+ ..strokeCap = StrokeCap.round;+ canvas.drawPath(linePath, linePaint);++ final Paint pointOutlinePaint = Paint()+ ..color = pointOutlineColor+ ..style = PaintingStyle.stroke+ ..strokeWidth = 2;+ final Paint pointPaint = Paint()+ ..color = pointColor+ ..style = PaintingStyle.fill;++ for (final Offset point in points) {+ canvas.drawCircle(point, 4, pointOutlinePaint);+ canvas.drawCircle(point, 4, pointPaint);+ }+ }++ @override+ bool shouldRepaint(covariant _MonthlyCaptureChartPainter oldDelegate) {+ return oldDelegate.values != values ||+ oldDelegate.maxValue != maxValue ||+ oldDelegate.lineColor != lineColor ||+ oldDelegate.fillColor != fillColor ||+ oldDelegate.gridColor != gridColor ||+ oldDelegate.axisColor != axisColor ||+ oldDelegate.pointColor != pointColor ||+ oldDelegate.pointOutlineColor != pointOutlineColor ||+ oldDelegate.axisLabelStyle != axisLabelStyle ||+ oldDelegate.axisLabelWidth != axisLabelWidth ||+ oldDelegate.axisLabelSpacing != axisLabelSpacing ||+ !listEquals(oldDelegate.ticks, ticks);+ }+}++class _FormatDistributionChart extends StatelessWidget {+ const _FormatDistributionChart({+ required this.formatCounts,+ required this.totalCount,+ required this.colorScheme,+ required this.textTheme,+ });++ final Map<String, int> formatCounts;+ final int totalCount;+ final EnteColorScheme colorScheme;+ final EnteTextTheme textTheme;++ @override+ Widget build(BuildContext context) {+ final List<MapEntry<String, int>> sortedEntries = formatCounts.entries+ .where((MapEntry<String, int> entry) => entry.value > 0)+ .toList(growable: false)+ ..sort(+ (MapEntry<String, int> a, MapEntry<String, int> b) =>+ b.value.compareTo(a.value),+ );+ if (sortedEntries.isEmpty) {+ return const SizedBox.shrink();+ }++ const int maxLegendEntries = 6;+ final List<MapEntry<String, int>> entries =+ _limitFormatEntries(sortedEntries, maxLegendEntries);++ final NumberFormat numberFormat = NumberFormat.decimalPattern();+ final List<Color> palette = colorScheme.avatarColors;+ final List<Color> colors = <Color>[];+ for (int i = 0; i < entries.length; i += 1) {+ final String label = entries[i].key;+ if (i == 0) {+ colors.add(colorScheme.primary500);+ } else if (label == _otherLabel) {+ colors.add(colorScheme.fillStrong);+ } else if (palette.isNotEmpty) {+ final int paletteIndex = (i - 1) % palette.length;+ colors.add(palette[paletteIndex]);+ } else {+ colors.add(colorScheme.primary400);+ }+ }++ return Container(+ width: double.infinity,+ decoration: BoxDecoration(+ color: colorScheme.fillMuted.withValues(alpha: 0.12),+ borderRadius: BorderRadius.circular(20),+ ),+ padding: const EdgeInsets.all(16),+ child: Row(+ crossAxisAlignment: CrossAxisAlignment.center,+ children: [+ SizedBox(+ height: 140,+ width: 140,+ child: CustomPaint(+ painter: _FormatPieChartPainter(+ values: entries+ .map(+ (MapEntry<String, int> entry) => entry.value.toDouble(),+ )+ .toList(growable: false),+ colors: colors,+ totalLabel: numberFormat.format(totalCount),+ totalCaption: "files",+ totalStyle: textTheme.largeBold,+ captionStyle: textTheme.tinyMuted,+ ringBackgroundColor:+ colorScheme.fillMuted.withValues(alpha: 0.18),+ ),+ ),+ ),+ const SizedBox(width: 20),+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ mainAxisSize: MainAxisSize.min,+ children: [+ for (int index = 0; index < entries.length; index += 1)+ Padding(+ padding: EdgeInsets.only(+ bottom: index == entries.length - 1 ? 0 : 10,+ ),+ child: _FormatLegendEntry(+ color: colors[index],+ label:+ "${entries[index].key} ${numberFormat.format(entries[index].value)}",+ textTheme: textTheme,+ ),+ ),+ ],+ ),+ ),+ ],+ ),+ );+ }+}++class _FormatPieChartPainter extends CustomPainter {+ _FormatPieChartPainter({+ required this.values,+ required this.colors,+ required this.totalLabel,+ required this.totalCaption,+ required this.totalStyle,+ required this.captionStyle,+ required this.ringBackgroundColor,+ });++ final List<double> values;+ final List<Color> colors;+ final String totalLabel;+ final String totalCaption;+ final TextStyle totalStyle;+ final TextStyle captionStyle;+ final Color ringBackgroundColor;++ @override+ void paint(Canvas canvas, Size size) {+ final Offset center = size.center(Offset.zero);+ final double radius = math.min(size.width, size.height) / 2;+ final double strokeWidth = radius * 0.35;+ final Rect arcRect = Rect.fromCircle(+ center: center,+ radius: radius - (strokeWidth / 2),+ );++ final Paint basePaint = Paint()+ ..isAntiAlias = true+ ..color = ringBackgroundColor+ ..style = PaintingStyle.stroke+ ..strokeWidth = strokeWidth;+ canvas.drawArc(arcRect, 0, 2 * math.pi, false, basePaint);++ final double total = values.fold<double>(+ 0,+ (double sum, double value) => sum + value,+ );+ if (total > 0) {+ double startAngle = -math.pi / 2;+ for (int i = 0; i < values.length; i += 1) {+ final double value = values[i];+ if (value <= 0) {+ continue;+ }+ final double sweepAngle = (value / total) * 2 * math.pi;+ final Paint segmentPaint = Paint()+ ..isAntiAlias = true+ ..color = colors[i]+ ..style = PaintingStyle.stroke+ ..strokeWidth = strokeWidth+ ..strokeCap = StrokeCap.round;+ canvas.drawArc(arcRect, startAngle, sweepAngle, false, segmentPaint);+ startAngle += sweepAngle;+ }+ }++ _drawTotal(canvas, center);+ }++ void _drawTotal(Canvas canvas, Offset center) {+ final TextPainter totalPainter = TextPainter(+ text: TextSpan(+ text: totalLabel,+ style: totalStyle,+ ),+ textAlign: TextAlign.center,+ textDirection: ui.TextDirection.ltr,+ )..layout();++ final TextPainter captionPainter = TextPainter(+ text: TextSpan(+ text: totalCaption,+ style: captionStyle,+ ),+ textAlign: TextAlign.center,+ textDirection: ui.TextDirection.ltr,+ )..layout();++ final double combinedHeight =+ totalPainter.height + 6 + captionPainter.height;+ final double startY = center.dy - (combinedHeight / 2);++ totalPainter.paint(+ canvas,+ Offset(center.dx - (totalPainter.width / 2), startY),+ );+ captionPainter.paint(+ canvas,+ Offset(+ center.dx - (captionPainter.width / 2),+ startY + totalPainter.height + 6,+ ),+ );+ }++ @override+ bool shouldRepaint(covariant _FormatPieChartPainter oldDelegate) {+ return oldDelegate.values != values ||+ oldDelegate.colors != colors ||+ oldDelegate.totalLabel != totalLabel ||+ oldDelegate.totalCaption != totalCaption ||+ oldDelegate.totalStyle != totalStyle ||+ oldDelegate.captionStyle != captionStyle ||+ oldDelegate.ringBackgroundColor != ringBackgroundColor;+ }+}++class _FormatLegendEntry extends StatelessWidget {+ const _FormatLegendEntry({+ required this.color,+ required this.label,+ required this.textTheme,+ });++ final Color color;+ final String label;+ final EnteTextTheme textTheme;++ @override+ Widget build(BuildContext context) {+ return Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Container(+ width: 10,+ height: 10,+ decoration: BoxDecoration(+ color: color,+ shape: BoxShape.circle,+ ),+ ),+ const SizedBox(width: 8),+ Text(+ label,+ style: textTheme.smallMuted,+ ),+ ],+ );+ }+}+class _BusiestDayCardContent extends StatelessWidget {const _BusiestDayCardContent({required this.card,diff --git a/mobile/apps/photos/lib/ui/wrapped/wrapped_viewer_page.dart b/mobile/apps/photos/lib/ui/wrapped/wrapped_viewer_page.dartindex 67837b2092..db2f77adb3 100644--- a/mobile/apps/photos/lib/ui/wrapped/wrapped_viewer_page.dart+++ b/mobile/apps/photos/lib/ui/wrapped/wrapped_viewer_page.dart@@ -6,6 +6,7 @@ import "package:flutter/foundation.dart";import "package:flutter/material.dart";import "package:flutter/rendering.dart";import "package:flutter/services.dart";+import "package:intl/intl.dart";import "package:logging/logging.dart";import "package:photos/db/files_db.dart";import "package:photos/ente_theme_data.dart";