TF-4233 Show popup menu when click three dot on label item
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
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 LabelActionType {
|
||||
create,
|
||||
edit;
|
||||
|
||||
String getContextMenuTitle(AppLocalizations appLocalizations) {
|
||||
switch (this) {
|
||||
case LabelActionType.create:
|
||||
return appLocalizations.create;
|
||||
case LabelActionType.edit:
|
||||
return appLocalizations.edit;
|
||||
}
|
||||
}
|
||||
|
||||
String getModalTitle(AppLocalizations appLocalizations) {
|
||||
switch (this) {
|
||||
case LabelActionType.create:
|
||||
return appLocalizations.createANewLabel;
|
||||
case LabelActionType.edit:
|
||||
return appLocalizations.updateTheLabelName;
|
||||
}
|
||||
}
|
||||
|
||||
String getContextMenuIcon(ImagePaths imagePaths) {
|
||||
switch (this) {
|
||||
case LabelActionType.create:
|
||||
return imagePaths.icAddNewFolder;
|
||||
case LabelActionType.edit:
|
||||
return imagePaths.icRenameMailbox;
|
||||
}
|
||||
}
|
||||
|
||||
Color getPopupMenuTitleColor() => Colors.black;
|
||||
|
||||
Color getPopupMenuIconColor() => AppColor.steelGrayA540;
|
||||
|
||||
Color getContextMenuIconColor() =>
|
||||
AppColor.gray424244.withValues(alpha: 0.72);
|
||||
|
||||
Color getContextMenuTitleColor() =>
|
||||
AppColor.gray424244.withValues(alpha: 0.9);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
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/labels/presentation/models/label_action_type.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
class PopupMenuItemLabelAction
|
||||
extends PopupMenuItemActionRequiredIcon<LabelActionType> {
|
||||
final AppLocalizations appLocalizations;
|
||||
final ImagePaths imagePaths;
|
||||
|
||||
PopupMenuItemLabelAction(
|
||||
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.getPopupMenuIconColor();
|
||||
|
||||
@override
|
||||
Color get actionNameColor => action.getPopupMenuTitleColor();
|
||||
|
||||
@override
|
||||
String get hoverIcon => imagePaths.icThumbsUp;
|
||||
}
|
||||
Reference in New Issue
Block a user