Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix scaling issue

laurensprieme7d20698f048
diff --git a/mobile/apps/photos/lib/ui/wrapped/cards/badge_card_content.dart b/mobile/apps/photos/lib/ui/wrapped/cards/badge_card_content.dart
index c592551255..e1691060a3 100644
--- a/mobile/apps/photos/lib/ui/wrapped/cards/badge_card_content.dart
+++ b/mobile/apps/photos/lib/ui/wrapped/cards/badge_card_content.dart
@@ -31,7 +31,6 @@ class _BadgeCardContent extends StatelessWidget {
final _BadgeVisuals visuals = _badgeVisualsFor(card);
final _WrappedViewerPageState? viewerState =
context.findAncestorStateOfType<_WrappedViewerPageState>();
- final GlobalKey? shareKey = viewerState?.shareButtonKey;
final bool hideSharePill = viewerState?.hideBadgeSharePill ?? false;
final _BadgeLayoutConstants layout = _BadgeLayoutConstants(
@@ -164,7 +163,7 @@ class _BadgeCardContent extends StatelessWidget {
onTap: viewerState == null
? null
: () => unawaited(viewerState.shareCurrentCard()),
- shareButtonKey: shareKey,
+ shareButtonKey: null,
size: Size(metrics.shareWidth, metrics.shareHeight),
),
),
diff --git a/mobile/apps/photos/lib/ui/wrapped/cards/story_card.dart b/mobile/apps/photos/lib/ui/wrapped/cards/story_card.dart
index 98e7ab548a..86b4722687 100644
--- a/mobile/apps/photos/lib/ui/wrapped/cards/story_card.dart
+++ b/mobile/apps/photos/lib/ui/wrapped/cards/story_card.dart
@@ -70,55 +70,22 @@ class _StoryCard extends StatelessWidget {
color: Colors.transparent,
borderRadius: BorderRadius.circular(24),
clipBehavior: Clip.antiAlias,
- child: isBadge
- ? Padding(
- padding: EdgeInsets.zero,
- child: _CardContent(
- card: card,
- colorScheme: colorScheme,
- textTheme: textTheme,
- ),
- )
- : Stack(
- fit: StackFit.expand,
- children: [
- _StoryCardBackground(
- card: card,
- colorScheme: colorScheme,
- ),
- if (showMeshGradient)
- _MeshGradientOverlay(
- variantIndex: gradientVariantIndex,
- ),
- Positioned.fill(
- child: DecoratedBox(
- decoration: BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- colors: [
- colorScheme.backgroundElevated
- .withValues(alpha: 0.45),
- colorScheme.backgroundElevated
- .withValues(alpha: 0.2),
- colorScheme.backgroundElevated
- .withValues(alpha: 0.08),
- ],
- stops: const <double>[0.0, 0.6, 1.0],
- ),
- ),
- ),
- ),
- Padding(
- padding: _kStoryCardInnerPadding,
- child: _CardContent(
- card: card,
- colorScheme: colorScheme,
- textTheme: textTheme,
- ),
- ),
- ],
+ child: LayoutBuilder(
+ builder: (BuildContext context, BoxConstraints constraints) {
+ return FittedBox(
+ fit: BoxFit.scaleDown,
+ alignment: Alignment.bottomCenter,
+ child: _StoryDesignSurface(
+ isBadge: isBadge,
+ showMeshGradient: showMeshGradient,
+ gradientVariantIndex: gradientVariantIndex,
+ card: card,
+ colorScheme: colorScheme,
+ textTheme: textTheme,
),
+ );
+ },
+ ),
),
),
);
@@ -412,3 +379,102 @@ class _GenericCardContent extends StatelessWidget {
);
}
}
+
+class _StoryDesignSurface extends StatelessWidget {
+ const _StoryDesignSurface({
+ required this.isBadge,
+ required this.showMeshGradient,
+ required this.gradientVariantIndex,
+ required this.card,
+ required this.colorScheme,
+ required this.textTheme,
+ });
+
+ final bool isBadge;
+ final bool showMeshGradient;
+ final int gradientVariantIndex;
+ final WrappedCard card;
+ final EnteColorScheme colorScheme;
+ final EnteTextTheme textTheme;
+
+ @override
+ Widget build(BuildContext context) {
+ return SizedBox(
+ width: _kStoryDesignWidth,
+ height: _kStoryDesignHeight + _kStoryControlReserveHeight,
+ child: isBadge
+ ? Column(
+ children: [
+ Expanded(
+ child: _CardContent(
+ card: card,
+ colorScheme: colorScheme,
+ textTheme: textTheme,
+ ),
+ ),
+ const SizedBox(
+ height:
+ _kStoryControlReserveHeight - _kStoryControlBottomPadding,
+ ),
+ const SizedBox(height: _kStoryControlBottomPadding),
+ ],
+ )
+ : ClipRRect(
+ borderRadius: BorderRadius.circular(24),
+ child: Stack(
+ fit: StackFit.expand,
+ children: [
+ _StoryCardBackground(
+ card: card,
+ colorScheme: colorScheme,
+ ),
+ if (showMeshGradient)
+ _MeshGradientOverlay(
+ variantIndex: gradientVariantIndex,
+ ),
+ Positioned.fill(
+ child: DecoratedBox(
+ decoration: BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ colors: [
+ colorScheme.backgroundElevated
+ .withValues(alpha: 0.45),
+ colorScheme.backgroundElevated
+ .withValues(alpha: 0.2),
+ colorScheme.backgroundElevated
+ .withValues(alpha: 0.08),
+ ],
+ stops: const <double>[0.0, 0.6, 1.0],
+ ),
+ ),
+ ),
+ ),
+ Positioned.fill(
+ child: Column(
+ children: [
+ Expanded(
+ child: Padding(
+ padding: _kStoryCardInnerPadding,
+ child: _CardContent(
+ card: card,
+ colorScheme: colorScheme,
+ textTheme: textTheme,
+ ),
+ ),
+ ),
+ const SizedBox(
+ height: _kStoryControlReserveHeight -
+ _kStoryControlBottomPadding,
+ ),
+ const SizedBox(height: _kStoryControlBottomPadding),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/mobile/apps/photos/lib/ui/wrapped/wrapped_viewer_page.dart b/mobile/apps/photos/lib/ui/wrapped/wrapped_viewer_page.dart
index f8f721a5fa..5267aaa074 100644
--- a/mobile/apps/photos/lib/ui/wrapped/wrapped_viewer_page.dart
+++ b/mobile/apps/photos/lib/ui/wrapped/wrapped_viewer_page.dart
@@ -47,6 +47,7 @@ const EdgeInsets _kStoryCardOuterPadding = EdgeInsets.symmetric(
horizontal: _kStoryCardOuterHorizontalInset,
vertical: _kStoryCardOuterVerticalInset,
);
+
const EdgeInsets _kStoryCardInnerPadding = EdgeInsets.fromLTRB(
_kStoryCardInnerHorizontalPadding,
_kStoryCardInnerTopPadding,
@@ -54,6 +55,11 @@ const EdgeInsets _kStoryCardInnerPadding = EdgeInsets.fromLTRB(
_kStoryCardInnerBottomPadding,
);
+const double _kStoryDesignWidth = 380.0;
+const double _kStoryDesignHeight = 700.0;
+const double _kStoryControlReserveHeight = 72.0;
+const double _kStoryControlBottomPadding = 20.0;
+
const double _kStoryControlSize = 48.0;
const double _kStoryControlIconSize = 24.0;
const double _kStoryControlHorizontalMarginFromEdge =
@@ -681,9 +687,6 @@ class _WrappedViewerPageState extends State<WrappedViewerPage>
builder: (BuildContext context) {
final MediaQueryData baseMediaQuery = MediaQuery.of(context);
final MediaQueryData clampedMediaQuery = baseMediaQuery.copyWith(
- // Some widgets still read textScaleFactor directly; keep it locked.
- // ignore: deprecated_member_use
- textScaleFactor: 1.0,
textScaler: const TextScaler.linear(1.0),
);
return MediaQuery(
@@ -820,49 +823,65 @@ class _WrappedViewerPageState extends State<WrappedViewerPage>
right: _kStoryControlHorizontalMarginFromEdge,
bottom: bottomPadding +
_kStoryControlBottomMarginFromEdge,
- child: GestureDetector(
- key: _shareButtonKey,
- behavior: HitTestBehavior.translucent,
- onTap: _handleShare,
- child: Container(
- width: _kStoryControlSize,
- height: _kStoryControlSize,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: controlBackdropColor,
- shape: BoxShape.circle,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ GestureDetector(
+ key: _shareButtonKey,
+ behavior: HitTestBehavior.translucent,
+ onTap: _handleShare,
+ child: Container(
+ width: _kStoryControlSize,
+ height: _kStoryControlSize,
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ color: controlBackdropColor,
+ shape: BoxShape.circle,
+ ),
+ child: Icon(
+ Icons.share,
+ size: _kStoryControlIconSize,
+ color: controlIconColor,
+ ),
+ ),
),
- child: Icon(
- Icons.share,
- size: _kStoryControlIconSize,
- color: controlIconColor,
+ const SizedBox(
+ height: _kStoryControlBottomPadding,
),
- ),
+ ],
),
),
Positioned(
left: _kStoryControlHorizontalMarginFromEdge,
bottom: bottomPadding +
_kStoryControlBottomMarginFromEdge,
- child: GestureDetector(
- behavior: HitTestBehavior.translucent,
- onTap: () => unawaited(_handleMusicToggle()),
- child: Container(
- width: _kStoryControlSize,
- height: _kStoryControlSize,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: controlBackdropColor,
- shape: BoxShape.circle,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ GestureDetector(
+ behavior: HitTestBehavior.translucent,
+ onTap: () => unawaited(_handleMusicToggle()),
+ child: Container(
+ width: _kStoryControlSize,
+ height: _kStoryControlSize,
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ color: controlBackdropColor,
+ shape: BoxShape.circle,
+ ),
+ child: Icon(
+ (_isMusicMuted || !_isMusicPlaying)
+ ? Icons.volume_off
+ : Icons.volume_up,
+ size: _kStoryControlIconSize,
+ color: controlIconColor,
+ ),
+ ),
),
- child: Icon(
- (_isMusicMuted || !_isMusicPlaying)
- ? Icons.volume_off
- : Icons.volume_up,
- size: _kStoryControlIconSize,
- color: controlIconColor,
+ const SizedBox(
+ height: _kStoryControlBottomPadding,
),
- ),
+ ],
),
),
],