TF-2172 Handle add attachment from drop zone
(cherry picked from commit a9c2b8d7a187e0149ca078cd55d5ce0e09964b52)
This commit is contained in:
@@ -2022,4 +2022,9 @@ class ComposerController extends BaseController {
|
|||||||
|
|
||||||
_updateStatusEmailSendButton();
|
_updateStatusEmailSendButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addAttachmentFromDropZone(Attachment attachment) {
|
||||||
|
log('ComposerController::addAttachmentFromDropZone: $attachment');
|
||||||
|
uploadController.initializeUploadAttachments([attachment]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -369,6 +369,7 @@ class ComposerView extends GetWidget<ComposerController> {
|
|||||||
child: DropZoneWidget(
|
child: DropZoneWidget(
|
||||||
width: constraints.maxWidth,
|
width: constraints.maxWidth,
|
||||||
height: constraints.maxHeight,
|
height: constraints.maxHeight,
|
||||||
|
addAttachmentFromDropZone: controller.addAttachmentFromDropZone,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
import 'package:core/presentation/resources/image_paths.dart';
|
import 'package:core/presentation/resources/image_paths.dart';
|
||||||
import 'package:core/utils/app_logger.dart';
|
|
||||||
import 'package:dotted_border/dotted_border.dart';
|
import 'package:dotted_border/dotted_border.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
@@ -9,12 +8,20 @@ import 'package:model/email/attachment.dart';
|
|||||||
import 'package:tmail_ui_user/features/composer/presentation/styles/web/drop_zone_widget_style.dart';
|
import 'package:tmail_ui_user/features/composer/presentation/styles/web/drop_zone_widget_style.dart';
|
||||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
|
typedef OnAddAttachmentFromDropZone = Function(Attachment attachment);
|
||||||
|
|
||||||
class DropZoneWidget extends StatefulWidget {
|
class DropZoneWidget extends StatefulWidget {
|
||||||
|
|
||||||
final double? width;
|
final double? width;
|
||||||
final double? height;
|
final double? height;
|
||||||
|
final OnAddAttachmentFromDropZone? addAttachmentFromDropZone;
|
||||||
|
|
||||||
const DropZoneWidget({super.key, this.width, this.height});
|
const DropZoneWidget({
|
||||||
|
super.key,
|
||||||
|
this.width,
|
||||||
|
this.height,
|
||||||
|
this.addAttachmentFromDropZone
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<DropZoneWidget> createState() => _DropZoneWidgetState();
|
State<DropZoneWidget> createState() => _DropZoneWidgetState();
|
||||||
@@ -69,9 +76,7 @@ class _DropZoneWidgetState extends State<DropZoneWidget> {
|
|||||||
return SizedBox(width: widget.width, height: widget.height);
|
return SizedBox(width: widget.width, height: widget.height);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onAccept: (attachment) {
|
onAccept: widget.addAttachmentFromDropZone,
|
||||||
log('_DropZoneWidgetState::build:onAccept: $attachment');
|
|
||||||
},
|
|
||||||
onLeave: (attachment) {
|
onLeave: (attachment) {
|
||||||
if (_isDragging) {
|
if (_isDragging) {
|
||||||
setState(() => _isDragging = false);
|
setState(() => _isDragging = false);
|
||||||
|
|||||||
Reference in New Issue
Block a user