Skip to content

Commit

Permalink
Add more semantic entries for composer actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tddang-linagora committed Sep 16, 2024
1 parent c40dbf1 commit afa8752
Show file tree
Hide file tree
Showing 7 changed files with 338 additions and 228 deletions.
8 changes: 8 additions & 0 deletions lib/features/base/key_values/composer_key_values.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ class ComposerKeyValues {
static const String fromEmailSelectorOption = 'tmail_composer_from_email_selector_option';
static const String composerCcField = 'tmail_composer_cc_field';
static const String composerBccField = 'tmail_composer_bcc_field';
static const String openTextFormattingMenuButton = 'tmail_composer_open_text_formatting_menu_button';
static const String pickAttachmentButton = 'tmail_composer_pick_attachment_button';
static const String pickInlineImageButton = 'tmail_composer_pick_inline_image_button';
static const String toggleCodeViewButton = 'tmail_composer_toggle_code_view_button';
static const String deleteComposedEmailButton = 'tmail_composer_delete_composed_email_button';
static const String toggleReadRecipientsButton = 'tmail_composer_toggle_read_recipients_button';
static const String saveAsDraftButton = 'tmail_composer_save_as_draft_button';
static const String openMobileMoreOptionsButton = 'tmail_composer_open_mobile_more_options_button';
}
74 changes: 43 additions & 31 deletions lib/features/composer/presentation/composer_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -436,47 +436,59 @@ class ComposerView extends GetWidget<ComposerController> {
PopupMenuItem(
enabled: false,
padding: EdgeInsets.zero,
child: PopupItemWidget(
controller.imagePaths.icReadReceipt,
AppLocalizations.of(context).requestReadReceipt,
styleName: ComposerStyle.popupItemTextStyle,
padding: ComposerStyle.popupItemPadding,
colorIcon: ComposerStyle.popupItemIconColor,
selectedIcon: controller.imagePaths.icFilterSelected,
isSelected: controller.hasRequestReadReceipt.value,
onCallbackAction: () {
popBack();
controller.toggleRequestReadReceipt(context);
}
child: Semantics(
container: true,
identifier: ComposerKeyValues.toggleReadRecipientsButton,
child: PopupItemWidget(
controller.imagePaths.icReadReceipt,
AppLocalizations.of(context).requestReadReceipt,
styleName: ComposerStyle.popupItemTextStyle,
padding: ComposerStyle.popupItemPadding,
colorIcon: ComposerStyle.popupItemIconColor,
selectedIcon: controller.imagePaths.icFilterSelected,
isSelected: controller.hasRequestReadReceipt.value,
onCallbackAction: () {
popBack();
controller.toggleRequestReadReceipt(context);
}
),
)
),
PopupMenuItem(
enabled: false,
padding: EdgeInsets.zero,
child: PopupItemWidget(
controller.imagePaths.icSaveToDraft,
AppLocalizations.of(context).saveAsDraft,
colorIcon: ComposerStyle.popupItemIconColor,
styleName: ComposerStyle.popupItemTextStyle,
padding: ComposerStyle.popupItemPadding,
onCallbackAction: () {
popBack();
controller.handleClickSaveAsDraftsButton(context);
}
child: Semantics(
container: true,
identifier: ComposerKeyValues.saveAsDraftButton,
child: PopupItemWidget(
controller.imagePaths.icSaveToDraft,
AppLocalizations.of(context).saveAsDraft,
colorIcon: ComposerStyle.popupItemIconColor,
styleName: ComposerStyle.popupItemTextStyle,
padding: ComposerStyle.popupItemPadding,
onCallbackAction: () {
popBack();
controller.handleClickSaveAsDraftsButton(context);
}
),
)
),
PopupMenuItem(
enabled: false,
padding: EdgeInsets.zero,
child: PopupItemWidget(
controller.imagePaths.icDeleteMailbox,
AppLocalizations.of(context).delete,
styleName: ComposerStyle.popupItemTextStyle,
padding: ComposerStyle.popupItemPadding,
onCallbackAction: () {
popBack();
controller.handleClickDeleteComposer(context);
},
child: Semantics(
container: true,
identifier: ComposerKeyValues.deleteComposedEmailButton,
child: PopupItemWidget(
controller.imagePaths.icDeleteMailbox,
AppLocalizations.of(context).delete,
styleName: ComposerStyle.popupItemTextStyle,
padding: ComposerStyle.popupItemPadding,
onCallbackAction: () {
popBack();
controller.handleClickDeleteComposer(context);
},
),
)
),
];
Expand Down
102 changes: 59 additions & 43 deletions lib/features/composer/presentation/composer_view_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -817,64 +817,80 @@ class ComposerView extends GetWidget<ComposerController> {
PopupMenuItem(
enabled: false,
padding: EdgeInsets.zero,
child: PopupItemWidget(
controller.imagePaths.icStyleCodeView,
AppLocalizations.of(context).embedCode,
styleName: ComposerStyle.popupItemTextStyle,
colorIcon: ComposerStyle.popupItemIconColor,
padding: ComposerStyle.popupItemPadding,
selectedIcon: controller.imagePaths.icFilterSelected,
isSelected: controller.richTextWebController?.codeViewEnabled,
onCallbackAction: () {
popBack();
controller.richTextWebController?.toggleCodeView();
}
child: Semantics(
container: true,
identifier: ComposerKeyValues.toggleCodeViewButton,
child: PopupItemWidget(
controller.imagePaths.icStyleCodeView,
AppLocalizations.of(context).embedCode,
styleName: ComposerStyle.popupItemTextStyle,
colorIcon: ComposerStyle.popupItemIconColor,
padding: ComposerStyle.popupItemPadding,
selectedIcon: controller.imagePaths.icFilterSelected,
isSelected: controller.richTextWebController?.codeViewEnabled,
onCallbackAction: () {
popBack();
controller.richTextWebController?.toggleCodeView();
}
),
)
),
PopupMenuItem(
enabled: false,
padding: EdgeInsets.zero,
child: PopupItemWidget(
controller.imagePaths.icReadReceipt,
AppLocalizations.of(context).requestReadReceipt,
styleName: ComposerStyle.popupItemTextStyle,
padding: ComposerStyle.popupItemPadding,
colorIcon: ComposerStyle.popupItemIconColor,
selectedIcon: controller.imagePaths.icFilterSelected,
isSelected: controller.hasRequestReadReceipt.value,
onCallbackAction: () {
popBack();
controller.toggleRequestReadReceipt(context);
}
child: Semantics(
container: true,
identifier: ComposerKeyValues.toggleReadRecipientsButton,
child: PopupItemWidget(
controller.imagePaths.icReadReceipt,
AppLocalizations.of(context).requestReadReceipt,
styleName: ComposerStyle.popupItemTextStyle,
padding: ComposerStyle.popupItemPadding,
colorIcon: ComposerStyle.popupItemIconColor,
selectedIcon: controller.imagePaths.icFilterSelected,
isSelected: controller.hasRequestReadReceipt.value,
onCallbackAction: () {
popBack();
controller.toggleRequestReadReceipt(context);
}
),
)
),
PopupMenuItem(
enabled: false,
padding: EdgeInsets.zero,
child: PopupItemWidget(
controller.imagePaths.icSaveToDraft,
AppLocalizations.of(context).saveAsDraft,
colorIcon: ComposerStyle.popupItemIconColor,
styleName: ComposerStyle.popupItemTextStyle,
padding: ComposerStyle.popupItemPadding,
onCallbackAction: () {
popBack();
controller.handleClickSaveAsDraftsButton(context);
}
child: Semantics(
container: true,
identifier: ComposerKeyValues.saveAsDraftButton,
child: PopupItemWidget(
controller.imagePaths.icSaveToDraft,
AppLocalizations.of(context).saveAsDraft,
colorIcon: ComposerStyle.popupItemIconColor,
styleName: ComposerStyle.popupItemTextStyle,
padding: ComposerStyle.popupItemPadding,
onCallbackAction: () {
popBack();
controller.handleClickSaveAsDraftsButton(context);
}
),
)
),
PopupMenuItem(
enabled: false,
padding: EdgeInsets.zero,
child: PopupItemWidget(
controller.imagePaths.icDeleteMailbox,
AppLocalizations.of(context).delete,
styleName: ComposerStyle.popupItemTextStyle,
padding: ComposerStyle.popupItemPadding,
onCallbackAction: () {
popBack();
controller.handleClickDeleteComposer(context);
},
child: Semantics(
container: true,
identifier: ComposerKeyValues.deleteComposedEmailButton,
child: PopupItemWidget(
controller.imagePaths.icDeleteMailbox,
AppLocalizations.of(context).delete,
styleName: ComposerStyle.popupItemTextStyle,
padding: ComposerStyle.popupItemPadding,
onCallbackAction: () {
popBack();
controller.handleClickDeleteComposer(context);
},
),
)
),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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/base/key_values/composer_key_values.dart';
import 'package:tmail_ui_user/features/composer/presentation/styles/mobile_app_bar_composer_widget_style.dart';
import 'package:tmail_ui_user/features/composer/presentation/widgets/web/mobile_responsive_app_bar_composer_widget.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
Expand Down Expand Up @@ -48,56 +49,76 @@ class AppBarComposerWidget extends StatelessWidget {
onTapActionCallback: onCloseViewAction
),
const Spacer(),
TMailButtonWidget.fromIcon(
icon: _imagePaths.icRichToolbar,
iconColor: MobileAppBarComposerWidgetStyle.iconColor,
backgroundColor: Colors.transparent,
iconSize: MobileAppBarComposerWidgetStyle.richTextIconSize,
padding: MobileAppBarComposerWidgetStyle.richTextIconPadding,
tooltipMessage: AppLocalizations.of(context).formattingOptions,
onTapActionCallback: openRichToolbarAction,
Semantics(
container: true,
identifier: ComposerKeyValues.openTextFormattingMenuButton,
child: TMailButtonWidget.fromIcon(
icon: _imagePaths.icRichToolbar,
iconColor: MobileAppBarComposerWidgetStyle.iconColor,
backgroundColor: Colors.transparent,
iconSize: MobileAppBarComposerWidgetStyle.richTextIconSize,
padding: MobileAppBarComposerWidgetStyle.richTextIconPadding,
tooltipMessage: AppLocalizations.of(context).formattingOptions,
onTapActionCallback: openRichToolbarAction,
),
),
if (isNetworkConnectionAvailable)
...[
const SizedBox(width: MobileAppBarComposerWidgetStyle.space),
TMailButtonWidget.fromIcon(
icon: _imagePaths.icAttachFile,
iconColor: MobileAppBarComposerWidgetStyle.iconColor,
backgroundColor: Colors.transparent,
iconSize: MobileAppBarComposerWidgetStyle.iconSize,
tooltipMessage: AppLocalizations.of(context).attach_file,
onTapActionCallback: attachFileAction,
Semantics(
container: true,
identifier: ComposerKeyValues.pickAttachmentButton,
child: TMailButtonWidget.fromIcon(
icon: _imagePaths.icAttachFile,
iconColor: MobileAppBarComposerWidgetStyle.iconColor,
backgroundColor: Colors.transparent,
iconSize: MobileAppBarComposerWidgetStyle.iconSize,
tooltipMessage: AppLocalizations.of(context).attach_file,
onTapActionCallback: attachFileAction,
),
),
const SizedBox(width: MobileAppBarComposerWidgetStyle.space),
TMailButtonWidget.fromIcon(
icon: _imagePaths.icInsertImage,
iconColor: MobileAppBarComposerWidgetStyle.iconColor,
backgroundColor: Colors.transparent,
iconSize: MobileAppBarComposerWidgetStyle.iconSize,
tooltipMessage: AppLocalizations.of(context).insertImage,
onTapActionCallback: insertImageAction,
Semantics(
container: true,
identifier: ComposerKeyValues.pickInlineImageButton,
child: TMailButtonWidget.fromIcon(
icon: _imagePaths.icInsertImage,
iconColor: MobileAppBarComposerWidgetStyle.iconColor,
backgroundColor: Colors.transparent,
iconSize: MobileAppBarComposerWidgetStyle.iconSize,
tooltipMessage: AppLocalizations.of(context).insertImage,
onTapActionCallback: insertImageAction,
),
),
const SizedBox(width: MobileAppBarComposerWidgetStyle.space),
],
TMailButtonWidget.fromIcon(
icon: isSendButtonEnabled
? _imagePaths.icSendMobile
: _imagePaths.icSendDisable,
backgroundColor: Colors.transparent,
padding: MobileAppBarComposerWidgetStyle.iconPadding,
iconSize: MobileAppBarComposerWidgetStyle.sendButtonIconSize,
tooltipMessage: AppLocalizations.of(context).send,
onTapActionCallback: sendMessageAction,
Semantics(
container: true,
identifier: ComposerKeyValues.composerSendButton,
child: TMailButtonWidget.fromIcon(
icon: isSendButtonEnabled
? _imagePaths.icSendMobile
: _imagePaths.icSendDisable,
backgroundColor: Colors.transparent,
padding: MobileAppBarComposerWidgetStyle.iconPadding,
iconSize: MobileAppBarComposerWidgetStyle.sendButtonIconSize,
tooltipMessage: AppLocalizations.of(context).send,
onTapActionCallback: sendMessageAction,
),
),
const SizedBox(width: MobileAppBarComposerWidgetStyle.space),
TMailButtonWidget.fromIcon(
icon: _imagePaths.icMore,
iconColor: MobileAppBarComposerWidgetStyle.iconColor,
backgroundColor: Colors.transparent,
padding: MobileAppBarComposerWidgetStyle.iconPadding,
iconSize: MobileAppBarComposerWidgetStyle.iconSize,
tooltipMessage: AppLocalizations.of(context).more,
onTapActionAtPositionCallback: openContextMenuAction,
Semantics(
container: true,
identifier: ComposerKeyValues.openMobileMoreOptionsButton,
child: TMailButtonWidget.fromIcon(
icon: _imagePaths.icMore,
iconColor: MobileAppBarComposerWidgetStyle.iconColor,
backgroundColor: Colors.transparent,
padding: MobileAppBarComposerWidgetStyle.iconPadding,
iconSize: MobileAppBarComposerWidgetStyle.iconSize,
tooltipMessage: AppLocalizations.of(context).more,
onTapActionAtPositionCallback: openContextMenuAction,
),
),
],
),
Expand Down
Loading

0 comments on commit afa8752

Please sign in to comment.