Skip to content

armgit / ente

Public Imported from GitHub
0

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

refactor: update color

AmanRajSinghMouryac744d358234c
diff --git a/mobile/apps/photos/lib/ui/payment/subscription_common_widgets.dart b/mobile/apps/photos/lib/ui/payment/subscription_common_widgets.dart
index 90646e3361..3691be9399 100644
--- a/mobile/apps/photos/lib/ui/payment/subscription_common_widgets.dart
+++ b/mobile/apps/photos/lib/ui/payment/subscription_common_widgets.dart
@@ -1,3 +1,4 @@
+import "package:ente_components/theme/theme.dart";
import 'package:ente_pure_utils/ente_pure_utils.dart';
import 'package:flutter/material.dart';
import "package:intl/intl.dart";
@@ -162,7 +163,7 @@ class _SubscriptionToggleState extends State<SubscriptionToggle> {
const borderPadding = 2.5;
const spaceBetweenButtons = 4.0;
final textTheme = getEnteTextTheme(context);
- final colorScheme = getEnteColorScheme(context);
+ final componentColors = context.componentColors;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 32),
child: LayoutBuilder(
@@ -174,7 +175,7 @@ class _SubscriptionToggleState extends State<SubscriptionToggle> {
2;
return Container(
decoration: BoxDecoration(
- color: colorScheme.fillBaseGrey,
+ color: componentColors.strokeFaint,
borderRadius: BorderRadius.circular(50),
),
padding: const EdgeInsets.symmetric(
@@ -197,7 +198,7 @@ class _SubscriptionToggleState extends State<SubscriptionToggle> {
child: Center(
child: Text(
AppLocalizations.of(context).yearly,
- style: textTheme.bodyFaint,
+ style: textTheme.bodyMuted,
),
),
),
@@ -214,7 +215,7 @@ class _SubscriptionToggleState extends State<SubscriptionToggle> {
child: Center(
child: Text(
AppLocalizations.of(context).monthly,
- style: textTheme.bodyFaint,
+ style: textTheme.bodyMuted,
),
),
),
@@ -229,7 +230,7 @@ class _SubscriptionToggleState extends State<SubscriptionToggle> {
padding: const EdgeInsets.symmetric(vertical: 8),
width: widthOfButton,
decoration: BoxDecoration(
- color: colorScheme.backgroundColour,
+ color: componentColors.fillLight,
borderRadius: BorderRadius.circular(50),
),
child: AnimatedSwitcher(
@@ -241,7 +242,7 @@ class _SubscriptionToggleState extends State<SubscriptionToggle> {
_isYearly
? AppLocalizations.of(context).yearly
: AppLocalizations.of(context).monthly,
- style: textTheme.body,
+ style: textTheme.bodyMuted,
),
),
),
diff --git a/mobile/apps/photos/test/ui/payment/subscription_toggle_test.dart b/mobile/apps/photos/test/ui/payment/subscription_toggle_test.dart
index 676953812e..1d545273cf 100644
--- a/mobile/apps/photos/test/ui/payment/subscription_toggle_test.dart
+++ b/mobile/apps/photos/test/ui/payment/subscription_toggle_test.dart
@@ -1,7 +1,10 @@
+import "package:ente_components/theme/colors.dart" show ComponentApp;
+import "package:ente_components/theme/theme.dart" show ComponentTheme;
import "package:flutter/material.dart";
import "package:flutter_test/flutter_test.dart";
import "package:photos/ente_theme_data.dart";
import "package:photos/generated/intl/app_localizations.dart";
+import "package:photos/theme/text_style.dart" as ente_text;
import "package:photos/ui/payment/subscription_common_widgets.dart";
void main() {
@@ -40,12 +43,54 @@ void main() {
);
expect(togglePosition.left, 0);
});
+
+ testWidgets("uses readable inactive text color in light theme", (
+ tester,
+ ) async {
+ await tester.pumpWidget(
+ _buildTestApp(
+ const SubscriptionToggle(isYearly: true, onToggle: _noopToggle),
+ theme: lightThemeData,
+ ),
+ );
+
+ final monthlyLabel = tester.widget<Text>(find.text("Monthly"));
+ expect(
+ monthlyLabel.style?.color,
+ ente_text.lightTextTheme.bodyMuted.color,
+ );
+ });
+
+ testWidgets("uses Figma selected pill color in light theme", (
+ tester,
+ ) async {
+ await tester.pumpWidget(
+ _buildTestApp(
+ const SubscriptionToggle(isYearly: true, onToggle: _noopToggle),
+ theme: lightThemeData,
+ ),
+ );
+
+ final selectedPill = tester.widget<Container>(
+ find
+ .ancestor(
+ of: find.text("Yearly").last,
+ matching: find.byType(Container),
+ )
+ .first,
+ );
+ final decoration = selectedPill.decoration! as BoxDecoration;
+ expect(
+ decoration.color,
+ ComponentTheme.colorsForApp(ComponentApp.photos).fillLight,
+ );
+ });
});
}
-Widget _buildTestApp(Widget child) {
+Widget _buildTestApp(Widget child, {ThemeData? theme}) {
return MaterialApp(
- theme: darkThemeData,
+ theme: theme ?? darkThemeData,
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: Scaffold(body: SizedBox(width: 320, child: child)),