From 6c6c6427a474c3f1f9fac422906c48a628261149 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Thu, 12 May 2022 09:59:04 +0530 Subject: [PATCH] show manage family option for free plans --- lib/ui/payment/stripe_subscription_page.dart | 57 +++++++++++--------- lib/ui/payment/subscription_page.dart | 10 ++++ 2 files changed, 42 insertions(+), 25 deletions(-) diff --git a/lib/ui/payment/stripe_subscription_page.dart b/lib/ui/payment/stripe_subscription_page.dart index 7f1d642f4..7b86c9a51 100644 --- a/lib/ui/payment/stripe_subscription_page.dart +++ b/lib/ui/payment/stripe_subscription_page.dart @@ -210,37 +210,37 @@ class _StripeSubscriptionPageState extends State { ), ), ]); + } - if (!widget.isOnboarding) { - widgets.addAll([ - Align( - alignment: Alignment.topCenter, - child: GestureDetector( - onTap: () async { - await _launchFamilyPortal(); - }, - child: Container( - padding: EdgeInsets.fromLTRB(40, 0, 40, 80), - child: Column( - children: [ - RichText( - text: TextSpan( - text: "manage family", - style: TextStyle( - color: Colors.blue, - fontFamily: 'Ubuntu', - fontSize: 15, - ), + if (!widget.isOnboarding) { + widgets.addAll([ + Align( + alignment: Alignment.topCenter, + child: GestureDetector( + onTap: () async { + await _launchFamilyPortal(); + }, + child: Container( + padding: EdgeInsets.fromLTRB(40, 0, 40, 80), + child: Column( + children: [ + RichText( + text: TextSpan( + text: "manage family", + style: TextStyle( + color: Colors.blue, + fontFamily: 'Ubuntu', + fontSize: 15, ), - textAlign: TextAlign.center, ), - ], - ), + textAlign: TextAlign.center, + ), + ], ), ), ), - ]); - } + ), + ]); } return SingleChildScrollView( @@ -270,6 +270,13 @@ class _StripeSubscriptionPageState extends State { } Future _launchFamilyPortal() async { + if (_userDetails.subscription.productID == kFreeProductID) { + await showErrorDialog( + context, + "Now you can share your storage plan with your family members!", + "Customers on paid plans can add up to 5 family members without paying extra. Each member gets their own private space."); + return; + } await _dialog.show(); try { final String jwtToken = await _userService.getFamiliesToken(); diff --git a/lib/ui/payment/subscription_page.dart b/lib/ui/payment/subscription_page.dart index 247e9c36b..3152b1cd9 100644 --- a/lib/ui/payment/subscription_page.dart +++ b/lib/ui/payment/subscription_page.dart @@ -237,6 +237,8 @@ class _SubscriptionPageState extends State { ), ), ]); + } + if (!widget.isOnboarding) { widgets.addAll([ Align( alignment: Alignment.topCenter, @@ -434,7 +436,15 @@ class _SubscriptionPageState extends State { ); } + // todo: refactor manage family in common widget Future _launchFamilyPortal() async { + if (_userDetails.subscription.productID == kFreeProductID) { + await showErrorDialog( + context, + "Now you can share your storage plan with your family members!", + "Customers on paid plans can add up to 5 family members without paying extra. Each member gets their own private space."); + return; + } await _dialog.show(); try { final String jwtToken = await _userService.getFamiliesToken();