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