TF-3759 Update style popup context menu for composer view
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
enum ComposerActionType {
|
||||
markAsImportant,
|
||||
requestReadReceipt,
|
||||
saveAsDraft,
|
||||
saveAsTemplate,
|
||||
delete;
|
||||
|
||||
String getContextMenuTitle(AppLocalizations appLocalizations) {
|
||||
switch (this) {
|
||||
case ComposerActionType.markAsImportant:
|
||||
return appLocalizations.markAsImportant;
|
||||
case ComposerActionType.requestReadReceipt:
|
||||
return appLocalizations.requestReadReceipt;
|
||||
case ComposerActionType.saveAsDraft:
|
||||
return appLocalizations.saveAsDraft;
|
||||
case ComposerActionType.saveAsTemplate:
|
||||
return appLocalizations.saveAsTemplate;
|
||||
case ComposerActionType.delete:
|
||||
return appLocalizations.delete;
|
||||
}
|
||||
}
|
||||
|
||||
String getContextMenuIcon(ImagePaths imagePath) {
|
||||
switch (this) {
|
||||
case ComposerActionType.markAsImportant:
|
||||
return imagePath.icMarkAsImportant;
|
||||
case ComposerActionType.requestReadReceipt:
|
||||
return imagePath.icReadReceipt;
|
||||
case ComposerActionType.saveAsDraft:
|
||||
return imagePath.icSaveToDraft;
|
||||
case ComposerActionType.saveAsTemplate:
|
||||
return imagePath.icSaveToDraft;
|
||||
case ComposerActionType.delete:
|
||||
return imagePath.icDeleteMailbox;
|
||||
}
|
||||
}
|
||||
|
||||
Color getContextMenuTitleColor() {
|
||||
switch (this) {
|
||||
case ComposerActionType.delete:
|
||||
return AppColor.redFF3347;
|
||||
default:
|
||||
return Colors.black;
|
||||
}
|
||||
}
|
||||
|
||||
Color getContextMenuIconColor() {
|
||||
switch (this) {
|
||||
case ComposerActionType.delete:
|
||||
return AppColor.redFF3347;
|
||||
default:
|
||||
return AppColor.steelGrayA540;
|
||||
}
|
||||
}
|
||||
|
||||
Key getContextMenuItemKey() {
|
||||
switch (this) {
|
||||
case ComposerActionType.markAsImportant:
|
||||
return const Key('mark_as_important_popup_item');
|
||||
case ComposerActionType.requestReadReceipt:
|
||||
return const Key('read_receipt_popup_item');
|
||||
case ComposerActionType.saveAsDraft:
|
||||
return const Key('save_as_draft_popup_item');
|
||||
case ComposerActionType.saveAsTemplate:
|
||||
return const Key('save_as_template_popup_item');
|
||||
case ComposerActionType.delete:
|
||||
return const Key('delete_popup_item');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tmail_ui_user/features/base/model/popup_menu_item_action.dart';
|
||||
import 'package:tmail_ui_user/features/composer/presentation/model/composer_action_type.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
class PopupMenuItemComposerTypeAction
|
||||
extends PopupMenuItemActionRequiredIcon<ComposerActionType> {
|
||||
final AppLocalizations appLocalizations;
|
||||
final ImagePaths imagePaths;
|
||||
|
||||
PopupMenuItemComposerTypeAction(
|
||||
super.action,
|
||||
this.appLocalizations,
|
||||
this.imagePaths,
|
||||
);
|
||||
|
||||
@override
|
||||
String get actionIcon => action.getContextMenuIcon(imagePaths);
|
||||
|
||||
@override
|
||||
String get actionName => action.getContextMenuTitle(appLocalizations);
|
||||
|
||||
@override
|
||||
Color get actionIconColor => action.getContextMenuIconColor();
|
||||
|
||||
@override
|
||||
Color get actionNameColor => action.getContextMenuTitleColor();
|
||||
}
|
||||
Reference in New Issue
Block a user