Fix toast message when sending a message
This commit is contained in:
@@ -16,7 +16,7 @@ mixin MessageDialogActionMixin {
|
||||
String message,
|
||||
String actionName,
|
||||
Function onConfirmAction,
|
||||
{bool hasCancelButton = true, Widget? icon}
|
||||
{String? title, bool hasCancelButton = true, Widget? icon}
|
||||
) {
|
||||
if (_responsiveUtils.isMobile(context)) {
|
||||
(ConfirmationDialogActionSheetBuilder(context)
|
||||
@@ -33,12 +33,12 @@ mixin MessageDialogActionMixin {
|
||||
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
||||
builder: (BuildContext context) => PointerInterceptor(child: (ConfirmDialogBuilder(_imagePaths)
|
||||
..key(Key('confirm_dialog_action'))
|
||||
..title(AppLocalizations.of(context).sending_failed)
|
||||
..title(title ?? '')
|
||||
..content(message)
|
||||
..addIcon(icon)
|
||||
..colorConfirmButton(AppColor.colorTextButton)
|
||||
..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)
|
||||
..paddingContent(EdgeInsets.only(left: 44, right: 44, bottom: 24, top: 8))
|
||||
..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).add_recipients,
|
||||
() => {},
|
||||
title: AppLocalizations.of(context).sending_failed,
|
||||
icon: SvgPicture.asset(_imagePaths.icSendToastError, fit: BoxFit.fill),
|
||||
hasCancelButton: false);
|
||||
return;
|
||||
@@ -407,6 +408,7 @@ class ComposerController extends BaseController {
|
||||
ccAddressExpandMode.value = ExpandMode.EXPAND;
|
||||
bccAddressExpandMode.value = ExpandMode.EXPAND;
|
||||
},
|
||||
title: AppLocalizations.of(context).sending_failed,
|
||||
icon: SvgPicture.asset(_imagePaths.icSendToastError, fit: BoxFit.fill),
|
||||
hasCancelButton: false);
|
||||
return;
|
||||
@@ -417,6 +419,7 @@ class ComposerController extends BaseController {
|
||||
AppLocalizations.of(context).message_dialog_send_email_without_a_subject,
|
||||
AppLocalizations.of(context).send_anyway,
|
||||
() => _handleSendMessages(context),
|
||||
title: AppLocalizations.of(context).empty_subject,
|
||||
icon: SvgPicture.asset(_imagePaths.icEmpty, fit: BoxFit.fill),
|
||||
);
|
||||
return;
|
||||
@@ -429,6 +432,7 @@ class ComposerController extends BaseController {
|
||||
filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)}'),
|
||||
AppLocalizations.of(context).got_it,
|
||||
() => {},
|
||||
title: AppLocalizations.of(context).sending_failed,
|
||||
icon: SvgPicture.asset(_imagePaths.icSendToastError, fit: BoxFit.fill),
|
||||
hasCancelButton: false);
|
||||
return;
|
||||
@@ -508,22 +512,10 @@ class ComposerController extends BaseController {
|
||||
.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 {
|
||||
popBack();
|
||||
consumeState(_localFilePickerInteractor.execute(fileType: fileType));
|
||||
}
|
||||
|
||||
void openFilePickerByTypeOnWeb(BuildContext context, FileType fileType) async {
|
||||
if (!kIsWeb) {
|
||||
popBack();
|
||||
}
|
||||
consumeState(_localFilePickerInteractor.execute(fileType: fileType));
|
||||
}
|
||||
|
||||
@@ -547,6 +539,7 @@ class ComposerController extends BaseController {
|
||||
filesize(mailboxDashBoardController.maxSizeAttachmentsPerEmail?.value ?? 0, 0)}'),
|
||||
AppLocalizations.of(currentContext!).got_it,
|
||||
() => {},
|
||||
title: AppLocalizations.of(currentContext!).maximum_files_size,
|
||||
hasCancelButton: false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ class ComposerView extends GetWidget<ComposerController> {
|
||||
buildIconWeb(
|
||||
icon: SvgPicture.asset(imagePaths.icAttachmentsComposer, color: AppColor.colorTextButton, fit: BoxFit.fill),
|
||||
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": {
|
||||
"type": "text",
|
||||
@@ -1035,5 +1035,11 @@
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"maximum_files_size": "Maximum files size",
|
||||
"@maximum_files_size": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
}
|
||||
}
|
||||
@@ -1084,4 +1084,10 @@ class AppLocalizations {
|
||||
'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> {
|
||||
|
||||
num totalSize() {
|
||||
final currentListSize = map((attachment) => attachment.size?.value ?? 0).toList();
|
||||
final totalSize = currentListSize.reduce((sum, size) => sum + size);
|
||||
return totalSize;
|
||||
if (isNotEmpty) {
|
||||
final currentListSize = map((attachment) => attachment.size?.value ?? 0).toList();
|
||||
final totalSize = currentListSize.reduce((sum, size) => sum + size);
|
||||
return totalSize;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
List<Attachment> get listAttachmentsDisplayedOutSide {
|
||||
|
||||
Reference in New Issue
Block a user