Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Restyle plan selection for onboarding

r4khul11df0ee0fcda
diff --git a/mobile/apps/photos/changes/onboarding-auth-screens.md b/mobile/apps/photos/changes/onboarding-auth-screens.md
index 03ad5852fd..d26a2a9ed3 100644
--- a/mobile/apps/photos/changes/onboarding-auth-screens.md
+++ b/mobile/apps/photos/changes/onboarding-auth-screens.md
@@ -1 +1 @@
-- Polished sign-up and login screens with clearer titles, explicit terms acceptance, and improved verification actions.
+- Redesigned the sign-up, login, verification, recovery and plan selection screens with the new illustrated layout, clearer validation messages, and a code field that resets after an incorrect code.
diff --git a/mobile/apps/photos/lib/ui/payment/billing_questions_widget.dart b/mobile/apps/photos/lib/ui/payment/billing_questions_widget.dart
index fcaa16a2ed..9ba07d3c81 100644
--- a/mobile/apps/photos/lib/ui/payment/billing_questions_widget.dart
+++ b/mobile/apps/photos/lib/ui/payment/billing_questions_widget.dart
@@ -1,92 +1,135 @@
import 'dart:convert';
+import 'package:ente_components/ente_components.dart';
import 'package:ente_ui/components/loading_widget.dart';
import 'package:flutter/material.dart';
+import 'package:hugeicons/hugeicons.dart';
import 'package:photos/core/network/network.dart';
-import 'package:photos/ente_theme_data.dart';
-class BillingQuestionsWidget extends StatelessWidget {
+// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=25356-307595&m=dev
+class BillingQuestionsWidget extends StatefulWidget {
const BillingQuestionsWidget({super.key});
+ @override
+ State<BillingQuestionsWidget> createState() => _BillingQuestionsWidgetState();
+}
+
+class _BillingQuestionsWidgetState extends State<BillingQuestionsWidget> {
+ late final Future<List<FaqItem>> _faqs = _loadFaqs();
+
+ Future<List<FaqItem>> _loadFaqs() async {
+ final response = await NetworkClient.instance.getDio().get(
+ "https://static.ente.com/faq.json",
+ );
+ final faqItems = <FaqItem>[];
+ if (response.data is List) {
+ for (final item in response.data as List) {
+ if (item is Map<String, dynamic>) {
+ faqItems.add(FaqItem.fromMap(item));
+ }
+ }
+ }
+ return faqItems;
+ }
+
@override
Widget build(BuildContext context) {
- return FutureBuilder(
- future: NetworkClient.instance
- .getDio()
- .get("https://static.ente.com/faq.json")
- .then((response) {
- final faqItems = <FaqItem>[];
- if (response.data is List) {
- for (final item in response.data as List) {
- if (item is Map<String, dynamic>) {
- faqItems.add(FaqItem.fromMap(item));
- }
- }
- }
- return faqItems;
- }),
- builder: (BuildContext context, AsyncSnapshot snapshot) {
- if (snapshot.hasData) {
- final faqs = <Widget>[];
- faqs.add(
- const Padding(
- padding: EdgeInsets.all(24),
- child: Text(
- "FAQs",
- style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
- ),
- ),
- );
- for (final faq in snapshot.data as List<FaqItem>) {
- faqs.add(FaqWidget(faq: faq));
- }
- faqs.add(const Padding(padding: EdgeInsets.all(16)));
- return SingleChildScrollView(child: Column(children: faqs));
- } else {
+ return FutureBuilder<List<FaqItem>>(
+ future: _faqs,
+ builder: (BuildContext context, AsyncSnapshot<List<FaqItem>> snapshot) {
+ final faqs = snapshot.data;
+ if (faqs == null) {
return const EnteLoadingWidget();
}
+ return Column(
+ children: [
+ for (var i = 0; i < faqs.length; i++) ...[
+ if (i > 0) const SizedBox(height: Spacing.sm),
+ FaqWidget(faq: faqs[i]),
+ ],
+ ],
+ );
},
);
}
}
-class FaqWidget extends StatelessWidget {
+// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=7471-2992&m=dev
+class FaqWidget extends StatefulWidget {
const FaqWidget({super.key, required this.faq});
final FaqItem faq;
@override
- Widget build(BuildContext context) {
- final theme = Theme.of(context);
- final expandedColor = theme.colorScheme.greenAlternative;
- const shape = RoundedRectangleBorder(
- borderRadius: BorderRadius.all(Radius.circular(8)),
- );
+ State<FaqWidget> createState() => _FaqWidgetState();
+}
- final question = faq.q ?? '';
- final answer = faq.a ?? '';
-
- return Padding(
- padding: const EdgeInsets.all(2),
- child: ExpansionTile(
- key: PageStorageKey(question),
- clipBehavior: Clip.antiAlias,
- title: Text(question),
- tilePadding: const EdgeInsets.symmetric(horizontal: 18),
- textColor: expandedColor,
- collapsedTextColor: theme.textTheme.titleMedium?.color,
- iconColor: expandedColor,
- collapsedIconColor: theme.unselectedWidgetColor,
- backgroundColor: theme.cardColor,
- collapsedBackgroundColor: theme.cardColor,
- shape: shape,
- collapsedShape: shape,
- children: [
- Padding(
- padding: const EdgeInsets.only(left: 16, right: 16, bottom: 12),
- child: Text(answer, style: const TextStyle(height: 1.5)),
- ),
- ],
+class _FaqWidgetState extends State<FaqWidget> {
+ bool _isExpanded = false;
+
+ @override
+ Widget build(BuildContext context) {
+ final colors = context.componentColors;
+ return Material(
+ color: colors.fillLight,
+ borderRadius: BorderRadius.circular(Radii.button),
+ clipBehavior: Clip.antiAlias,
+ child: InkWell(
+ onTap: () => setState(() => _isExpanded = !_isExpanded),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ Spacing.xl,
+ Spacing.lg,
+ Spacing.xl,
+ Spacing.md,
+ ),
+ child: Row(
+ children: [
+ Expanded(
+ child: Text(
+ widget.faq.q ?? '',
+ style: TextStyles.bodyBold.copyWith(
+ color: colors.textBase,
+ ),
+ ),
+ ),
+ const SizedBox(width: Spacing.sm),
+ HugeIcon(
+ icon: _isExpanded
+ ? HugeIcons.strokeRoundedArrowUp01
+ : HugeIcons.strokeRoundedArrowDown01,
+ size: IconSizes.small,
+ color: colors.textBase,
+ ),
+ ],
+ ),
+ ),
+ AnimatedSize(
+ duration: Motion.standard,
+ curve: Curves.easeInOutCubic,
+ alignment: Alignment.topCenter,
+ child: _isExpanded
+ ? Padding(
+ padding: const EdgeInsets.fromLTRB(
+ Spacing.xl,
+ 0,
+ Spacing.xl,
+ Spacing.lg,
+ ),
+ child: Text(
+ widget.faq.a ?? '',
+ style: TextStyles.mini.copyWith(
+ color: colors.textLight,
+ ),
+ ),
+ )
+ : const SizedBox(width: double.infinity),
+ ),
+ ],
+ ),
),
);
}
diff --git a/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart b/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart
index 5bb762bfbc..f6a84d14ba 100644
--- a/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart
+++ b/mobile/apps/photos/lib/ui/payment/store_subscription_page.dart
@@ -1,11 +1,13 @@
import 'dart:async';
import 'dart:io';
+import "package:ente_components/ente_components.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:ente_strings/ente_strings.dart";
import 'package:ente_ui/components/loading_widget.dart';
import "package:flutter/foundation.dart";
import 'package:flutter/material.dart';
+import "package:hugeicons/hugeicons.dart";
import 'package:in_app_purchase/in_app_purchase.dart';
import 'package:logging/logging.dart';
import "package:photos/core/constants.dart";
@@ -19,9 +21,9 @@ import "package:photos/service_locator.dart";
import 'package:photos/services/account/user_service.dart';
import "package:photos/theme/colors.dart";
import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/account/onboarding_page_scaffold.dart";
import 'package:photos/ui/common/progress_dialog.dart';
import 'package:photos/ui/components/buttons/button_widget.dart';
-import 'package:photos/ui/components/buttons/button_widget_v2.dart';
import 'package:photos/ui/components/dialog_widget.dart';
import "package:photos/ui/components/menu_item_widget/menu_item_widget_new.dart";
import 'package:photos/ui/components/models/button_type.dart';
@@ -55,6 +57,8 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
bool _hideCurrentPlanSelection = false;
late FreePlan _freePlan;
late List<BillingPlan> _plans;
+ List<BillingPlan> _allPlans = [];
+ final _scaffoldKey = GlobalKey<OnboardingPageScaffoldState>();
bool _hasLoadedData = false;
bool _isLoading = false;
late bool _isActiveStripeSubscriber;
@@ -204,6 +208,9 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
context.strings.pleaseWait,
isDismissible: true,
);
+ if (widget.isOnboarding) {
+ return _buildOnboardingPage();
+ }
return Scaffold(
backgroundColor: colorScheme.backgroundColour,
appBar: AppBar(
@@ -217,9 +224,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
},
),
title: Text(
- widget.isOnboarding
- ? context.strings.chooseYourPlan
- : "${context.strings.subscription}${kDebugMode ? ' Store' : ''}",
+ "${context.strings.subscription}${kDebugMode ? ' Store' : ''}",
style: textTheme.largeBold,
),
centerTitle: true,
@@ -228,28 +233,85 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [Expanded(child: _getBody())],
),
- bottomNavigationBar: widget.isOnboarding && _hasLoadedData
- ? Container(
- color: colorScheme.backgroundColour,
- child: SafeArea(
- top: false,
- child: Padding(
- padding: const EdgeInsets.fromLTRB(24, 12, 24, 12),
- child: ButtonWidgetV2(
- buttonType: ButtonTypeV2.primary,
- labelText: context.strings.continueLabel,
- isDisabled: _selectedProductID == null,
- onTap: _selectedProductID == null
- ? null
- : _onOnboardingContinueTap,
- ),
- ),
- ),
- )
- : null,
);
}
+ // Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=25356-307413&m=dev
+ Widget _buildOnboardingPage() {
+ final colors = context.componentColors;
+ return OnboardingPageScaffold(
+ key: _scaffoldKey,
+ title: context.strings.chooseYourPlan,
+ illustration: OnboardingIllustration.pricing,
+ headerHeight: OnboardingPageScaffold.planHeaderHeight,
+ titleBarStyle: OnboardingTitleBarStyle.header,
+ headerTrailing: IconButtonComponent(
+ variant: IconButtonComponentVariant.unfilled,
+ size: 48,
+ iconSize: IconSizes.medium,
+ icon: HugeIcon(
+ icon: HugeIcons.strokeRoundedHelpCircle,
+ color: colors.specialWhite,
+ ),
+ tooltip: context.strings.faqs,
+ onTap: () => showPlanFaqSheet(context),
+ ),
+ isBodyCentered: !_hasLoadedData,
+ pinActions: true,
+ body: _hasLoadedData
+ ? _buildOnboardingPlans()
+ : const EnteLoadingWidget(),
+ actions: [
+ if (_hasLoadedData)
+ ButtonComponent(
+ label: context.strings.continueLabel,
+ shouldShowSuccessState: false,
+ isDisabled: _selectedProductID == null,
+ onTap: _selectedProductID == null ? null : _onOnboardingContinueTap,
+ ),
+ ],
+ );
+ }
+
+ Widget _buildOnboardingPlans() {
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ if (hasYearlyPlans) ...[
+ SubscriptionToggle(
+ isYearly: showYearlyPlan,
+ onToggle: _onToggleBillingPeriod,
+ ),
+ const SizedBox(height: Spacing.lg),
+ ],
+ SubscriptionPlanList(
+ children: _isActiveStripeSubscriber
+ ? _getStripePlanWidgets()
+ : _getMobilePlanWidgets(),
+ ),
+ const SizedBox(height: Spacing.lg),
+ const SubFaqWidget(),
+ ],
+ );
+ }
+
+ void _onToggleBillingPeriod(bool isYearly) {
+ showYearlyPlan = isYearly;
+ _scaffoldKey.currentState?.trigger(isYearly ? "yearly" : "monthly");
+ _filterStorePlansForUi();
+ }
+
+ String? _monthlyPriceFor(BillingPlan plan) {
+ if (plan.period != 'year') {
+ return null;
+ }
+ return _allPlans
+ .where((p) => p.period == 'month' && p.storage == plan.storage)
+ .map((p) => p.price)
+ .firstOrNull;
+ }
+
bool _isFreePlanUser() {
return _currentSubscription != null &&
freeProductID == _currentSubscription!.productID;
@@ -285,6 +347,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
_currentSubscription?.attributes?.isCancelled ?? false;
showYearlyPlan = _currentSubscription!.isYearlyPlan();
final billingPlans = await _billingService.getBillingPlans();
+ _allPlans = billingPlans.plans;
_isActiveStripeSubscriber =
_currentSubscription!.paymentProvider == stripe &&
_currentSubscription!.isValid();
@@ -330,24 +393,26 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
if (hasYearlyPlans) {
widgets.add(
- SubscriptionToggle(
- isYearly: showYearlyPlan,
- onToggle: (p0) {
- showYearlyPlan = p0;
- _filterStorePlansForUi();
- },
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 32),
+ child: SubscriptionToggle(
+ isYearly: showYearlyPlan,
+ onToggle: _onToggleBillingPeriod,
+ ),
),
);
}
- widgets.addAll([
- Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: _isActiveStripeSubscriber
- ? _getStripePlanWidgets()
- : _getMobilePlanWidgets(),
+ widgets.add(
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 24),
+ child: SubscriptionPlanList(
+ children: _isActiveStripeSubscriber
+ ? _getStripePlanWidgets()
+ : _getMobilePlanWidgets(),
+ ),
),
- ]);
+ );
if (_currentSubscription != null) {
widgets.add(
@@ -393,7 +458,12 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
}
}
- widgets.add(SubFaqWidget(isOnboarding: widget.isOnboarding));
+ widgets.add(
+ const Padding(
+ padding: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
+ child: SubFaqWidget(),
+ ),
+ );
if (!widget.isOnboarding) {
widgets.add(
@@ -480,6 +550,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
Future<void> _filterStorePlansForUi() async {
final billingPlans = await _billingService.getBillingPlans();
+ _allPlans = billingPlans.plans;
_freePlan = billingPlans.freePlan;
_plans = billingPlans.plans.where((plan) {
final productID = _isActiveStripeSubscriber
@@ -536,7 +607,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
? _selectedProductID == productID
: isActive && !_hideCurrentPlanSelection,
isPopular: _isPopularPlan(plan),
- isOnboarding: widget.isOnboarding,
+ monthlyPrice: _monthlyPriceFor(plan),
),
),
);
@@ -564,7 +635,6 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
isActive: widget.isOnboarding
? _selectedProductID == freeProductID
: _isFreePlanUser(),
- isOnboarding: widget.isOnboarding,
),
),
);
@@ -650,7 +720,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
? _selectedProductID == productID
: isActive,
isPopular: _isPopularPlan(plan),
- isOnboarding: widget.isOnboarding,
+ monthlyPrice: _monthlyPriceFor(plan),
),
),
);
@@ -659,7 +729,7 @@ class _StoreSubscriptionPageState extends State<StoreSubscriptionPage> {
}
bool _isPopularPlan(BillingPlan plan) {
- return popularProductIDs.contains(plan.id);
+ return popularProductIDs.any((id) => plan.id.startsWith(id));
}
String _getPlanProductID(BillingPlan plan) {
diff --git a/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart b/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart
index c0c650c3f4..e4ad931b34 100644
--- a/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart
+++ b/mobile/apps/photos/lib/ui/payment/stripe_subscription_page.dart
@@ -1,9 +1,11 @@
import 'dart:async';
+import "package:ente_components/ente_components.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:ente_strings/ente_strings.dart";
import 'package:ente_ui/components/loading_widget.dart';
import 'package:flutter/material.dart';
+import "package:hugeicons/hugeicons.dart";
import "package:logging/logging.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/events/subscription_purchased_event.dart";
@@ -14,10 +16,10 @@ import "package:photos/service_locator.dart";
import 'package:photos/services/account/user_service.dart';
import "package:photos/theme/colors.dart";
import 'package:photos/theme/ente_theme.dart';
+import "package:photos/ui/account/onboarding_page_scaffold.dart";
import 'package:photos/ui/common/progress_dialog.dart';
import 'package:photos/ui/common/web_page.dart';
import 'package:photos/ui/components/buttons/button_widget.dart';
-import 'package:photos/ui/components/buttons/button_widget_v2.dart';
import "package:photos/ui/components/menu_item_widget/menu_item_widget_new.dart";
import 'package:photos/ui/family/family_plan_page.dart';
import 'package:photos/ui/notification/toast.dart';
@@ -48,6 +50,8 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
bool _hideCurrentPlanSelection = false;
late FreePlan _freePlan;
List<BillingPlan> _plans = [];
+ List<BillingPlan> _allPlans = [];
+ final _scaffoldKey = GlobalKey<OnboardingPageScaffoldState>();
bool _hasLoadedData = false;
bool _isLoading = false;
bool _isStripeSubscriber = false;
@@ -98,6 +102,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
Future<void> _filterStripeForUI() async {
final billingPlans = await _billingService.getBillingPlans();
+ _allPlans = billingPlans.plans;
_freePlan = billingPlans.freePlan;
_plans = billingPlans.plans.where((plan) {
if (plan.id == freeProductID || plan.stripeID.isEmpty) {
@@ -135,6 +140,14 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
Widget build(BuildContext context) {
colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
+ if (!_isLoading) {
+ _isLoading = true;
+ _dialog = createProgressDialog(context, context.strings.pleaseWait);
+ _fetchSub();
+ }
+ if (widget.isOnboarding) {
+ return _buildOnboardingPage();
+ }
return Scaffold(
backgroundColor: colorScheme.backgroundColour,
@@ -148,71 +161,114 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
Navigator.of(context).pop();
},
),
- title: Text(
- widget.isOnboarding
- ? context.strings.chooseYourPlan
- : context.strings.subscription,
- style: textTheme.largeBold,
- ),
+ title: Text(context.strings.subscription, style: textTheme.largeBold),
centerTitle: true,
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [Expanded(child: _getBody())],
),
- bottomNavigationBar: widget.isOnboarding && _hasLoadedData
- ? Container(
- color: colorScheme.backgroundColour,
- child: SafeArea(
- top: false,
- child: Padding(
- padding: const EdgeInsets.fromLTRB(24, 12, 24, 12),
- child: ButtonWidgetV2(
- buttonType: ButtonTypeV2.primary,
- labelText: context.strings.continueLabel,
- isDisabled: _selectedPlanProductID == null,
- onTap: _selectedPlanProductID == null
- ? null
- : _onOnboardingContinueTap,
- ),
- ),
- ),
- )
- : null,
);
}
Widget _getBody() {
- if (!_isLoading) {
- _isLoading = true;
- _dialog = createProgressDialog(context, context.strings.pleaseWait);
- _fetchSub();
- }
if (_hasLoadedData) {
return _buildPlans();
}
return const EnteLoadingWidget();
}
+ // Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=25356-307413&m=dev
+ Widget _buildOnboardingPage() {
+ final colors = context.componentColors;
+ return OnboardingPageScaffold(
+ key: _scaffoldKey,
+ title: context.strings.chooseYourPlan,
+ illustration: OnboardingIllustration.pricing,
+ headerHeight: OnboardingPageScaffold.planHeaderHeight,
+ titleBarStyle: OnboardingTitleBarStyle.header,
+ headerTrailing: IconButtonComponent(
+ variant: IconButtonComponentVariant.unfilled,
+ size: 48,
+ iconSize: IconSizes.medium,
+ icon: HugeIcon(
+ icon: HugeIcons.strokeRoundedHelpCircle,
+ color: colors.specialWhite,
+ ),
+ tooltip: context.strings.faqs,
+ onTap: () => showPlanFaqSheet(context),
+ ),
+ isBodyCentered: !_hasLoadedData,
+ pinActions: true,
+ body: _hasLoadedData
+ ? _buildOnboardingPlans()
+ : const EnteLoadingWidget(),
+ actions: [
+ if (_hasLoadedData)
+ ButtonComponent(
+ label: context.strings.continueLabel,
+ shouldShowSuccessState: false,
+ isDisabled: _selectedPlanProductID == null,
+ onTap: _selectedPlanProductID == null
+ ? null
+ : _onOnboardingContinueTap,
+ ),
+ ],
+ );
+ }
+
+ Widget _buildOnboardingPlans() {
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ SubscriptionToggle(
+ isYearly: _showYearlyPlan,
+ onToggle: _onToggleBillingPeriod,
+ ),
+ const SizedBox(height: Spacing.lg),
+ SubscriptionPlanList(children: _getStripePlanWidgets()),
+ const SizedBox(height: Spacing.lg),
+ const SubFaqWidget(),
+ ],
+ );
+ }
+
+ void _onToggleBillingPeriod(bool isYearly) {
+ _showYearlyPlan = isYearly;
+ _scaffoldKey.currentState?.trigger(isYearly ? "yearly" : "monthly");
+ _filterStripeForUI();
+ }
+
+ String? _monthlyPriceFor(BillingPlan plan) {
+ if (plan.period != 'year') {
+ return null;
+ }
+ return _allPlans
+ .where((p) => p.period == 'month' && p.storage == plan.storage)
+ .map((p) => p.price)
+ .firstOrNull;
+ }
+
Widget _buildPlans() {
final widgets = <Widget>[];
widgets.add(
- SubscriptionToggle(
- isYearly: _showYearlyPlan,
- onToggle: (p0) {
- _showYearlyPlan = p0;
- _filterStripeForUI();
- },
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 32),
+ child: SubscriptionToggle(
+ isYearly: _showYearlyPlan,
+ onToggle: _onToggleBillingPeriod,
+ ),
),
);
- widgets.addAll([
- Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: _getStripePlanWidgets(),
+ widgets.add(
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 24),
+ child: SubscriptionPlanList(children: _getStripePlanWidgets()),
),
- ]);
+ );
final hasAddOnBonus =
_userDetails.bonusData?.getAddOnBonuses().isNotEmpty ?? false;
@@ -230,7 +286,12 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
}
if (_currentSubscription!.productID == freeProductID) {
- widgets.add(SubFaqWidget(isOnboarding: widget.isOnboarding));
+ widgets.add(
+ const Padding(
+ padding: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
+ child: SubFaqWidget(),
+ ),
+ );
if (!widget.isOnboarding) {
widgets.add(const SizedBox(height: 8));
}
@@ -478,7 +539,6 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
isActive: widget.isOnboarding
? _selectedPlanProductID == freeProductID
: _isFreePlanUser(),
- isOnboarding: widget.isOnboarding,
),
),
);
@@ -568,7 +628,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
? _selectedPlanProductID == productID
: isActive && !_hideCurrentPlanSelection,
isPopular: _isPopularPlan(plan),
- isOnboarding: widget.isOnboarding,
+ monthlyPrice: _monthlyPriceFor(plan),
),
),
);
@@ -577,7 +637,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
}
bool _isPopularPlan(BillingPlan plan) {
- return popularProductIDs.contains(plan.id);
+ return popularProductIDs.any((id) => plan.id.startsWith(id));
}
bool _isFreePlanUser() {
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 42c9ce431e..6cbf44ba97 100644
--- a/mobile/apps/photos/lib/ui/payment/subscription_common_widgets.dart
+++ b/mobile/apps/photos/lib/ui/payment/subscription_common_widgets.dart
@@ -1,13 +1,12 @@
-import "package:ente_components/theme/theme.dart";
+import "package:ente_components/ente_components.dart";
import 'package:ente_pure_utils/ente_pure_utils.dart';
import "package:ente_strings/ente_strings.dart";
import 'package:flutter/material.dart';
+import "package:hugeicons/hugeicons.dart";
import "package:intl/intl.dart";
-import 'package:photos/ente_theme_data.dart';
import 'package:photos/gateways/billing/models/subscription.dart';
import "package:photos/gateways/storage_bonus/models/bonus.dart";
import "package:photos/theme/ente_theme.dart";
-import "package:photos/ui/components/menu_item_widget/menu_item_widget_new.dart";
import 'package:photos/ui/payment/billing_questions_widget.dart';
class ValidityWidget extends StatelessWidget {
@@ -93,44 +92,67 @@ class AddOnBonusValidity extends StatelessWidget {
}
}
+// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=25356-307413&m=dev
class SubFaqWidget extends StatelessWidget {
- final bool isOnboarding;
-
- const SubFaqWidget({super.key, this.isOnboarding = false});
+ const SubFaqWidget({super.key});
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- return Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
- child: MenuItemWidgetNew(
- title: context.strings.faqs,
- menuItemColor: colorScheme.fillFaint,
- pressedColor: colorScheme.fillFaintPressed,
- trailingWidget: Icon(
- Icons.chevron_right_outlined,
- color: colorScheme.strokeBase,
+ final colors = context.componentColors;
+ return MenuGroupComponent(
+ items: [
+ MenuComponent(
+ title: context.strings.faqs,
+ leading: HugeIcon(
+ icon: HugeIcons.strokeRoundedHelpCircle,
+ size: IconSizes.small,
+ color: colors.textBase,
+ ),
+ trailing: HugeIcon(
+ icon: HugeIcons.strokeRoundedArrowRight01,
+ size: IconSizes.small,
+ color: colors.textBase,
+ ),
+ onTap: () => showPlanFaqSheet(context),
),
- onTap: () async {
- // ignore: unawaited_futures
- showModalBottomSheet<void>(
- backgroundColor: Theme.of(context).colorScheme.bgColorForQuestions,
- barrierColor: Colors.black87,
- context: context,
- shape: const RoundedRectangleBorder(
- borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
- ),
- clipBehavior: Clip.antiAlias,
- builder: (context) {
- return const SafeArea(child: BillingQuestionsWidget());
- },
- );
- },
- ),
+ ],
+ );
+ }
+}
+
+// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=25356-307595&m=dev
+Future<void> showPlanFaqSheet(BuildContext context) {
+ return showBottomSheetComponent<void>(
+ context: context,
+ builder: (_) => BottomSheetComponent(
+ title: context.strings.faqs,
+ isScrollable: true,
+ initialChildSize: 0.6,
+ content: const BillingQuestionsWidget(),
+ ),
+ );
+}
+
+class SubscriptionPlanList extends StatelessWidget {
+ const SubscriptionPlanList({super.key, required this.children});
+
+ final List<Widget> children;
+
+ @override
+ Widget build(BuildContext context) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ for (var i = 0; i < children.length; i++) ...[
+ if (i > 0) const SizedBox(height: Spacing.sm),
+ children[i],
+ ],
+ ],
);
}
}
+// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=25356-307503&m=dev
class SubscriptionToggle extends StatefulWidget {
final bool isYearly;
final Function(bool) onToggle;
@@ -145,6 +167,10 @@ class SubscriptionToggle extends StatefulWidget {
}
class _SubscriptionToggleState extends State<SubscriptionToggle> {
+ static const double _padding = Spacing.xs;
+ static const double _segmentHeight = 41;
+ static const double _radius = 35;
+
late bool _isYearly;
@override
@@ -163,102 +189,60 @@ class _SubscriptionToggleState extends State<SubscriptionToggle> {
@override
Widget build(BuildContext context) {
- const borderPadding = 2.5;
- const spaceBetweenButtons = 4.0;
- final textTheme = getEnteTextTheme(context);
- final componentColors = context.componentColors;
- return Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 32),
- child: LayoutBuilder(
- builder: (context, constrains) {
- final widthOfButton =
- (constrains.maxWidth -
- (borderPadding * 2) -
- spaceBetweenButtons) /
- 2;
- return Container(
- decoration: BoxDecoration(
- color: componentColors.strokeFaint,
- borderRadius: BorderRadius.circular(50),
- ),
- padding: const EdgeInsets.symmetric(
- vertical: borderPadding,
- horizontal: borderPadding,
- ),
- width: double.infinity,
- child: Stack(
- children: [
- Row(
- children: [
- GestureDetector(
- onTap: () {
- setIsYearly(true);
- },
- behavior: HitTestBehavior.opaque,
- child: Container(
- padding: const EdgeInsets.symmetric(vertical: 8),
- width: widthOfButton,
- child: Center(
- child: Text(
- context.strings.yearly,
- style: textTheme.bodyMuted,
- ),
- ),
- ),
- ),
- const SizedBox(width: spaceBetweenButtons),
- GestureDetector(
- onTap: () {
- setIsYearly(false);
- },
- behavior: HitTestBehavior.opaque,
- child: Container(
- padding: const EdgeInsets.symmetric(vertical: 8),
- width: widthOfButton,
- child: Center(
- child: Text(
- context.strings.monthly,
- style: textTheme.bodyMuted,
- ),
- ),
- ),
- ),
- ],
- ),
- AnimatedPositioned(
- duration: const Duration(milliseconds: 350),
- curve: Curves.easeInOutQuart,
- left: _isYearly ? 0 : widthOfButton + spaceBetweenButtons,
- child: Container(
- padding: const EdgeInsets.symmetric(vertical: 8),
- width: widthOfButton,
- decoration: BoxDecoration(
- color: componentColors.fillLight,
- borderRadius: BorderRadius.circular(50),
- ),
- child: AnimatedSwitcher(
- duration: const Duration(milliseconds: 350),
- switchInCurve: Curves.easeInOutExpo,
- switchOutCurve: Curves.easeInOutExpo,
- child: Text(
- key: ValueKey(_isYearly),
- _isYearly
- ? context.strings.yearly
- : context.strings.monthly,
- style: textTheme.body,
- ),
- ),
- ),
+ final colors = context.componentColors;
+ final labelStyle = TextStyles.body.copyWith(color: colors.textLight);
+ return Container(
+ height: _segmentHeight + _padding * 2,
+ padding: const EdgeInsets.all(_padding),
+ decoration: BoxDecoration(
+ color: colors.strokeFaint,
+ borderRadius: BorderRadius.circular(_radius),
+ ),
+ child: Stack(
+ children: [
+ AnimatedAlign(
+ duration: Motion.slow,
+ curve: Curves.easeInOutCubic,
+ alignment: _isYearly ? Alignment.centerLeft : Alignment.centerRight,
+ child: FractionallySizedBox(
+ widthFactor: 0.5,
+ heightFactor: 1,
+ child: DecoratedBox(
+ decoration: BoxDecoration(
+ color: colors.fillLight,
+ borderRadius: BorderRadius.circular(_radius),
),
- ],
+ ),
),
- );
- },
+ ),
+ Row(
+ children: [
+ _segment(context.strings.yearly, true, labelStyle),
+ _segment(context.strings.monthly, false, labelStyle),
+ ],
+ ),
+ ],
+ ),
+ );
+ }
+
+ Widget _segment(String label, bool isYearly, TextStyle style) {
+ return Expanded(
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () => setIsYearly(isYearly),
+ child: SizedBox(
+ height: _segmentHeight,
+ child: Center(
+ child: Text(label, style: style, textAlign: TextAlign.center),
+ ),
+ ),
),
);
}
void setIsYearly(bool isYearly) {
+ if (_isYearly == isYearly) return;
setState(() {
_isYearly = isYearly;
});
diff --git a/mobile/apps/photos/lib/ui/payment/subscription_plan_widget.dart b/mobile/apps/photos/lib/ui/payment/subscription_plan_widget.dart
index ffad64ff3e..59b83265f6 100644
--- a/mobile/apps/photos/lib/ui/payment/subscription_plan_widget.dart
+++ b/mobile/apps/photos/lib/ui/payment/subscription_plan_widget.dart
@@ -1,33 +1,47 @@
-import 'dart:math' as math;
+import "dart:math" as math;
-import 'package:ente_components/theme/text_styles.dart';
+import 'package:ente_components/ente_components.dart';
import 'package:ente_pure_utils/ente_pure_utils.dart';
import "package:ente_strings/ente_strings.dart";
import 'package:flutter/material.dart';
-import "package:photos/service_locator.dart";
-import "package:photos/theme/ente_theme.dart";
+// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=25356-307413&m=dev
class SubscriptionPlanWidget extends StatelessWidget {
const SubscriptionPlanWidget({
super.key,
required this.storage,
required this.price,
required this.period,
- required this.isOnboarding,
+ this.monthlyPrice,
this.isActive = false,
this.isPopular = false,
});
+ static const double height = 84;
+ static const double _borderWidth = 2;
+ static const double _horizontalPadding = Spacing.xl - _borderWidth;
+ static const double _verticalPadding = Spacing.lg - _borderWidth;
+ static const double _contentMinHeight =
+ height - 2 * _borderWidth - 2 * _verticalPadding;
+ static const double _badgeWidth = 102;
+ static const double _badgeHeight = 26;
+ static const double _badgeLineHeight = 20;
+ static const double _badgeVerticalPadding =
+ (_badgeHeight - _badgeLineHeight) / 2;
+
final int storage;
final String price;
final String period;
+
+ // Price of the monthly plan with the same storage, shown struck through
+ // next to the per-month cost of a yearly plan.
+ final String? monthlyPrice;
final bool isActive;
final bool isPopular;
- final bool isOnboarding;
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
+ final colors = context.componentColors;
final numAndUnit = convertBytesToNumberAndUnit(storage);
int storageValueInUnit = numAndUnit.$1;
String storageUnit = numAndUnit.$2.toUpperCase();
@@ -36,90 +50,99 @@ class SubscriptionPlanWidget extends StatelessWidget {
storageUnit = "GB";
}
final String storageValue = storageValueInUnit.toString();
- final bool isSelected = isActive;
+ final badgeHeight =
+ MediaQuery.textScalerOf(context).scale(_badgeLineHeight) +
+ 2 * _badgeVerticalPadding;
+ final badgeOverflow = isPopular
+ ? math.max(0.0, badgeHeight - _badgeHeight)
+ : 0.0;
- return Padding(
- padding: const EdgeInsets.only(left: 16, right: 16, bottom: 24),
+ return Container(
+ clipBehavior: Clip.antiAlias,
+ decoration: BoxDecoration(
+ color: colors.fillLight,
+ borderRadius: BorderRadius.circular(Radii.button),
+ border: Border.all(
+ color: isActive ? colors.primary : Colors.transparent,
+ width: _borderWidth,
+ ),
+ ),
child: Stack(
clipBehavior: Clip.none,
children: [
- Container(
- constraints: const BoxConstraints(minHeight: 72),
- decoration: BoxDecoration(
- color: isSelected ? colorScheme.greenLight : colorScheme.fill,
- borderRadius: BorderRadius.circular(20),
- border: isSelected
- ? Border.all(color: colorScheme.greenBase, width: 2)
- : null,
+ Padding(
+ padding: EdgeInsets.fromLTRB(
+ _horizontalPadding,
+ _verticalPadding + badgeOverflow,
+ _horizontalPadding,
+ _verticalPadding,
),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.center,
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(minHeight: _contentMinHeight),
+ child: Column(
+ mainAxisAlignment: isPopular
+ ? MainAxisAlignment.end
+ : MainAxisAlignment.center,
children: [
- Expanded(
- child: Align(
- alignment: Alignment.centerLeft,
- child: RichText(
- text: TextSpan(
- style: TextStyle(
- color: colorScheme.contentDarker,
- fontFamily: TextStyles.outfitFontFamily,
- package: TextStyles.fontPackage,
- fontWeight: FontWeight.w900,
- ),
- children: [
- TextSpan(
- text: storageValue,
- style: const TextStyle(
- fontSize: 36,
- height: 28 / 36,
- letterSpacing: -1.8,
- ),
- ),
- const TextSpan(
- text: " ",
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Expanded(
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: RichText(
+ text: TextSpan(
style: TextStyle(
- fontSize: 24,
- height: 28 / 24,
- letterSpacing: -0.96,
+ color: colors.textBase,
+ fontFamily: TextStyles.outfitFontFamily,
+ package: TextStyles.fontPackage,
+ fontWeight: FontWeight.w900,
),
+ children: [
+ TextSpan(
+ text: storageValue,
+ style: const TextStyle(
+ fontSize: 36,
+ height: 28 / 36,
+ letterSpacing: -1.8,
+ ),
+ ),
+ const TextSpan(
+ text: " ",
+ style: TextStyle(
+ fontSize: 24,
+ height: 28 / 24,
+ letterSpacing: -0.96,
+ ),
+ ),
+ TextSpan(
+ text: storageUnit,
+ style: const TextStyle(
+ fontSize: 16,
+ height: 28 / 16,
+ fontWeight: FontWeight.w700,
+ ),
+ ),
+ ],
),
- TextSpan(
- text: storageUnit.isEmpty
- ? ""
- : storageUnit.substring(0, 1),
- style: const TextStyle(
- fontSize: 16,
- height: 28 / 16,
- letterSpacing: -0.64,
- ),
- ),
- TextSpan(
- text: storageUnit.length > 1
- ? storageUnit.substring(1)
- : "",
- style: const TextStyle(
- fontSize: 16,
- height: 28 / 16,
- ),
+ textHeightBehavior: const TextHeightBehavior(
+ applyHeightToFirstAscent: false,
+ applyHeightToLastDescent: false,
),
- ],
+ ),
),
- textAlign: TextAlign.left,
- textHeightBehavior: const TextHeightBehavior(
- applyHeightToFirstAscent: false,
- applyHeightToLastDescent: false,
+ ),
+ Flexible(
+ child: Align(
+ alignment: Alignment.centerRight,
+ child: _Price(
+ price: price,
+ period: period,
+ monthlyPrice: monthlyPrice,
+ ),
),
),
- ),
- ),
- Flexible(
- child: Align(
- alignment: Alignment.centerRight,
- child: _Price(price: price, period: period),
- ),
+ ],
),
],
),
@@ -127,27 +150,33 @@ class SubscriptionPlanWidget extends StatelessWidget {
),
if (isPopular)
Positioned(
- right: -8,
- top: -4,
- child: Transform.rotate(
- angle: 8 * math.pi / 180,
- child: Container(
- decoration: BoxDecoration(
- color: colorScheme.greenBase,
- borderRadius: BorderRadius.circular(8),
- ),
- padding: const EdgeInsets.symmetric(
- horizontal: 8,
- vertical: 2,
+ left: -_borderWidth,
+ top: -_borderWidth,
+ child: Container(
+ constraints: const BoxConstraints(
+ minWidth: _badgeWidth,
+ minHeight: _badgeHeight,
+ ),
+ padding: const EdgeInsets.symmetric(
+ horizontal: Spacing.lg,
+ vertical: _badgeVerticalPadding,
+ ),
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ color: colors.primary,
+ borderRadius: const BorderRadius.only(
+ topLeft: Radius.circular(Radii.button),
+ bottomRight: Radius.circular(Radii.button),
),
- child: Text(
- "Most popular",
- textAlign: TextAlign.center,
- style: TextStyles.tiny.copyWith(
- color: Colors.white,
- fontFamily: TextStyles.outfitFontFamily,
- fontWeight: FontWeight.w700,
- ),
+ ),
+ child: Text(
+ context.strings.mostPopular,
+ textAlign: TextAlign.center,
+ style: TextStyles.tiny.copyWith(
+ color: colors.specialWhite,
+ fontFamily: TextStyles.outfitFontFamily,
+ fontWeight: FontWeight.w700,
+ height: _badgeLineHeight / 10,
),
),
),
@@ -159,114 +188,94 @@ class SubscriptionPlanWidget extends StatelessWidget {
}
class _Price extends StatelessWidget {
+ const _Price({
+ required this.price,
+ required this.period,
+ required this.monthlyPrice,
+ });
+
final String price;
final String period;
-
- const _Price({required this.price, required this.period});
+ final String? monthlyPrice;
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
+ final amountStyle = TextStyles.large.copyWith(
+ color: colors.textBase,
+ height: 28 / 16,
+ );
+ final periodStyle = TextStyles.mini.copyWith(
+ color: colors.textLight,
+ height: 28 / 12,
+ );
if (price.isEmpty) {
- return Text(
- "Free",
- style: textTheme.bodyBold.copyWith(
- color: colorScheme.contentDarker,
- fontFamily: "Inter",
- fontSize: 16,
- height: 28 / 16,
- ),
- );
+ return Text(context.strings.free, style: amountStyle);
}
if (period == "month") {
return Text.rich(
TextSpan(
- style: textTheme.largeBold.copyWith(
- color: colorScheme.contentDarker,
- height: 1.1,
- ),
children: [
- TextSpan(text: price),
- TextSpan(
- text: "/${context.strings.month}",
- style: textTheme.small.copyWith(color: colorScheme.contentLight),
- ),
+ TextSpan(text: price, style: amountStyle),
+ TextSpan(text: "/${context.strings.month}", style: periodStyle),
],
),
textAlign: TextAlign.end,
);
}
- if (period == "year") {
- final currencySymbol = price[0];
- final priceWithoutCurrency = price.substring(1);
- final priceDouble = double.parse(priceWithoutCurrency);
- final pricePerMonth = priceDouble / 12;
- String pricePerMonthString = pricePerMonth.toStringAsFixed(2);
-
- if (pricePerMonthString.endsWith(".00")) {
- pricePerMonthString = pricePerMonthString.substring(
- 0,
- pricePerMonthString.length - 3,
- );
- }
-
- final bool isPlayStore = updateService.isPlayStoreFlavor();
- return Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- if (isPlayStore)
- Text.rich(
- TextSpan(
- style: textTheme.largeBold.copyWith(
- color: colorScheme.contentDarker,
- height: 1.1,
- ),
- children: [
- TextSpan(text: price),
- TextSpan(
- text: "/${context.strings.yearShort}",
- style: textTheme.small.copyWith(
- color: colorScheme.contentLight,
- ),
+ assert(period == "year", "Invalid period: $period");
+ final currencySymbol = price[0];
+ final pricePerMonth = double.parse(price.substring(1)) / 12;
+ String pricePerMonthString = pricePerMonth.toStringAsFixed(2);
+ if (pricePerMonthString.endsWith(".00")) {
+ pricePerMonthString = pricePerMonthString.substring(
+ 0,
+ pricePerMonthString.length - 3,
+ );
+ }
+ final perMonthStyle = TextStyles.tiny.copyWith(
+ color: colors.textLight,
+ height: 16 / 10,
+ );
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.end,
+ children: [
+ Text.rich(
+ TextSpan(
+ children: [
+ TextSpan(text: price, style: amountStyle),
+ TextSpan(text: "/${context.strings.year}", style: periodStyle),
+ ],
+ ),
+ textAlign: TextAlign.end,
+ ),
+ Text.rich(
+ TextSpan(
+ children: [
+ if (monthlyPrice != null) ...[
+ TextSpan(
+ text: monthlyPrice,
+ style: perMonthStyle.copyWith(
+ decoration: TextDecoration.lineThrough,
+ decorationColor: colors.textLight,
),
- ],
- ),
- textAlign: TextAlign.end,
- ),
- if (isPlayStore)
- Text(
- "$currencySymbol$pricePerMonthString / ${context.strings.month}",
- style: textTheme.tiny.copyWith(color: colorScheme.contentLight),
- textAlign: TextAlign.end,
- ),
- if (!isPlayStore)
- Text(
- "$currencySymbol$pricePerMonthString / ${context.strings.month}",
- style: textTheme.largeBold.copyWith(
- color: colorScheme.contentDarker,
- ),
- textAlign: TextAlign.end,
- ),
- if (!isPlayStore)
- Text.rich(
+ ),
+ const TextSpan(text: " β†’ "),
+ ],
TextSpan(
- style: textTheme.tiny.copyWith(color: colorScheme.contentLight),
- children: [
- TextSpan(text: price),
- TextSpan(text: "/${context.strings.yearShort}"),
- ],
+ text:
+ "$currencySymbol$pricePerMonthString"
+ "/${context.strings.month}",
),
- textAlign: TextAlign.end,
- ),
- ],
- );
- } else {
- assert(false, "Invalid period: $period");
- return const Text("");
- }
+ ],
+ style: perMonthStyle,
+ ),
+ textAlign: TextAlign.end,
+ ),
+ ],
+ );
}
}
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 3bdf9bb946..750ee4b970 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,7 @@
+import "package:ente_strings/ente_strings.dart";
import "package:flutter/material.dart";
import "package:flutter_test/flutter_test.dart";
import "package:photos/ente_theme_data.dart";
-import "package:ente_strings/ente_strings.dart";
import "package:photos/ui/payment/subscription_common_widgets.dart";
void main() {
@@ -22,10 +22,10 @@ void main() {
);
await tester.pumpAndSettle();
- final togglePosition = tester.widget<AnimatedPositioned>(
- find.byType(AnimatedPositioned),
+ final toggleAlignment = tester.widget<AnimatedAlign>(
+ find.byType(AnimatedAlign),
);
- expect(togglePosition.left, 0);
+ expect(toggleAlignment.alignment, Alignment.centerLeft);
});
});
}