TF-2172 Display DropZone view when drag active
(cherry picked from commit 13a88cc956190dd3ebb47033cd1f95e28b6694af)
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:file_picker/file_picker.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:model/email/prefix_email_address.dart';
|
import 'package:model/email/prefix_email_address.dart';
|
||||||
|
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
||||||
import 'package:tmail_ui_user/features/base/widget/popup_item_widget.dart';
|
import 'package:tmail_ui_user/features/base/widget/popup_item_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/composer/presentation/composer_controller.dart';
|
import 'package:tmail_ui_user/features/composer/presentation/composer_controller.dart';
|
||||||
import 'package:tmail_ui_user/features/composer/presentation/model/prefix_recipient_state.dart';
|
import 'package:tmail_ui_user/features/composer/presentation/model/prefix_recipient_state.dart';
|
||||||
@@ -18,6 +19,7 @@ import 'package:tmail_ui_user/features/composer/presentation/widgets/insert_imag
|
|||||||
import 'package:tmail_ui_user/features/composer/presentation/widgets/web/desktop_app_bar_composer_widget.dart';
|
import 'package:tmail_ui_user/features/composer/presentation/widgets/web/desktop_app_bar_composer_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/composer/presentation/widgets/web/attachment_composer_widget.dart';
|
import 'package:tmail_ui_user/features/composer/presentation/widgets/web/attachment_composer_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/composer/presentation/widgets/web/bottom_bar_composer_widget.dart';
|
import 'package:tmail_ui_user/features/composer/presentation/widgets/web/bottom_bar_composer_widget.dart';
|
||||||
|
import 'package:tmail_ui_user/features/composer/presentation/widgets/web/drop_zone_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/composer/presentation/widgets/web/mobile_responsive_app_bar_composer_widget.dart';
|
import 'package:tmail_ui_user/features/composer/presentation/widgets/web/mobile_responsive_app_bar_composer_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/composer/presentation/widgets/recipient_composer_widget.dart';
|
import 'package:tmail_ui_user/features/composer/presentation/widgets/recipient_composer_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/composer/presentation/widgets/subject_composer_widget.dart';
|
import 'package:tmail_ui_user/features/composer/presentation/widgets/subject_composer_widget.dart';
|
||||||
@@ -336,29 +338,42 @@ class ComposerView extends GetWidget<ComposerController> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: ComposerStyle.desktopEditorPadding,
|
padding: ComposerStyle.desktopEditorPadding,
|
||||||
child: Obx(() => WebEditorView(
|
child: Obx(() {
|
||||||
editorController: controller.richTextWebController.editorController,
|
return Stack(
|
||||||
arguments: controller.composerArguments.value,
|
children: [
|
||||||
contentViewState: controller.emailContentsViewState.value,
|
WebEditorView(
|
||||||
currentWebContent: controller.textEditorWeb,
|
editorController: controller.richTextWebController.editorController,
|
||||||
onInitial: controller.handleInitHtmlEditorWeb,
|
arguments: controller.composerArguments.value,
|
||||||
onChangeContent: controller.onChangeTextEditorWeb,
|
contentViewState: controller.emailContentsViewState.value,
|
||||||
onFocus: controller.handleOnFocusHtmlEditorWeb,
|
currentWebContent: controller.textEditorWeb,
|
||||||
onUnFocus: controller.handleOnUnFocusHtmlEditorWeb,
|
onInitial: controller.handleInitHtmlEditorWeb,
|
||||||
onMouseDown: controller.handleOnMouseDownHtmlEditorWeb,
|
onChangeContent: controller.onChangeTextEditorWeb,
|
||||||
onEditorSettings: controller.richTextWebController.onEditorSettingsChange,
|
onFocus: controller.handleOnFocusHtmlEditorWeb,
|
||||||
onImageUploadSuccessAction: (fileUpload) => controller.handleImageUploadSuccess(context, fileUpload),
|
onUnFocus: controller.handleOnUnFocusHtmlEditorWeb,
|
||||||
onImageUploadFailureAction: (fileUpload, base64Str, uploadError) {
|
onMouseDown: controller.handleOnMouseDownHtmlEditorWeb,
|
||||||
return controller.handleImageUploadFailure(
|
onEditorSettings: controller.richTextWebController.onEditorSettingsChange,
|
||||||
context: context,
|
onImageUploadSuccessAction: (fileUpload) => controller.handleImageUploadSuccess(context, fileUpload),
|
||||||
uploadError: uploadError,
|
onImageUploadFailureAction: (fileUpload, base64Str, uploadError) {
|
||||||
fileUpload: fileUpload,
|
return controller.handleImageUploadFailure(
|
||||||
base64Str: base64Str,
|
context: context,
|
||||||
);
|
uploadError: uploadError,
|
||||||
},
|
fileUpload: fileUpload,
|
||||||
width: constraints.maxWidth,
|
base64Str: base64Str,
|
||||||
height: constraints.maxHeight,
|
);
|
||||||
)),
|
},
|
||||||
|
width: constraints.maxWidth,
|
||||||
|
height: constraints.maxHeight,
|
||||||
|
),
|
||||||
|
if (controller.mailboxDashBoardController.isDraggableAppActive)
|
||||||
|
PointerInterceptor(
|
||||||
|
child: DropZoneWidget(
|
||||||
|
width: constraints.maxWidth,
|
||||||
|
height: constraints.maxHeight,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Obx(() {
|
Obx(() {
|
||||||
|
|||||||
@@ -278,7 +278,15 @@ class EmailView extends GetWidget<SingleEmailController> {
|
|||||||
if (attachments.isNotEmpty) {
|
if (attachments.isNotEmpty) {
|
||||||
return EmailAttachmentsWidget(
|
return EmailAttachmentsWidget(
|
||||||
attachments: attachments,
|
attachments: attachments,
|
||||||
onDownloadAttachmentActionCallback: (context, attachment) {
|
onDragStarted: () {
|
||||||
|
log('EmailView::_buildEmailMessage:onDragStarted:');
|
||||||
|
controller.mailboxDashBoardController.enableDraggableApp();
|
||||||
|
},
|
||||||
|
onDragEnd: (details) {
|
||||||
|
log('EmailView::_buildEmailMessage:onDragEnd:');
|
||||||
|
controller.mailboxDashBoardController.disableDraggableApp();
|
||||||
|
},
|
||||||
|
downloadAttachmentAction: (attachment) {
|
||||||
if (PlatformInfo.isWeb) {
|
if (PlatformInfo.isWeb) {
|
||||||
controller.downloadAttachmentForWeb(context, attachment);
|
controller.downloadAttachmentForWeb(context, attachment);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+12
@@ -72,6 +72,7 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions
|
|||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/composer_overlay_state.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/composer_overlay_state.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/dashboard_routes.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/dashboard_routes.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/download/download_task_state.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/download/download_task_state.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/draggable_app_state.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/refresh_action_view_event.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/refresh_action_view_event.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/search/email_receive_time_type.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/search/email_receive_time_type.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/search/quick_search_filter.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/search/quick_search_filter.dart';
|
||||||
@@ -194,6 +195,7 @@ class MailboxDashBoardController extends ReloadableController {
|
|||||||
final searchMailboxActivated = RxBool(false);
|
final searchMailboxActivated = RxBool(false);
|
||||||
final listSendingEmails = RxList<SendingEmail>();
|
final listSendingEmails = RxList<SendingEmail>();
|
||||||
final refreshingMailboxState = Rx<Either<Failure, Success>>(Right(UIState.idle));
|
final refreshingMailboxState = Rx<Either<Failure, Success>>(Right(UIState.idle));
|
||||||
|
final draggableAppState = Rxn<DraggableAppState>();
|
||||||
|
|
||||||
Session? sessionCurrent;
|
Session? sessionCurrent;
|
||||||
Map<Role, MailboxId> mapDefaultMailboxIdByRole = {};
|
Map<Role, MailboxId> mapDefaultMailboxIdByRole = {};
|
||||||
@@ -2104,6 +2106,16 @@ class MailboxDashBoardController extends ReloadableController {
|
|||||||
|
|
||||||
openMailboxAction(inboxPresentation);
|
openMailboxAction(inboxPresentation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool get isDraggableAppActive => draggableAppState.value == DraggableAppState.active;
|
||||||
|
|
||||||
|
void enableDraggableApp() {
|
||||||
|
draggableAppState.value = DraggableAppState.active;
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableDraggableApp() {
|
||||||
|
draggableAppState.value = DraggableAppState.inActive;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
enum DraggableAppState {
|
||||||
|
active,
|
||||||
|
inActive
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user