Skip to content

Commit 89a3743

Browse files
dab246hoangdat
authored andcommitted
Apply new design for all confirm dialog
Signed-off-by: dab246 <[email protected]>
1 parent df3814d commit 89a3743

File tree

16 files changed

+65
-177
lines changed

16 files changed

+65
-177
lines changed

core/lib/presentation/views/dialog/confirmation_dialog_builder.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class ConfirmationDialogBuilder extends StatelessWidget {
7979
this.listTextSpan,
8080
this.titleActionButtonMaxLines,
8181
this.isArrangeActionButtonsVertical = false,
82-
this.useIconAsBasicLogo = false,
82+
this.useIconAsBasicLogo = true,
8383
this.onConfirmButtonAction,
8484
this.onCancelButtonAction,
8585
this.onCloseButtonAction,

lib/features/base/base_mailbox_controller.dart

+4-9
Original file line numberDiff line numberDiff line change
@@ -439,17 +439,12 @@ abstract class BaseMailboxController extends BaseController {
439439
child: ConfirmationDialogBuilder(
440440
key: const Key('confirm_dialog_delete_mailbox'),
441441
imagePath: imagePaths,
442-
useIconAsBasicLogo: true,
443442
title: AppLocalizations.of(context).deleteFolders,
444443
textContent: AppLocalizations.of(context).message_confirmation_dialog_delete_folder(presentationMailbox.getDisplayName(context)),
445-
confirmText: AppLocalizations.of(context).delete,
446-
cancelText: AppLocalizations.of(context).cancel,
447-
cancelBackgroundButtonColor: AppColor.blue700,
448-
cancelLabelButtonColor: Colors.white,
449-
confirmBackgroundButtonColor: AppColor.grayBackgroundColor,
450-
confirmLabelButtonColor: AppColor.steelGray600,
451-
onConfirmButtonAction: () => onDeleteMailboxAction(presentationMailbox),
452-
onCancelButtonAction: popBack,
444+
confirmText: AppLocalizations.of(context).cancel,
445+
cancelText: AppLocalizations.of(context).delete,
446+
onCancelButtonAction: () => onDeleteMailboxAction(presentationMailbox),
447+
onConfirmButtonAction: popBack,
453448
onCloseButtonAction: popBack,
454449
),
455450
),

lib/features/base/mixin/mailbox_action_handler_mixin.dart

+8-18
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,10 @@ mixin MailboxActionHandlerMixin {
8383
imagePath: imagePaths,
8484
title: AppLocalizations.of(context).emptyTrash,
8585
textContent: AppLocalizations.of(context).empty_trash_dialog_message,
86-
confirmText: AppLocalizations.of(context).delete,
87-
cancelText: AppLocalizations.of(context).cancel,
88-
useIconAsBasicLogo: true,
89-
cancelBackgroundButtonColor: AppColor.blue700,
90-
cancelLabelButtonColor: Colors.white,
91-
confirmBackgroundButtonColor: AppColor.grayBackgroundColor,
92-
confirmLabelButtonColor: AppColor.steelGray600,
86+
confirmText: AppLocalizations.of(context).cancel,
87+
cancelText: AppLocalizations.of(context).delete,
9388
onCloseButtonAction: popBack,
94-
onConfirmButtonAction: () {
89+
onCancelButtonAction: () {
9590
popBack();
9691
if (mailbox.countTotalEmails > 0) {
9792
dashboardController.emptyTrashFolderAction(
@@ -105,7 +100,7 @@ mixin MailboxActionHandlerMixin {
105100
);
106101
}
107102
},
108-
onCancelButtonAction: popBack,
103+
onConfirmButtonAction: popBack,
109104
),
110105
),
111106
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
@@ -150,15 +145,10 @@ mixin MailboxActionHandlerMixin {
150145
imagePath: imagePaths,
151146
title: AppLocalizations.of(context).emptySpamFolder,
152147
textContent: AppLocalizations.of(context).emptySpamMessageDialog,
153-
confirmText: AppLocalizations.of(context).delete_all,
154-
cancelText: AppLocalizations.of(context).cancel,
155-
useIconAsBasicLogo: true,
156-
cancelBackgroundButtonColor: AppColor.blue700,
157-
cancelLabelButtonColor: Colors.white,
158-
confirmBackgroundButtonColor: AppColor.grayBackgroundColor,
159-
confirmLabelButtonColor: AppColor.steelGray600,
148+
confirmText: AppLocalizations.of(context).cancel,
149+
cancelText: AppLocalizations.of(context).delete_all,
160150
onCloseButtonAction: popBack,
161-
onConfirmButtonAction: () {
151+
onCancelButtonAction: () {
162152
popBack();
163153
if (mailbox.countTotalEmails > 0) {
164154
dashboardController.emptySpamFolderAction(spamFolderId: mailbox.id, totalEmails: mailbox.countTotalEmails);
@@ -169,7 +159,7 @@ mixin MailboxActionHandlerMixin {
169159
);
170160
}
171161
},
172-
onCancelButtonAction: popBack,
162+
onConfirmButtonAction: popBack,
173163
),
174164
),
175165
barrierColor: AppColor.colorDefaultCupertinoActionSheet,

lib/features/base/mixin/message_dialog_action_mixin.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mixin MessageDialogActionMixin {
4545
PopInvokedWithResultCallback? onPopInvoked,
4646
bool isArrangeActionButtonsVertical = false,
4747
int? titleActionButtonMaxLines,
48-
bool useIconAsBasicLogo = false,
48+
bool useIconAsBasicLogo = true,
4949
EdgeInsetsGeometry? dialogMargin,
5050
}
5151
) async {

lib/features/composer/presentation/composer_controller.dart

+4-31
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import 'package:filesize/filesize.dart';
1414
import 'package:flutter/foundation.dart';
1515
import 'package:flutter/material.dart';
1616
import 'package:flutter/services.dart';
17-
import 'package:flutter_svg/flutter_svg.dart';
1817
import 'package:get/get.dart';
1918
import 'package:html/parser.dart';
2019
import 'package:html_editor_enhanced/html_editor.dart';
@@ -1021,7 +1020,6 @@ class ComposerController extends BaseController
10211020
AppLocalizations.of(context).message_dialog_send_email_without_recipient,
10221021
AppLocalizations.of(context).add_recipients,
10231022
title: AppLocalizations.of(context).sending_failed,
1024-
icon: SvgPicture.asset(imagePaths.icSendToastError, fit: BoxFit.fill),
10251023
hasCancelButton: false,
10261024
showAsBottomSheet: true,
10271025
).whenComplete(() => _sendButtonState = ButtonState.enabled);
@@ -1044,7 +1042,6 @@ class ComposerController extends BaseController
10441042
},
10451043
showAsBottomSheet: true,
10461044
title: AppLocalizations.of(context).sending_failed,
1047-
icon: SvgPicture.asset(imagePaths.icSendToastError, fit: BoxFit.fill),
10481045
hasCancelButton: false
10491046
).whenComplete(() => _sendButtonState = ButtonState.enabled);
10501047
return;
@@ -1053,17 +1050,13 @@ class ComposerController extends BaseController
10531050
if (subjectEmail.value == null || subjectEmail.isEmpty == true) {
10541051
showConfirmDialogAction(context,
10551052
AppLocalizations.of(context).message_dialog_send_email_without_a_subject,
1056-
AppLocalizations.of(context).send_anyway,
1057-
onConfirmAction: () => _handleSendMessages(context),
1058-
onCancelAction: popBack,
1053+
AppLocalizations.of(context).cancel,
1054+
cancelTitle: AppLocalizations.of(context).send_anyway,
1055+
onCancelAction: () => _handleSendMessages(context),
1056+
onConfirmAction: popBack,
10591057
autoPerformPopBack: false,
10601058
title: AppLocalizations.of(context).empty_subject,
1061-
cancelButtonColor: AppColor.blue700,
1062-
cancelLabelButtonColor: Colors.white,
1063-
actionButtonColor: AppColor.grayBackgroundColor,
1064-
confirmLabelButtonColor: AppColor.steelGray600,
10651059
showAsBottomSheet: true,
1066-
icon: SvgPicture.asset(imagePaths.icEmpty, fit: BoxFit.fill),
10671060
).whenComplete(() => _sendButtonState = ButtonState.enabled);
10681061
return;
10691062
}
@@ -1075,7 +1068,6 @@ class ComposerController extends BaseController
10751068
AppLocalizations.of(context).got_it,
10761069
title: AppLocalizations.of(context).sending_failed,
10771070
showAsBottomSheet: true,
1078-
icon: SvgPicture.asset(imagePaths.icSendToastError, fit: BoxFit.fill),
10791071
hasCancelButton: false
10801072
).whenComplete(() => _sendButtonState = ButtonState.enabled);
10811073
return;
@@ -1088,7 +1080,6 @@ class ComposerController extends BaseController
10881080
filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)),
10891081
AppLocalizations.of(context).got_it,
10901082
title: AppLocalizations.of(context).sending_failed,
1091-
icon: SvgPicture.asset(imagePaths.icSendToastError, fit: BoxFit.fill),
10921083
hasCancelButton: false
10931084
).whenComplete(() => _sendButtonState = ButtonState.enabled);
10941085
return;
@@ -1236,12 +1227,6 @@ class ComposerController extends BaseController
12361227
_sendButtonState = ButtonState.enabled;
12371228
_closeComposerAction(closeOverlays: true);
12381229
},
1239-
icon: SvgPicture.asset(
1240-
imagePaths.icQuotasWarning,
1241-
width: 40,
1242-
height: 40,
1243-
colorFilter: AppColor.colorBackgroundQuotasWarning.asFilter(),
1244-
),
12451230
);
12461231
}
12471232

@@ -2266,12 +2251,6 @@ class ComposerController extends BaseController
22662251
_autoFocusFieldWhenLauncher();
22672252
}
22682253
},
2269-
icon: SvgPicture.asset(
2270-
imagePaths.icQuotasWarning,
2271-
width: 40,
2272-
height: 40,
2273-
colorFilter: AppColor.colorBackgroundQuotasWarning.asFilter(),
2274-
),
22752254
);
22762255
}
22772256

@@ -2467,12 +2446,6 @@ class ComposerController extends BaseController
24672446
_closeComposerButtonState = ButtonState.enabled;
24682447
_closeComposerAction(closeOverlays: true);
24692448
},
2470-
icon: SvgPicture.asset(
2471-
imagePaths.icQuotasWarning,
2472-
width: 40,
2473-
height: 40,
2474-
colorFilter: AppColor.colorBackgroundQuotasWarning.asFilter(),
2475-
),
24762449
);
24772450
}
24782451

lib/features/email/presentation/controller/single_email_controller.dart

+4-11
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,6 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
738738
dialogMargin: MediaQuery.paddingOf(currentContext!).add(const EdgeInsets.only(bottom: 12)),
739739
title: AppLocalizations.of(currentContext!).titleReadReceiptRequestNotificationMessage,
740740
cancelTitle: AppLocalizations.of(currentContext!).no,
741-
icon: SvgPicture.asset(imagePaths.icReadReceiptMessage, fit: BoxFit.fill),
742741
);
743742
}
744743
}
@@ -1553,17 +1552,12 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
15531552
PointerInterceptor(child: ConfirmationDialogBuilder(
15541553
key: const Key('confirm_dialog_delete_email_permanently'),
15551554
imagePath: imagePaths,
1556-
useIconAsBasicLogo: true,
15571555
title: DeleteActionType.single.getTitleDialog(context),
15581556
textContent: DeleteActionType.single.getContentDialog(context),
1559-
confirmText: DeleteActionType.single.getConfirmActionName(context),
1560-
cancelText: AppLocalizations.of(context).cancel,
1561-
cancelBackgroundButtonColor: AppColor.blue700,
1562-
cancelLabelButtonColor: Colors.white,
1563-
confirmBackgroundButtonColor: AppColor.grayBackgroundColor,
1564-
confirmLabelButtonColor: AppColor.steelGray600,
1565-
onConfirmButtonAction: () => _deleteEmailPermanentlyAction(context, email),
1566-
onCancelButtonAction: popBack,
1557+
cancelText: DeleteActionType.single.getConfirmActionName(context),
1558+
confirmText: AppLocalizations.of(context).cancel,
1559+
onCancelButtonAction: () => _deleteEmailPermanentlyAction(context, email),
1560+
onConfirmButtonAction: popBack,
15671561
onCloseButtonAction: popBack,
15681562
)),
15691563
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
@@ -1948,7 +1942,6 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
19481942
},
19491943
showAsBottomSheet: true,
19501944
title: AppLocalizations.of(context).unsubscribeMail,
1951-
icon: SvgPicture.asset(imagePaths.icEmpty),
19521945
messageStyle: ThemeUtils.textStyleBodyBody2(color: AppColor.steelGray400),
19531946
listTextSpan: [
19541947
TextSpan(text: AppLocalizations.of(context).unsubscribeMailDialogMessage),

lib/features/mailbox/presentation/mailbox_controller.dart

+4-8
Original file line numberDiff line numberDiff line change
@@ -1073,15 +1073,12 @@ class MailboxController extends BaseMailboxController
10731073
PointerInterceptor(child: ConfirmationDialogBuilder(
10741074
key: const Key('confirm_dialog_delete_multiple_mailbox'),
10751075
imagePath: imagePaths,
1076-
useIconAsBasicLogo: true,
10771076
title: AppLocalizations.of(context).deleteFolders,
1078-
cancelBackgroundButtonColor: AppColor.blue700,
1079-
cancelLabelButtonColor: Colors.white,
1080-
confirmBackgroundButtonColor: AppColor.grayBackgroundColor,
1081-
confirmLabelButtonColor: AppColor.steelGray600,
10821077
textContent: AppLocalizations.of(context).messageConfirmationDialogDeleteMultipleFolder(selectedMailboxList.length),
1083-
onConfirmButtonAction: () => _deleteMultipleMailboxAction(selectedMailboxList),
1084-
onCancelButtonAction: popBack,
1078+
confirmText: AppLocalizations.of(context).cancel,
1079+
cancelText: AppLocalizations.of(context).delete,
1080+
onCancelButtonAction: () => _deleteMultipleMailboxAction(selectedMailboxList),
1081+
onConfirmButtonAction: popBack,
10851082
onCloseButtonAction: popBack,
10861083
)),
10871084
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
@@ -1718,7 +1715,6 @@ class MailboxController extends BaseMailboxController
17181715
child: ConfirmationDialogBuilder(
17191716
key: const Key('confirm_dialog_subaddressing'),
17201717
imagePath: imagePaths,
1721-
useIconAsBasicLogo: true,
17221718
title: AppLocalizations.of(context).allowSubaddressing,
17231719
textContent: AppLocalizations.of(context).message_confirmation_dialog_allow_subaddressing(mailboxName),
17241720
confirmText: AppLocalizations.of(context).allow,

lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart

+8-18
Original file line numberDiff line numberDiff line change
@@ -1554,25 +1554,20 @@ class MailboxDashBoardController extends ReloadableController
15541554
PointerInterceptor(child: ConfirmationDialogBuilder(
15551555
key: const Key('confirm_dialog_delete_emails_permanently'),
15561556
imagePath: imagePaths,
1557-
useIconAsBasicLogo: true,
15581557
title: actionType.getTitleDialog(context),
15591558
textContent: actionType.getContentDialog(
15601559
context,
15611560
count: listEmails?.length,
15621561
mailboxName: mailboxCurrent?.getDisplayName(context),
15631562
),
1564-
confirmText: actionType.getConfirmActionName(context),
1565-
cancelText: AppLocalizations.of(context).cancel,
1566-
cancelBackgroundButtonColor: AppColor.blue700,
1567-
cancelLabelButtonColor: Colors.white,
1568-
confirmBackgroundButtonColor: AppColor.grayBackgroundColor,
1569-
confirmLabelButtonColor: AppColor.steelGray600,
1570-
onConfirmButtonAction: () => _deleteSelectionEmailsPermanentlyAction(
1563+
cancelText: actionType.getConfirmActionName(context),
1564+
confirmText: AppLocalizations.of(context).cancel,
1565+
onCancelButtonAction: () => _deleteSelectionEmailsPermanentlyAction(
15711566
actionType,
15721567
listEmails: listEmails,
15731568
onCancelSelectionEmail: onCancelSelectionEmail,
15741569
),
1575-
onCancelButtonAction: popBack,
1570+
onConfirmButtonAction: popBack,
15761571
onCloseButtonAction: popBack,
15771572
)),
15781573
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
@@ -2627,16 +2622,11 @@ class MailboxDashBoardController extends ReloadableController
26272622
PointerInterceptor(child: ConfirmationDialogBuilder(
26282623
key: const Key('confirm_dialog_empty_spam'),
26292624
imagePath: imagePaths,
2630-
useIconAsBasicLogo: true,
26312625
title: AppLocalizations.of(context).emptySpamFolder,
26322626
textContent: AppLocalizations.of(context).emptySpamMessageDialog,
2633-
confirmText: AppLocalizations.of(context).delete_all,
2634-
cancelText: AppLocalizations.of(context).cancel,
2635-
cancelBackgroundButtonColor: AppColor.blue700,
2636-
cancelLabelButtonColor: Colors.white,
2637-
confirmBackgroundButtonColor: AppColor.grayBackgroundColor,
2638-
confirmLabelButtonColor: AppColor.steelGray600,
2639-
onConfirmButtonAction: () {
2627+
cancelText: AppLocalizations.of(context).delete_all,
2628+
confirmText: AppLocalizations.of(context).cancel,
2629+
onCancelButtonAction: () {
26402630
popBack();
26412631
if (spamMailbox.countTotalEmails > 0) {
26422632
emptySpamFolderAction(
@@ -2650,7 +2640,7 @@ class MailboxDashBoardController extends ReloadableController
26502640
);
26512641
}
26522642
},
2653-
onCancelButtonAction: popBack,
2643+
onConfirmButtonAction: popBack,
26542644
onCloseButtonAction: popBack,
26552645
)),
26562646
barrierColor: AppColor.colorDefaultCupertinoActionSheet,

lib/features/manage_account/presentation/email_rules/email_rules_controller.dart

+4-9
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,12 @@ class EmailRulesController extends BaseController {
170170
PointerInterceptor(
171171
child: ConfirmationDialogBuilder(
172172
imagePath: imagePaths,
173-
useIconAsBasicLogo: true,
174173
title: AppLocalizations.of(context).deleteEmailRule,
175174
textContent: AppLocalizations.of(context).messageConfirmationDialogDeleteEmailRule(emailRule.name),
176-
confirmText: AppLocalizations.of(context).delete,
177-
cancelText: AppLocalizations.of(context).cancel,
178-
cancelBackgroundButtonColor: AppColor.blue700,
179-
cancelLabelButtonColor: Colors.white,
180-
confirmBackgroundButtonColor: AppColor.grayBackgroundColor,
181-
confirmLabelButtonColor: AppColor.steelGray600,
182-
onConfirmButtonAction: () => _handleDeleteEmailRuleAction(emailRule),
183-
onCancelButtonAction: popBack,
175+
cancelText: AppLocalizations.of(context).delete,
176+
confirmText: AppLocalizations.of(context).cancel,
177+
onCancelButtonAction: () => _handleDeleteEmailRuleAction(emailRule),
178+
onConfirmButtonAction: popBack,
184179
onCloseButtonAction: popBack,
185180
),
186181
),

lib/features/manage_account/presentation/forward/forward_controller.dart

+8-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'package:core/presentation/extensions/color_extension.dart';
21
import 'package:core/presentation/state/failure.dart';
32
import 'package:core/presentation/state/success.dart';
43
import 'package:core/presentation/utils/keyboard_utils.dart';
@@ -119,14 +118,10 @@ class ForwardController extends BaseController {
119118
context,
120119
title: AppLocalizations.of(context).deleteRecipient,
121120
AppLocalizations.of(context).messageConfirmationDialogDeleteRecipientForward(emailAddress),
122-
AppLocalizations.of(context).remove,
123-
onConfirmAction: () => _handleDeleteRecipientAction({emailAddress}),
121+
AppLocalizations.of(context).cancel,
122+
cancelTitle: AppLocalizations.of(context).remove,
123+
onCancelAction: () => _handleDeleteRecipientAction({emailAddress}),
124124
showAsBottomSheet: true,
125-
useIconAsBasicLogo: true,
126-
cancelButtonColor: AppColor.blue700,
127-
cancelLabelButtonColor: Colors.white,
128-
actionButtonColor: AppColor.grayBackgroundColor,
129-
confirmLabelButtonColor: AppColor.steelGray600,
130125
);
131126
}
132127

@@ -202,17 +197,14 @@ class ForwardController extends BaseController {
202197
}
203198

204199
void deleteMultipleRecipients(BuildContext context, Set<String> listEmailAddress) {
205-
showConfirmDialogAction(currentContext!,
200+
showConfirmDialogAction(
201+
context,
206202
title: AppLocalizations.of(context).deleteRecipient,
207203
AppLocalizations.of(context).messageConfirmationDialogDeleteAllRecipientForward,
208-
AppLocalizations.of(currentContext!).remove,
209-
onConfirmAction: () => _handleDeleteRecipientAction(listEmailAddress),
204+
AppLocalizations.of(context).cancel,
205+
cancelTitle: AppLocalizations.of(context).remove,
206+
onCancelAction: () => _handleDeleteRecipientAction(listEmailAddress),
210207
showAsBottomSheet: true,
211-
useIconAsBasicLogo: true,
212-
cancelButtonColor: AppColor.blue700,
213-
cancelLabelButtonColor: Colors.white,
214-
actionButtonColor: AppColor.grayBackgroundColor,
215-
confirmLabelButtonColor: AppColor.steelGray600,
216208
);
217209
}
218210

0 commit comments

Comments
 (0)