show manage family option for free plans

This commit is contained in:
Neeraj Gupta 2022-05-12 09:59:04 +05:30
parent 1137eea2f7
commit 6c6c6427a4
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1
2 changed files with 42 additions and 25 deletions

View file

@ -210,37 +210,37 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
),
),
]);
}
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<StripeSubscriptionPage> {
}
Future<void> _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();

View file

@ -237,6 +237,8 @@ class _SubscriptionPageState extends State<SubscriptionPage> {
),
),
]);
}
if (!widget.isOnboarding) {
widgets.addAll([
Align(
alignment: Alignment.topCenter,
@ -434,7 +436,15 @@ class _SubscriptionPageState extends State<SubscriptionPage> {
);
}
// todo: refactor manage family in common widget
Future<void> _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();