TF-1074 Handle go to path /mailbox_creator
This commit is contained in:
@@ -380,20 +380,37 @@ class MailboxController extends BaseMailboxController {
|
||||
_openMailboxEventController.add(OpenMailboxViewEvent(context, presentationMailboxSelected));
|
||||
}
|
||||
|
||||
void goToCreateNewMailboxView() async {
|
||||
void goToCreateNewMailboxView(BuildContext context) async {
|
||||
final accountId = mailboxDashBoardController.accountId.value;
|
||||
if (accountId != null) {
|
||||
final newMailboxArguments = await push(
|
||||
AppRoutes.mailboxCreator,
|
||||
arguments: MailboxCreatorArguments(accountId, defaultMailboxTree.value, folderMailboxTree.value)
|
||||
);
|
||||
final arguments = MailboxCreatorArguments(
|
||||
accountId,
|
||||
defaultMailboxTree.value,
|
||||
folderMailboxTree.value);
|
||||
|
||||
if (newMailboxArguments != null && newMailboxArguments is NewMailboxArguments) {
|
||||
final generateCreateId = Id(_uuid.v1());
|
||||
_createNewMailboxAction(accountId, CreateNewMailboxRequest(
|
||||
generateCreateId,
|
||||
newMailboxArguments.newName,
|
||||
parentId: newMailboxArguments.mailboxLocation?.id));
|
||||
if (BuildUtils.isWeb) {
|
||||
showDialogMailboxCreator(
|
||||
context: context,
|
||||
arguments: arguments,
|
||||
onCreatedMailbox: (newMailboxArguments) {
|
||||
final generateCreateId = Id(_uuid.v1());
|
||||
_createNewMailboxAction(accountId, CreateNewMailboxRequest(
|
||||
generateCreateId,
|
||||
newMailboxArguments.newName,
|
||||
parentId: newMailboxArguments.mailboxLocation?.id));
|
||||
});
|
||||
} else {
|
||||
final newMailboxArguments = await push(
|
||||
AppRoutes.mailboxCreator,
|
||||
arguments: arguments);
|
||||
|
||||
if (newMailboxArguments != null && newMailboxArguments is NewMailboxArguments) {
|
||||
final generateCreateId = Id(_uuid.v1());
|
||||
_createNewMailboxAction(accountId, CreateNewMailboxRequest(
|
||||
generateCreateId,
|
||||
newMailboxArguments.newName,
|
||||
parentId: newMailboxArguments.mailboxLocation?.id));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ class MailboxView extends GetWidget<MailboxController> {
|
||||
return buildIconWeb(
|
||||
icon: SvgPicture.asset(_imagePaths.icAddNewFolder, width: 28, height: 24, color: AppColor.colorTextButton, fit: BoxFit.fill),
|
||||
tooltip: AppLocalizations.of(context).new_mailbox,
|
||||
onTap: () => controller.goToCreateNewMailboxView());
|
||||
onTap: () => controller.goToCreateNewMailboxView(context));
|
||||
}
|
||||
|
||||
Widget _buildEditMailboxButton(BuildContext context, bool isSelectionEnabled) {
|
||||
|
||||
@@ -186,7 +186,7 @@ class MailboxView extends GetWidget<MailboxController> with AppLoaderMixin, Popu
|
||||
splashRadius: 15,
|
||||
icon: SvgPicture.asset(_imagePaths.icAddNewFolder, color: AppColor.colorTextButton, fit: BoxFit.fill),
|
||||
tooltip: AppLocalizations.of(context).new_mailbox,
|
||||
onTap: () => controller.goToCreateNewMailboxView())),
|
||||
onTap: () => controller.goToCreateNewMailboxView(context))),
|
||||
]),
|
||||
Obx(() => controller.folderMailboxHasChild
|
||||
? _buildMailboxCategory(context, MailboxCategories.folders, controller.folderRootNode)
|
||||
|
||||
Reference in New Issue
Block a user