TF-3084 Handle drop image to identity editor for public asset

This commit is contained in:
DatDang
2024-08-15 09:20:45 +07:00
committed by Dat H. Pham
parent 791edb41c2
commit 0cb9ddf350
15 changed files with 422 additions and 183 deletions
@@ -385,7 +385,7 @@ class ComposerController extends BaseController with DragDropFileMixin implement
_subscriptionOnDragEnter = html.window.onDragEnter.listen((event) {
event.preventDefault();
if (_validateFilesTransfer(event.dataTransfer.types)) {
if (event.dataTransfer.types.validateFilesTransfer) {
mailboxDashBoardController.localFileDraggableAppState.value = DraggableAppState.active;
}
});
@@ -393,7 +393,7 @@ class ComposerController extends BaseController with DragDropFileMixin implement
_subscriptionOnDragOver = html.window.onDragOver.listen((event) {
event.preventDefault();
if (_validateFilesTransfer(event.dataTransfer.types)) {
if (event.dataTransfer.types.validateFilesTransfer) {
mailboxDashBoardController.localFileDraggableAppState.value = DraggableAppState.active;
}
});
@@ -401,7 +401,7 @@ class ComposerController extends BaseController with DragDropFileMixin implement
_subscriptionOnDragLeave = html.window.onDragLeave.listen((event) {
event.preventDefault();
if (_validateFilesTransfer(event.dataTransfer.types)) {
if (event.dataTransfer.types.validateFilesTransfer) {
mailboxDashBoardController.localFileDraggableAppState.value = DraggableAppState.inActive;
}
});
@@ -409,16 +409,12 @@ class ComposerController extends BaseController with DragDropFileMixin implement
_subscriptionOnDrop = html.window.onDrop.listen((event) {
event.preventDefault();
if (_validateFilesTransfer(event.dataTransfer.types)) {
if (event.dataTransfer.types.validateFilesTransfer) {
mailboxDashBoardController.localFileDraggableAppState.value = DraggableAppState.inActive;
}
});
}
bool _validateFilesTransfer(List<dynamic>? types) {
return types?.any((type) => type == 'Files') ?? false;
}
Future<void> _saveComposerCacheOnWebAction() async {
_autoCreateEmailTag();
@@ -2130,7 +2126,7 @@ class ComposerController extends BaseController with DragDropFileMixin implement
}
void handleOnDragEnterHtmlEditorWeb(List<dynamic>? types) {
if (_validateFilesTransfer(types)) {
if (types.validateFilesTransfer) {
mailboxDashBoardController.localFileDraggableAppState.value = DraggableAppState.active;
}
}
@@ -14,6 +14,7 @@ class LocalFileDropZoneWidget extends StatelessWidget {
final ImagePaths imagePaths;
final double? width;
final double? height;
final EdgeInsetsGeometry margin;
final OnLocalFileDropZoneListener? onLocalFileDropZoneListener;
const LocalFileDropZoneWidget({
@@ -21,6 +22,7 @@ class LocalFileDropZoneWidget extends StatelessWidget {
required this.imagePaths,
this.width,
this.height,
this.margin = DropZoneWidgetStyle.margin,
this.onLocalFileDropZoneListener
});
@@ -32,7 +34,7 @@ class LocalFileDropZoneWidget extends StatelessWidget {
width: width,
height: height,
child: Padding(
padding: DropZoneWidgetStyle.margin,
padding: margin,
child: DottedBorder(
borderType: BorderType.RRect,
radius: const Radius.circular(DropZoneWidgetStyle.radius),
@@ -52,7 +54,7 @@ class LocalFileDropZoneWidget extends StatelessWidget {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SvgPicture.asset(imagePaths.icDropZoneIcon),
Flexible(child: SvgPicture.asset(imagePaths.icDropZoneIcon)),
const SizedBox(height: DropZoneWidgetStyle.space),
Text(
AppLocalizations.of(context).dropFileHereToAttachThem,