TF-3766 Change context menu style for other widgets on mobile
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tmail_ui_user/features/base/widget/context_menu/context_menu_item_action.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/email_rule_action_type.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
class ContextItemEmailRuleTypeAction
|
||||
extends ContextMenuItemActionRequiredIcon<EmailRuleActionType> {
|
||||
final AppLocalizations appLocalizations;
|
||||
final ImagePaths imagePaths;
|
||||
|
||||
ContextItemEmailRuleTypeAction(
|
||||
super.action,
|
||||
this.appLocalizations,
|
||||
this.imagePaths,
|
||||
);
|
||||
|
||||
@override
|
||||
String get actionIcon => action.getIcon(imagePaths);
|
||||
|
||||
@override
|
||||
String get actionName => action.getName(appLocalizations);
|
||||
|
||||
@override
|
||||
Color get actionIconColor => action.getIconColor();
|
||||
|
||||
@override
|
||||
Color get actionNameColor => action.getNameColor();
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
|
||||
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 EmailRuleActionType {
|
||||
add,
|
||||
edit,
|
||||
delete;
|
||||
|
||||
String getName(AppLocalizations appLocalizations) {
|
||||
switch(this) {
|
||||
case EmailRuleActionType.add:
|
||||
return appLocalizations.addNewRule;
|
||||
case EmailRuleActionType.edit:
|
||||
return appLocalizations.editRule;
|
||||
case EmailRuleActionType.delete:
|
||||
return appLocalizations.deleteRule;
|
||||
}
|
||||
}
|
||||
|
||||
String getIcon(ImagePaths imagePaths) {
|
||||
switch(this) {
|
||||
case EmailRuleActionType.add:
|
||||
return imagePaths.icAddNewFolder;
|
||||
case EmailRuleActionType.edit:
|
||||
return imagePaths.icEdit;
|
||||
case EmailRuleActionType.delete:
|
||||
return imagePaths.icDeleteComposer;
|
||||
}
|
||||
}
|
||||
|
||||
Color getIconColor() {
|
||||
if (this == EmailRuleActionType.delete) {
|
||||
return AppColor.redFF3347;
|
||||
} else {
|
||||
return AppColor.gray424244.withOpacity(0.72);
|
||||
}
|
||||
}
|
||||
|
||||
Color getNameColor() {
|
||||
if (this == EmailRuleActionType.delete) {
|
||||
return AppColor.redFF3347;
|
||||
} else {
|
||||
return AppColor.gray424244.withOpacity(0.79);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user