Skip to content

armgit / ente

Public Imported from GitHub
0

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

Use component text styles in Photos theme

ashilknf3d05235c2d8
diff --git a/mobile/apps/photos/lib/ente_theme_data.dart b/mobile/apps/photos/lib/ente_theme_data.dart
index 7a6b8d1b93..a2ca33d1ab 100644
--- a/mobile/apps/photos/lib/ente_theme_data.dart
+++ b/mobile/apps/photos/lib/ente_theme_data.dart
@@ -1,4 +1,5 @@
import 'package:ente_components/theme/colors.dart' show ComponentApp;
+import 'package:ente_components/theme/text_styles.dart' as component;
import 'package:ente_components/theme/theme.dart'
show ComponentColorTokens, ComponentTheme;
import 'package:flutter/material.dart';
@@ -204,48 +205,15 @@ TextTheme _buildTextTheme(Color textColor) {
fontWeight: FontWeight.w600,
fontFamily: 'Inter',
),
- titleLarge: TextStyle(
- color: textColor,
- fontSize: 18,
- fontFamily: 'Inter',
- fontWeight: FontWeight.w600,
- ),
- titleMedium: TextStyle(
- color: textColor,
- fontFamily: 'Inter',
- fontSize: 16,
- fontWeight: FontWeight.w500,
- ),
- titleSmall: TextStyle(
- color: textColor,
- fontFamily: 'Inter',
- fontSize: 14,
- fontWeight: FontWeight.w500,
- ),
- bodyLarge: TextStyle(
- fontFamily: 'Inter',
- color: textColor,
- fontSize: 16,
- fontWeight: FontWeight.w500,
- ),
- bodyMedium: TextStyle(
- fontFamily: 'Inter',
- color: textColor,
- fontSize: 14,
- fontWeight: FontWeight.w500,
- ),
- bodySmall: TextStyle(
+ titleLarge: component.TextStyles.h2.copyWith(color: textColor),
+ titleMedium: component.TextStyles.large.copyWith(color: textColor),
+ titleSmall: component.TextStyles.body.copyWith(color: textColor),
+ bodyLarge: component.TextStyles.large.copyWith(color: textColor),
+ bodyMedium: component.TextStyles.body.copyWith(color: textColor),
+ bodySmall: component.TextStyles.body.copyWith(
color: textColor.withValues(alpha: 0.6),
- fontSize: 14,
- fontWeight: FontWeight.w500,
- ),
- labelSmall: TextStyle(
- fontFamily: 'Inter',
- color: textColor,
- fontSize: 14,
- fontWeight: FontWeight.w500,
- decoration: TextDecoration.underline,
),
+ labelSmall: component.TextStyles.bodyLink.copyWith(color: textColor),
);
}
diff --git a/mobile/apps/photos/lib/theme/text_style.dart b/mobile/apps/photos/lib/theme/text_style.dart
index 6fb17d4932..456be635d9 100644
--- a/mobile/apps/photos/lib/theme/text_style.dart
+++ b/mobile/apps/photos/lib/theme/text_style.dart
@@ -1,3 +1,4 @@
+import 'package:ente_components/theme/text_styles.dart' as component;
import 'package:flutter/material.dart';
import 'package:photos/theme/colors.dart';
@@ -5,6 +6,8 @@ const FontWeight _regularWeight = FontWeight.w500;
const FontWeight _boldWeight = FontWeight.w600;
const String _fontFamily = 'Inter';
+// h1-h3 stay on the legacy Photos scale because ente_components does not
+// define matching 48/32/24 styles yet.
const TextStyle h1 = TextStyle(
fontSize: 48,
height: 48 / 28,
@@ -23,42 +26,15 @@ const TextStyle h3 = TextStyle(
fontWeight: _regularWeight,
fontFamily: _fontFamily,
);
-const TextStyle h4 = TextStyle(
- fontSize: 20,
- height: 24 / 20.0,
- fontWeight: _regularWeight,
- fontFamily: _fontFamily,
-);
-const TextStyle large = TextStyle(
- fontSize: 18,
- height: 22 / 18.0,
- fontWeight: _regularWeight,
- fontFamily: _fontFamily,
-);
-const TextStyle body = TextStyle(
- fontSize: 16,
- height: 20 / 16.0,
- fontWeight: _regularWeight,
- fontFamily: _fontFamily,
-);
-const TextStyle small = TextStyle(
- fontSize: 14,
- height: 17 / 14.0,
- fontWeight: _regularWeight,
- fontFamily: _fontFamily,
-);
-const TextStyle mini = TextStyle(
- fontSize: 12,
- height: 15 / 12.0,
- fontWeight: _regularWeight,
- fontFamily: _fontFamily,
-);
-const TextStyle tiny = TextStyle(
- fontSize: 10,
- height: 12 / 10.0,
- fontWeight: _regularWeight,
- fontFamily: _fontFamily,
-);
+const TextStyle h4 = component.TextStyles.h1Bold;
+const TextStyle large = component.TextStyles.h2;
+const TextStyle body = component.TextStyles.large;
+const TextStyle small = component.TextStyles.body;
+const TextStyle mini = component.TextStyles.mini;
+const TextStyle tiny = component.TextStyles.tiny;
+
+const TextStyle _h4Bold = component.TextStyles.h1;
+const TextStyle _smallBold = component.TextStyles.bodyBold;
class EnteTextTheme {
final TextStyle h1;
@@ -168,13 +144,13 @@ EnteTextTheme _buildEnteTextStyle(
h3: h3.copyWith(color: color),
h3Bold: h3.copyWith(color: color, fontWeight: _boldWeight),
h4: h4.copyWith(color: color),
- h4Bold: h4.copyWith(color: color, fontWeight: _boldWeight),
+ h4Bold: _h4Bold.copyWith(color: color),
large: large.copyWith(color: color),
largeBold: large.copyWith(color: color, fontWeight: _boldWeight),
body: body.copyWith(color: color),
bodyBold: body.copyWith(color: color, fontWeight: _boldWeight),
small: small.copyWith(color: color),
- smallBold: small.copyWith(color: color, fontWeight: _boldWeight),
+ smallBold: _smallBold.copyWith(color: color),
mini: mini.copyWith(color: color),
miniBold: mini.copyWith(color: color, fontWeight: _boldWeight),
tiny: tiny.copyWith(color: color),