TF-381 Navigation route ThreadView to EmailView on browser
This commit is contained in:
@@ -192,20 +192,16 @@ class EmailController extends BaseController {
|
||||
|
||||
if (success is MarkAsEmailReadSuccess
|
||||
&& success.readActions == ReadActions.markAsUnread
|
||||
&& Get.context != null
|
||||
&& !responsiveUtils.isDesktop(Get.context!)
|
||||
&& !responsiveUtils.isTabletLarge(Get.context!)) {
|
||||
backToThreadView();
|
||||
&& currentContext != null) {
|
||||
backToThreadView(currentContext!);
|
||||
}
|
||||
}
|
||||
|
||||
void _markAsEmailReadFailure(Failure failure) {
|
||||
if (failure is MarkAsEmailReadFailure
|
||||
&& failure.readActions == ReadActions.markAsUnread
|
||||
&& Get.context != null
|
||||
&& !responsiveUtils.isDesktop(Get.context!)
|
||||
&& !responsiveUtils.isTabletLarge(Get.context!)) {
|
||||
backToThreadView();
|
||||
&& currentContext != null) {
|
||||
backToThreadView(currentContext!);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,8 +250,8 @@ class EmailController extends BaseController {
|
||||
}
|
||||
|
||||
void _downloadAttachmentsFailure(Failure failure) {
|
||||
if (Get.context != null) {
|
||||
_appToast.showErrorToast(AppLocalizations.of(Get.context!).attachment_download_failed);
|
||||
if (currentContext != null) {
|
||||
_appToast.showErrorToast(AppLocalizations.of(currentContext!).attachment_download_failed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,11 +361,11 @@ class EmailController extends BaseController {
|
||||
|
||||
if (success is MoveToMailboxSuccess
|
||||
&& success.moveAction == MoveAction.moveTo
|
||||
&& Get.context != null && Get.overlayContext != null) {
|
||||
&& currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithAction(
|
||||
Get.overlayContext!,
|
||||
AppLocalizations.of(Get.context!).moved_to_mailbox(success.destinationPath ?? ''),
|
||||
AppLocalizations.of(Get.context!).undo_action,
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).moved_to_mailbox(success.destinationPath ?? ''),
|
||||
AppLocalizations.of(currentContext!).undo_action,
|
||||
() {
|
||||
final newMoveRequest = MoveRequest(
|
||||
[success.emailId],
|
||||
@@ -499,11 +495,15 @@ class EmailController extends BaseController {
|
||||
popBack();
|
||||
}
|
||||
|
||||
void backToThreadView() {
|
||||
void backToThreadView(BuildContext context) {
|
||||
attachmentsExpandMode.value = ExpandMode.COLLAPSE;
|
||||
emailAddressExpandMode.value = ExpandMode.COLLAPSE;
|
||||
isDisplayFullEmailAddress.value = false;
|
||||
popBack();
|
||||
if (responsiveUtils.isDesktop(context) || responsiveUtils.isTabletLarge(context)) {
|
||||
mailboxDashBoardController.dispatchRoute(AppRoutes.THREAD);
|
||||
} else {
|
||||
popBack();
|
||||
}
|
||||
}
|
||||
|
||||
void pressEmailAction(EmailActionType emailActionType) {
|
||||
|
||||
@@ -75,7 +75,7 @@ class EmailView extends GetView {
|
||||
responsiveUtils,
|
||||
emailController.currentEmail,
|
||||
emailController.currentMailbox)
|
||||
..onBackActionClick(() => emailController.backToThreadView())
|
||||
..onBackActionClick(() => emailController.backToThreadView(context))
|
||||
..addOnEmailActionClick((email, action) => emailController.handleEmailAction(context, email, action))
|
||||
..addOnMoreActionClick((email, position) => responsiveUtils.isMobileDevice(context)
|
||||
? emailController.openMoreMenuEmailAction(
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:tmail_ui_user/main/routes/app_routes.dart';
|
||||
import 'package:tmail_ui_user/features/setting/presentation/model/app_setting.dart';
|
||||
import 'package:tmail_ui_user/features/setting/presentation/model/reading_pane.dart';
|
||||
|
||||
typedef OnBackActionClick = void Function();
|
||||
typedef OnEmailActionClick = void Function(PresentationEmail, EmailActionType);
|
||||
@@ -53,9 +53,9 @@ class AppBarMailWidgetBuilder {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
if (_conditionShowBackButton())
|
||||
if (_conditionShow(_context))
|
||||
_buildBackButton(),
|
||||
if (_conditionShowBackButton())
|
||||
if (_conditionShow(_context))
|
||||
Expanded(child: _buildMailboxName()),
|
||||
if (_presentationEmail != null) _buildListOptionButton(),
|
||||
]
|
||||
@@ -64,13 +64,12 @@ class AppBarMailWidgetBuilder {
|
||||
);
|
||||
}
|
||||
|
||||
bool _conditionShowBackButton() {
|
||||
if (Get.currentRoute == AppRoutes.MAILBOX_DASHBOARD) {
|
||||
return !_responsiveUtils.isDesktop(_context) && !_responsiveUtils.isTabletLarge(_context);
|
||||
} else if (Get.currentRoute == AppRoutes.EMAIL) {
|
||||
return _responsiveUtils.isMobileDevice(_context) || _responsiveUtils.isTablet(_context);
|
||||
} else {
|
||||
bool _conditionShow(BuildContext context) {
|
||||
if (AppSetting.readingPane == ReadingPane.rightOfInbox
|
||||
&& (_responsiveUtils.isDesktop(context) || _responsiveUtils.isTabletLarge(context))) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user