TF-1710 Move all method of PresentationMailbox object to extension to sync
(cherry picked from commit 408fb1840df1f04d51c018992e13ad1011649cbd)
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:model/extensions/presentation_mailbox_extension.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
import 'package:tmail_ui_user/main/routes/app_routes.dart';
|
||||
import 'package:tmail_ui_user/main/routes/navigation_router.dart';
|
||||
import 'package:tmail_ui_user/main/routes/route_utils.dart';
|
||||
|
||||
extension PresentationMailboxExtension on PresentationMailbox {
|
||||
|
||||
@@ -28,4 +33,56 @@ extension PresentationMailboxExtension on PresentationMailbox {
|
||||
}
|
||||
return name?.name ?? '';
|
||||
}
|
||||
|
||||
String getMailboxIcon(ImagePaths imagePaths) {
|
||||
if (hasRole()) {
|
||||
switch(role!.value) {
|
||||
case PresentationMailbox.inboxRole:
|
||||
return imagePaths.icMailboxInbox;
|
||||
case PresentationMailbox.draftsRole:
|
||||
return imagePaths.icMailboxDrafts;
|
||||
case PresentationMailbox.outboxRole:
|
||||
return imagePaths.icMailboxOutbox;
|
||||
case PresentationMailbox.archiveRole:
|
||||
return imagePaths.icMailboxArchived;
|
||||
case PresentationMailbox.sentRole:
|
||||
return imagePaths.icMailboxSent;
|
||||
case PresentationMailbox.trashRole:
|
||||
return imagePaths.icMailboxTrash;
|
||||
case PresentationMailbox.spamRole:
|
||||
return imagePaths.icMailboxSpam;
|
||||
case PresentationMailbox.templatesRole:
|
||||
return imagePaths.icMailboxTemplate;
|
||||
case 'all_mail':
|
||||
return imagePaths.icMailboxAllMail;
|
||||
default:
|
||||
return imagePaths.icFolderMailbox;
|
||||
}
|
||||
} else if (isChildOfTeamMailboxes) {
|
||||
switch(name!.name.toLowerCase()) {
|
||||
case 'inbox':
|
||||
return imagePaths.icMailboxInbox;
|
||||
case 'outbox':
|
||||
return imagePaths.icMailboxOutbox;
|
||||
case 'drafts':
|
||||
return imagePaths.icMailboxDrafts;
|
||||
case 'archive':
|
||||
return imagePaths.icMailboxArchived;
|
||||
case 'sent':
|
||||
return imagePaths.icMailboxSent;
|
||||
case 'trash':
|
||||
return imagePaths.icMailboxTrash;
|
||||
case 'spam':
|
||||
return imagePaths.icMailboxSpam;
|
||||
case 'templates':
|
||||
return imagePaths.icMailboxTemplate;
|
||||
default:
|
||||
return imagePaths.icFolderMailbox;
|
||||
}
|
||||
} else {
|
||||
return imagePaths.icFolderMailbox;
|
||||
}
|
||||
}
|
||||
|
||||
Uri get mailboxRouteWeb => RouteUtils.generateRouteBrowser(AppRoutes.dashboard, NavigationRouter(mailboxId: id));
|
||||
}
|
||||
Reference in New Issue
Block a user