Replaced renew & cancel subscription dialogs

This commit is contained in:
ashilkn 2023-01-10 11:37:07 +05:30
parent ad612b4683
commit cfe9c28c36

View file

@ -13,6 +13,7 @@ import 'package:photos/ui/common/dialogs.dart';
import 'package:photos/ui/common/loading_widget.dart'; import 'package:photos/ui/common/loading_widget.dart';
import 'package:photos/ui/common/progress_dialog.dart'; import 'package:photos/ui/common/progress_dialog.dart';
import 'package:photos/ui/common/web_page.dart'; import 'package:photos/ui/common/web_page.dart';
import 'package:photos/ui/components/button_widget.dart';
import 'package:photos/ui/payment/child_subscription_widget.dart'; import 'package:photos/ui/payment/child_subscription_widget.dart';
import 'package:photos/ui/payment/payment_web_page.dart'; import 'package:photos/ui/payment/payment_web_page.dart';
import 'package:photos/ui/payment/skip_subscription_widget.dart'; import 'package:photos/ui/payment/skip_subscription_widget.dart';
@ -344,24 +345,23 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
onPressed: () async { onPressed: () async {
bool confirmAction = false; bool confirmAction = false;
if (isRenewCancelled) { if (isRenewCancelled) {
final choice = await showChoiceDialog( final choice = await showNewChoiceDialog(
context, context,
title, title: title,
"Are you sure you want to renew?", body: "Are you sure you want to renew?",
firstAction: "No", firstButtonLabel: "Yes, Renew",
secondAction: "Yes",
); );
confirmAction = choice == DialogUserChoice.secondChoice; confirmAction = choice == ButtonAction.first;
} else { } else {
final choice = await showChoiceDialog( final choice = await showNewChoiceDialog(
context, context,
title, title: title,
'Are you sure you want to cancel?', body: "Are you sure you want to cancel?",
firstAction: 'Yes, cancel', firstButtonLabel: "Yes, cancel",
secondAction: 'No', secondButtonLabel: "No",
actionType: ActionType.critical, isCritical: true,
); );
confirmAction = choice == DialogUserChoice.firstChoice; confirmAction = choice == ButtonAction.first;
} }
if (confirmAction) { if (confirmAction) {
toggleStripeSubscription(isRenewCancelled); toggleStripeSubscription(isRenewCancelled);
@ -380,7 +380,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
} catch (e) { } catch (e) {
showShortToast( showShortToast(
context, context,
isRenewCancelled ? 'failed to renew' : 'failed to cancel', isRenewCancelled ? 'Failed to renew' : 'Failed to cancel',
); );
} }
await _dialog.hide(); await _dialog.hide();