Fix toast message when sending a message
This commit is contained in:
@@ -16,7 +16,7 @@ mixin MessageDialogActionMixin {
|
|||||||
String message,
|
String message,
|
||||||
String actionName,
|
String actionName,
|
||||||
Function onConfirmAction,
|
Function onConfirmAction,
|
||||||
{bool hasCancelButton = true, Widget? icon}
|
{String? title, bool hasCancelButton = true, Widget? icon}
|
||||||
) {
|
) {
|
||||||
if (_responsiveUtils.isMobile(context)) {
|
if (_responsiveUtils.isMobile(context)) {
|
||||||
(ConfirmationDialogActionSheetBuilder(context)
|
(ConfirmationDialogActionSheetBuilder(context)
|
||||||
@@ -33,12 +33,12 @@ mixin MessageDialogActionMixin {
|
|||||||
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
||||||
builder: (BuildContext context) => PointerInterceptor(child: (ConfirmDialogBuilder(_imagePaths)
|
builder: (BuildContext context) => PointerInterceptor(child: (ConfirmDialogBuilder(_imagePaths)
|
||||||
..key(Key('confirm_dialog_action'))
|
..key(Key('confirm_dialog_action'))
|
||||||
..title(AppLocalizations.of(context).sending_failed)
|
..title(title ?? '')
|
||||||
..content(message)
|
..content(message)
|
||||||
..addIcon(icon)
|
..addIcon(icon)
|
||||||
..colorConfirmButton(AppColor.colorTextButton)
|
..colorConfirmButton(AppColor.colorTextButton)
|
||||||
..colorCancelButton(AppColor.colorCancelButton)
|
..colorCancelButton(AppColor.colorCancelButton)
|
||||||
..paddingTitle(icon != null ? EdgeInsets.only(top: 34) : EdgeInsets.only(top: 10))
|
..paddingTitle(icon != null ? EdgeInsets.only(top: 34) : EdgeInsets.zero)
|
||||||
..marginIcon(EdgeInsets.zero)
|
..marginIcon(EdgeInsets.zero)
|
||||||
..paddingContent(EdgeInsets.only(left: 44, right: 44, bottom: 24, top: 8))
|
..paddingContent(EdgeInsets.only(left: 44, right: 44, bottom: 24, top: 8))
|
||||||
..paddingButton(hasCancelButton ? null : EdgeInsets.only(bottom: 16, left: 44, right: 44))
|
..paddingButton(hasCancelButton ? null : EdgeInsets.only(bottom: 16, left: 44, right: 44))
|
||||||
|
|||||||
@@ -389,6 +389,7 @@ class ComposerController extends BaseController {
|
|||||||
AppLocalizations.of(context).message_dialog_send_email_without_recipient,
|
AppLocalizations.of(context).message_dialog_send_email_without_recipient,
|
||||||
AppLocalizations.of(context).add_recipients,
|
AppLocalizations.of(context).add_recipients,
|
||||||
() => {},
|
() => {},
|
||||||
|
title: AppLocalizations.of(context).sending_failed,
|
||||||
icon: SvgPicture.asset(_imagePaths.icSendToastError, fit: BoxFit.fill),
|
icon: SvgPicture.asset(_imagePaths.icSendToastError, fit: BoxFit.fill),
|
||||||
hasCancelButton: false);
|
hasCancelButton: false);
|
||||||
return;
|
return;
|
||||||
@@ -407,6 +408,7 @@ class ComposerController extends BaseController {
|
|||||||
ccAddressExpandMode.value = ExpandMode.EXPAND;
|
ccAddressExpandMode.value = ExpandMode.EXPAND;
|
||||||
bccAddressExpandMode.value = ExpandMode.EXPAND;
|
bccAddressExpandMode.value = ExpandMode.EXPAND;
|
||||||
},
|
},
|
||||||
|
title: AppLocalizations.of(context).sending_failed,
|
||||||
icon: SvgPicture.asset(_imagePaths.icSendToastError, fit: BoxFit.fill),
|
icon: SvgPicture.asset(_imagePaths.icSendToastError, fit: BoxFit.fill),
|
||||||
hasCancelButton: false);
|
hasCancelButton: false);
|
||||||
return;
|
return;
|
||||||
@@ -417,6 +419,7 @@ class ComposerController extends BaseController {
|
|||||||
AppLocalizations.of(context).message_dialog_send_email_without_a_subject,
|
AppLocalizations.of(context).message_dialog_send_email_without_a_subject,
|
||||||
AppLocalizations.of(context).send_anyway,
|
AppLocalizations.of(context).send_anyway,
|
||||||
() => _handleSendMessages(context),
|
() => _handleSendMessages(context),
|
||||||
|
title: AppLocalizations.of(context).empty_subject,
|
||||||
icon: SvgPicture.asset(_imagePaths.icEmpty, fit: BoxFit.fill),
|
icon: SvgPicture.asset(_imagePaths.icEmpty, fit: BoxFit.fill),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@@ -429,6 +432,7 @@ class ComposerController extends BaseController {
|
|||||||
filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)}'),
|
filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)}'),
|
||||||
AppLocalizations.of(context).got_it,
|
AppLocalizations.of(context).got_it,
|
||||||
() => {},
|
() => {},
|
||||||
|
title: AppLocalizations.of(context).sending_failed,
|
||||||
icon: SvgPicture.asset(_imagePaths.icSendToastError, fit: BoxFit.fill),
|
icon: SvgPicture.asset(_imagePaths.icSendToastError, fit: BoxFit.fill),
|
||||||
hasCancelButton: false);
|
hasCancelButton: false);
|
||||||
return;
|
return;
|
||||||
@@ -508,22 +512,10 @@ class ComposerController extends BaseController {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
void openPickAttachmentsForWeb(BuildContext context, RelativeRect? position, List<PopupMenuEntry> popupMenuItems) async {
|
|
||||||
await showMenu(
|
|
||||||
context: context,
|
|
||||||
position: position ?? RelativeRect.fromLTRB(16, 40, 16, 16),
|
|
||||||
color: Colors.white,
|
|
||||||
elevation: 5,
|
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
|
|
||||||
items: popupMenuItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
void openFilePickerByType(BuildContext context, FileType fileType) async {
|
void openFilePickerByType(BuildContext context, FileType fileType) async {
|
||||||
popBack();
|
if (!kIsWeb) {
|
||||||
consumeState(_localFilePickerInteractor.execute(fileType: fileType));
|
popBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
void openFilePickerByTypeOnWeb(BuildContext context, FileType fileType) async {
|
|
||||||
consumeState(_localFilePickerInteractor.execute(fileType: fileType));
|
consumeState(_localFilePickerInteractor.execute(fileType: fileType));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -547,6 +539,7 @@ class ComposerController extends BaseController {
|
|||||||
filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)}'),
|
filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)}'),
|
||||||
AppLocalizations.of(currentContext!).got_it,
|
AppLocalizations.of(currentContext!).got_it,
|
||||||
() => {},
|
() => {},
|
||||||
|
title: AppLocalizations.of(currentContext!).maximum_files_size,
|
||||||
hasCancelButton: false);
|
hasCancelButton: false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ class ComposerView extends GetWidget<ComposerController> {
|
|||||||
buildIconWeb(
|
buildIconWeb(
|
||||||
icon: SvgPicture.asset(imagePaths.icAttachmentsComposer, color: AppColor.colorTextButton, fit: BoxFit.fill),
|
icon: SvgPicture.asset(imagePaths.icAttachmentsComposer, color: AppColor.colorTextButton, fit: BoxFit.fill),
|
||||||
tooltip: AppLocalizations.of(context).attach_file,
|
tooltip: AppLocalizations.of(context).attach_file,
|
||||||
onTap: () => controller.openFilePickerByTypeOnWeb(context, FileType.any)),
|
onTap: () => controller.openFilePickerByType(context, FileType.any)),
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"@@last_modified": "2022-04-07T14:40:38.896425",
|
"@@last_modified": "2022-04-07T15:43:45.603676",
|
||||||
"initializing_data": "Initializing data...",
|
"initializing_data": "Initializing data...",
|
||||||
"@initializing_data": {
|
"@initializing_data": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@@ -1035,5 +1035,11 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"maximum_files_size": "Maximum files size",
|
||||||
|
"@maximum_files_size": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1084,4 +1084,10 @@ class AppLocalizations {
|
|||||||
'Got it',
|
'Got it',
|
||||||
name: 'got_it');
|
name: 'got_it');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get maximum_files_size {
|
||||||
|
return Intl.message(
|
||||||
|
'Maximum files size',
|
||||||
|
name: 'maximum_files_size');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,12 @@ import 'package:model/model.dart';
|
|||||||
extension ListAttachmentExtension on List<Attachment> {
|
extension ListAttachmentExtension on List<Attachment> {
|
||||||
|
|
||||||
num totalSize() {
|
num totalSize() {
|
||||||
final currentListSize = map((attachment) => attachment.size?.value ?? 0).toList();
|
if (isNotEmpty) {
|
||||||
final totalSize = currentListSize.reduce((sum, size) => sum + size);
|
final currentListSize = map((attachment) => attachment.size?.value ?? 0).toList();
|
||||||
return totalSize;
|
final totalSize = currentListSize.reduce((sum, size) => sum + size);
|
||||||
|
return totalSize;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Attachment> get listAttachmentsDisplayedOutSide {
|
List<Attachment> get listAttachmentsDisplayedOutSide {
|
||||||
|
|||||||
Reference in New Issue
Block a user