TF-3449 Add Mark as important option in context menu

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-02-07 14:54:44 +07:00
committed by Dat H. Pham
parent a91381da9e
commit 621756dca1
11 changed files with 175 additions and 8 deletions
@@ -1,27 +1,30 @@
import 'package:core/presentation/resources/image_paths.dart';
import 'package:core/presentation/views/button/tmail_button_widget.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:tmail_ui_user/features/composer/presentation/styles/mobile/tablet_bottom_bar_composer_widget_style.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
class TabletBottomBarComposerWidget extends StatelessWidget {
final ImagePaths imagePaths;
final bool hasReadReceipt;
final bool isMarkAsImportant;
final VoidCallback deleteComposerAction;
final VoidCallback saveToDraftAction;
final VoidCallback sendMessageAction;
final VoidCallback requestReadReceiptAction;
final VoidCallback toggleMarkAsImportantAction;
final _imagePaths = Get.find<ImagePaths>();
TabletBottomBarComposerWidget({
const TabletBottomBarComposerWidget({
super.key,
required this.imagePaths,
required this.hasReadReceipt,
required this.isMarkAsImportant,
required this.deleteComposerAction,
required this.saveToDraftAction,
required this.sendMessageAction,
required this.requestReadReceiptAction,
required this.toggleMarkAsImportantAction,
});
@override
@@ -33,7 +36,7 @@ class TabletBottomBarComposerWidget extends StatelessWidget {
children: [
const Spacer(),
TMailButtonWidget.fromIcon(
icon: _imagePaths.icDeleteMailbox,
icon: imagePaths.icDeleteMailbox,
borderRadius: TabletBottomBarComposerWidgetStyle.iconRadius,
padding: TabletBottomBarComposerWidgetStyle.iconPadding,
iconSize: TabletBottomBarComposerWidgetStyle.iconSize,
@@ -42,7 +45,21 @@ class TabletBottomBarComposerWidget extends StatelessWidget {
),
const SizedBox(width: TabletBottomBarComposerWidgetStyle.space),
TMailButtonWidget.fromIcon(
icon: _imagePaths.icReadReceipt,
icon: imagePaths.icMarkAsImportant,
borderRadius: TabletBottomBarComposerWidgetStyle.iconRadius,
padding: TabletBottomBarComposerWidgetStyle.iconPadding,
iconSize: TabletBottomBarComposerWidgetStyle.iconSize,
iconColor: isMarkAsImportant
? TabletBottomBarComposerWidgetStyle.selectedIconColor
: TabletBottomBarComposerWidgetStyle.iconColor,
tooltipMessage: isMarkAsImportant
? AppLocalizations.of(context).turnOffMarkAsImportant
: AppLocalizations.of(context).turnOnMarkAsImportant,
onTapActionCallback: toggleMarkAsImportantAction,
),
const SizedBox(width: TabletBottomBarComposerWidgetStyle.space),
TMailButtonWidget.fromIcon(
icon: imagePaths.icReadReceipt,
borderRadius: TabletBottomBarComposerWidgetStyle.iconRadius,
padding: TabletBottomBarComposerWidgetStyle.iconPadding,
iconSize: TabletBottomBarComposerWidgetStyle.iconSize,
@@ -56,7 +73,7 @@ class TabletBottomBarComposerWidget extends StatelessWidget {
),
const SizedBox(width: TabletBottomBarComposerWidgetStyle.space),
TMailButtonWidget.fromIcon(
icon: _imagePaths.icSaveToDraft,
icon: imagePaths.icSaveToDraft,
borderRadius: TabletBottomBarComposerWidgetStyle.iconRadius,
padding: TabletBottomBarComposerWidgetStyle.iconPadding,
iconSize: TabletBottomBarComposerWidgetStyle.iconSize,
@@ -66,7 +83,7 @@ class TabletBottomBarComposerWidget extends StatelessWidget {
const SizedBox(width: TabletBottomBarComposerWidgetStyle.sendButtonSpace),
TMailButtonWidget(
text: AppLocalizations.of(context).send,
icon: _imagePaths.icSend,
icon: imagePaths.icSend,
iconAlignment: TextDirection.rtl,
padding: TabletBottomBarComposerWidgetStyle.sendButtonPadding,
iconSize: TabletBottomBarComposerWidgetStyle.iconSize,
@@ -16,6 +16,7 @@ class BottomBarComposerWidget extends StatelessWidget {
final bool isEmailChanged;
final bool isFormattingOptionsEnabled;
final bool hasReadReceipt;
final bool isMarkAsImportant;
final CustomPopupMenuController menuMoreOptionController;
final VoidCallback openRichToolbarAction;
final VoidCallback attachFileAction;
@@ -26,6 +27,7 @@ class BottomBarComposerWidget extends StatelessWidget {
final VoidCallback toggleCodeViewAction;
final VoidCallback toggleRequestReadReceiptAction;
final VoidCallback printDraftAction;
final VoidCallback toggleMarkAsImportantAction;
const BottomBarComposerWidget({
super.key,
@@ -34,6 +36,7 @@ class BottomBarComposerWidget extends StatelessWidget {
required this.isEmailChanged,
required this.isFormattingOptionsEnabled,
required this.hasReadReceipt,
required this.isMarkAsImportant,
required this.menuMoreOptionController,
required this.openRichToolbarAction,
required this.attachFileAction,
@@ -44,6 +47,7 @@ class BottomBarComposerWidget extends StatelessWidget {
required this.toggleCodeViewAction,
required this.toggleRequestReadReceiptAction,
required this.printDraftAction,
required this.toggleMarkAsImportantAction,
});
@override
@@ -103,6 +107,19 @@ class BottomBarComposerWidget extends StatelessWidget {
tooltipMessage: AppLocalizations.of(context).more,
),
listButtonAction: [
PopupItemWidget(
iconAction: imagePaths.icMarkAsImportant,
nameAction: AppLocalizations.of(context).markAsImportant,
styleName: BottomBarComposerWidgetStyle.popupItemTextStyle,
padding: BottomBarComposerWidgetStyle.popupItemPadding,
colorIcon: BottomBarComposerWidgetStyle.iconColor,
selectedIcon: imagePaths.icFilterSelected,
isSelected: isMarkAsImportant,
onCallbackAction: () {
menuMoreOptionController.hideMenu();
toggleMarkAsImportantAction();
},
),
PopupItemWidget(
iconAction: imagePaths.icStyleCodeView,
nameAction: AppLocalizations.of(context).embedCode,
@@ -16,6 +16,7 @@ class MobileResponsiveAppBarComposerWidget extends StatelessWidget {
final bool isSendButtonEnabled;
final bool isFormattingOptionsEnabled;
final bool hasRequestReadReceipt;
final bool isMarkAsImportant;
final bool isEmailChanged;
final CustomPopupMenuController menuMoreOptionController;
final VoidCallback onCloseViewAction;
@@ -28,6 +29,7 @@ class MobileResponsiveAppBarComposerWidget extends StatelessWidget {
final VoidCallback printDraftAction;
final VoidCallback saveToDraftsAction;
final VoidCallback deleteComposerAction;
final VoidCallback toggleMarkAsImportantAction;
const MobileResponsiveAppBarComposerWidget({
super.key,
@@ -36,6 +38,7 @@ class MobileResponsiveAppBarComposerWidget extends StatelessWidget {
required this.isFormattingOptionsEnabled,
required this.isSendButtonEnabled,
required this.hasRequestReadReceipt,
required this.isMarkAsImportant,
required this.isEmailChanged,
required this.menuMoreOptionController,
required this.openRichToolbarAction,
@@ -48,6 +51,7 @@ class MobileResponsiveAppBarComposerWidget extends StatelessWidget {
required this.printDraftAction,
required this.saveToDraftsAction,
required this.deleteComposerAction,
required this.toggleMarkAsImportantAction,
});
@override
@@ -120,6 +124,19 @@ class MobileResponsiveAppBarComposerWidget extends StatelessWidget {
tooltipMessage: AppLocalizations.of(context).more,
),
listButtonAction: [
PopupItemWidget(
iconAction: imagePaths.icMarkAsImportant,
nameAction: AppLocalizations.of(context).markAsImportant,
styleName: MobileAppBarComposerWidgetStyle.popupItemTextStyle,
padding: MobileAppBarComposerWidgetStyle.popupItemPadding,
colorIcon: MobileAppBarComposerWidgetStyle.popupItemIconColor,
selectedIcon: imagePaths.icFilterSelected,
isSelected: isMarkAsImportant,
onCallbackAction: () {
menuMoreOptionController.hideMenu();
toggleMarkAsImportantAction();
},
),
PopupItemWidget(
iconAction: imagePaths.icStyleCodeView,
nameAction: AppLocalizations.of(context).embedCode,