Skip to content

armgit / ente

Public Imported from GitHub
0

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

Center titles

laurenspriem57a164625667
diff --git a/mobile/apps/photos/lib/ui/wrapped/cards/aesthetics_card_content.dart b/mobile/apps/photos/lib/ui/wrapped/cards/aesthetics_card_content.dart
index dedbb5b4a3..33631853ca 100644
--- a/mobile/apps/photos/lib/ui/wrapped/cards/aesthetics_card_content.dart
+++ b/mobile/apps/photos/lib/ui/wrapped/cards/aesthetics_card_content.dart
@@ -58,17 +58,15 @@ class _BlurryFacesCardContent extends StatelessWidget {
colorScheme: colorScheme,
),
const SizedBox(height: 24),
- Text(
+ buildWrappedCardTitle(
card.title,
- style: textTheme.h2Bold,
+ textTheme.h2Bold,
),
if (card.subtitle != null && card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ card.subtitle!,
+ textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- card.subtitle!,
- style: textTheme.bodyMuted,
- ),
),
if (chips.isNotEmpty) ...[
const SizedBox(height: 20),
@@ -111,17 +109,15 @@ class _YearInColorCardContent extends StatelessWidget {
colorScheme: colorScheme,
),
const SizedBox(height: 24),
- Text(
+ buildWrappedCardTitle(
card.title,
- style: textTheme.h2Bold,
+ textTheme.h2Bold,
),
if (card.subtitle != null && card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ card.subtitle!,
+ textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- card.subtitle!,
- style: textTheme.bodyMuted,
- ),
),
if (palette.isNotEmpty) ...[
const SizedBox(height: 18),
@@ -163,17 +159,15 @@ class _MonochromeCardContent extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(
+ buildWrappedCardTitle(
card.title,
- style: textTheme.h2Bold,
+ textTheme.h2Bold,
),
if (card.subtitle != null && card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ card.subtitle!,
+ textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- card.subtitle!,
- style: textTheme.bodyMuted,
- ),
),
const SizedBox(height: 20),
_MediaGrid(
@@ -212,17 +206,15 @@ class _TopWowCardContent extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(
+ buildWrappedCardTitle(
card.title,
- style: textTheme.h2Bold,
+ textTheme.h2Bold,
),
if (card.subtitle != null && card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ card.subtitle!,
+ textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- card.subtitle!,
- style: textTheme.bodyMuted,
- ),
),
const SizedBox(height: 20),
_MediaGrid(
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 56fda7e259..8e01a5f59d 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
@@ -56,16 +56,17 @@ class _BadgeCardContent extends StatelessWidget {
children: [
const SizedBox(height: 12),
Align(
- alignment: Alignment.centerLeft,
+ alignment: Alignment.center,
child: FittedBox(
fit: BoxFit.scaleDown,
- alignment: Alignment.centerLeft,
+ alignment: Alignment.center,
child: Text(
card.title,
style: textTheme.h1Bold.copyWith(
color: Colors.white,
height: 1.05,
),
+ textAlign: TextAlign.center,
maxLines: 1,
),
),
diff --git a/mobile/apps/photos/lib/ui/wrapped/cards/curation_card_content.dart b/mobile/apps/photos/lib/ui/wrapped/cards/curation_card_content.dart
index a301d08f98..f9518e9748 100644
--- a/mobile/apps/photos/lib/ui/wrapped/cards/curation_card_content.dart
+++ b/mobile/apps/photos/lib/ui/wrapped/cards/curation_card_content.dart
@@ -98,17 +98,15 @@ class _FavoritesCardContentState extends State<_FavoritesCardContent> {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(
+ buildWrappedCardTitle(
widget.card.title,
- style: widget.textTheme.h2Bold,
+ widget.textTheme.h2Bold,
),
if (widget.card.subtitle != null && widget.card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ widget.card.subtitle!,
+ widget.textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- widget.card.subtitle!,
- style: widget.textTheme.bodyMuted,
- ),
),
if (detailChips.isNotEmpty) ...[
const SizedBox(height: 18),
diff --git a/mobile/apps/photos/lib/ui/wrapped/cards/people_card_content.dart b/mobile/apps/photos/lib/ui/wrapped/cards/people_card_content.dart
index fa722dbe6c..1c229b709a 100644
--- a/mobile/apps/photos/lib/ui/wrapped/cards/people_card_content.dart
+++ b/mobile/apps/photos/lib/ui/wrapped/cards/people_card_content.dart
@@ -58,17 +58,15 @@ class _TopPersonCardContent extends StatelessWidget {
colorScheme: colorScheme,
),
const SizedBox(height: 24),
- Text(
+ buildWrappedCardTitle(
card.title,
- style: textTheme.h2Bold,
+ textTheme.h2Bold,
),
if (card.subtitle != null && card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ card.subtitle!,
+ textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- card.subtitle!,
- style: textTheme.bodyMuted,
- ),
),
if (chips.isNotEmpty) ...[
const SizedBox(height: 20),
@@ -102,17 +100,15 @@ class _TopThreePeopleCardContent extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(
+ buildWrappedCardTitle(
card.title,
- style: textTheme.h2Bold,
+ textTheme.h2Bold,
),
if (card.subtitle != null && card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ card.subtitle!,
+ textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- card.subtitle!,
- style: textTheme.bodyMuted,
- ),
),
if (card.media.isNotEmpty) ...[
const SizedBox(height: 24),
@@ -153,17 +149,15 @@ class _GroupVsSoloCardContent extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(
+ buildWrappedCardTitle(
card.title,
- style: textTheme.h2Bold,
+ textTheme.h2Bold,
),
if (card.subtitle != null && card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ card.subtitle!,
+ textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- card.subtitle!,
- style: textTheme.bodyMuted,
- ),
),
if (card.media.isNotEmpty) ...[
const SizedBox(height: 20),
@@ -209,17 +203,15 @@ class _NewFacesCardContent extends StatelessWidget {
colorScheme: colorScheme,
),
const SizedBox(height: 24),
- Text(
+ buildWrappedCardTitle(
card.title,
- style: textTheme.h2Bold,
+ textTheme.h2Bold,
),
if (card.subtitle != null && card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ card.subtitle!,
+ textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- card.subtitle!,
- style: textTheme.bodyMuted,
- ),
),
if (chips.isNotEmpty) ...[
const SizedBox(height: 20),
diff --git a/mobile/apps/photos/lib/ui/wrapped/cards/places_card_content.dart b/mobile/apps/photos/lib/ui/wrapped/cards/places_card_content.dart
index e35f2bb61f..e00cc03fc8 100644
--- a/mobile/apps/photos/lib/ui/wrapped/cards/places_card_content.dart
+++ b/mobile/apps/photos/lib/ui/wrapped/cards/places_card_content.dart
@@ -45,17 +45,15 @@ class _TopCitiesCardContent extends StatelessWidget {
colorScheme: colorScheme,
),
const SizedBox(height: 24),
- Text(
+ buildWrappedCardTitle(
card.title,
- style: textTheme.h2Bold,
+ textTheme.h2Bold,
),
if (card.subtitle != null && card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ card.subtitle!,
+ textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- card.subtitle!,
- style: textTheme.bodyMuted,
- ),
),
if (stats.isNotEmpty) ...[
const SizedBox(height: 22),
@@ -290,17 +288,15 @@ class _MostVisitedSpotCardContent extends StatelessWidget {
),
],
const SizedBox(height: 24),
- Text(
+ buildWrappedCardTitle(
card.title,
- style: textTheme.h2Bold,
+ textTheme.h2Bold,
),
if (card.subtitle != null && card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ card.subtitle!,
+ textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- card.subtitle!,
- style: textTheme.bodyMuted,
- ),
),
if (chips.isNotEmpty) ...[
const SizedBox(height: 18),
diff --git a/mobile/apps/photos/lib/ui/wrapped/cards/shared_widgets.dart b/mobile/apps/photos/lib/ui/wrapped/cards/shared_widgets.dart
index c9025d7b4c..4aecdb02a0 100644
--- a/mobile/apps/photos/lib/ui/wrapped/cards/shared_widgets.dart
+++ b/mobile/apps/photos/lib/ui/wrapped/cards/shared_widgets.dart
@@ -1,5 +1,51 @@
part of 'package:photos/ui/wrapped/wrapped_viewer_page.dart';
+Widget buildWrappedCardTitle(
+ String text,
+ TextStyle style, {
+ EdgeInsetsGeometry? padding,
+}) {
+ return _buildCenteredCardText(
+ text: text,
+ style: style,
+ padding: padding,
+ );
+}
+
+Widget buildWrappedCardSubtitle(
+ String text,
+ TextStyle style, {
+ EdgeInsetsGeometry? padding,
+}) {
+ return _buildCenteredCardText(
+ text: text,
+ style: style,
+ padding: padding,
+ );
+}
+
+Widget _buildCenteredCardText({
+ required String text,
+ required TextStyle style,
+ EdgeInsetsGeometry? padding,
+}) {
+ final Widget label = Align(
+ alignment: Alignment.center,
+ child: Text(
+ text,
+ style: style,
+ textAlign: TextAlign.center,
+ ),
+ );
+ if (padding != null) {
+ return Padding(
+ padding: padding,
+ child: label,
+ );
+ }
+ return label;
+}
+
class _DetailChips extends StatelessWidget {
const _DetailChips({
required this.chips,
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.dart
index 14f0508a32..00c3ee6d8e 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
@@ -58,17 +58,15 @@ class _TotalsCardContent extends StatelessWidget {
colorScheme: colorScheme,
),
const SizedBox(height: 24),
- Text(
+ buildWrappedCardTitle(
card.title,
- style: textTheme.h2Bold,
+ textTheme.h2Bold,
),
if (card.subtitle != null && card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ card.subtitle!,
+ textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- card.subtitle!,
- style: textTheme.bodyMuted,
- ),
),
if (chips.isNotEmpty) ...[
const SizedBox(height: 20),
@@ -102,17 +100,15 @@ class _RhythmCardContent extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(
+ buildWrappedCardTitle(
card.title,
- style: textTheme.h2Bold,
+ textTheme.h2Bold,
),
if (card.subtitle != null && card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ card.subtitle!,
+ textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- card.subtitle!,
- style: textTheme.bodyMuted,
- ),
),
if (chips.isNotEmpty) ...[
const SizedBox(height: 18),
@@ -153,17 +149,15 @@ class _BusiestDayCardContent extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(
+ buildWrappedCardTitle(
card.title,
- style: textTheme.h2Bold,
+ textTheme.h2Bold,
),
if (card.subtitle != null && card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ card.subtitle!,
+ textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- card.subtitle!,
- style: textTheme.bodyMuted,
- ),
),
if (chips.isNotEmpty) ...[
const SizedBox(height: 18),
@@ -217,17 +211,15 @@ class _HeatmapCardContent extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(
+ buildWrappedCardTitle(
card.title,
- style: textTheme.h2Bold,
+ textTheme.h2Bold,
),
if (card.subtitle != null && card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ card.subtitle!,
+ textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- card.subtitle!,
- style: textTheme.bodyMuted,
- ),
),
const SizedBox(height: 18),
if (quarters.isEmpty)
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 8e74abff76..d5f9d52a8c 100644
--- a/mobile/apps/photos/lib/ui/wrapped/cards/story_card.dart
+++ b/mobile/apps/photos/lib/ui/wrapped/cards/story_card.dart
@@ -265,17 +265,15 @@ class _GenericCardContent extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(
+ buildWrappedCardTitle(
card.title,
- style: textTheme.h2Bold,
+ textTheme.h2Bold,
),
if (card.subtitle != null && card.subtitle!.isNotEmpty)
- Padding(
+ buildWrappedCardSubtitle(
+ card.subtitle!,
+ textTheme.bodyMuted,
padding: const EdgeInsets.only(top: 12),
- child: Text(
- card.subtitle!,
- style: textTheme.bodyMuted,
- ),
),
const Spacer(),
],