TF-2628 Integrate view attachment feature with UI
This commit is contained in:
@@ -1453,7 +1453,14 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
} else {
|
||||
exportAttachment(context, attachment);
|
||||
}
|
||||
}
|
||||
},
|
||||
onViewAttachmentFileAction: (attachment) {
|
||||
if (PlatformInfo.isWeb) {
|
||||
viewAttachmentForWeb(attachment);
|
||||
} else {
|
||||
exportAttachment(context, attachment);
|
||||
}
|
||||
},
|
||||
)
|
||||
),
|
||||
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
||||
|
||||
@@ -345,7 +345,14 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
},
|
||||
downloadAttachmentAction: (attachment) {
|
||||
if (PlatformInfo.isWeb) {
|
||||
controller.downloadAttachmentForWeb(context, attachment);
|
||||
controller.downloadAttachmentForWeb(attachment);
|
||||
} else {
|
||||
controller.exportAttachment(context, attachment);
|
||||
}
|
||||
},
|
||||
viewAttachmentAction: (attachment) {
|
||||
if (PlatformInfo.isWeb) {
|
||||
controller.viewAttachmentForWeb(attachment);
|
||||
} else {
|
||||
controller.exportAttachment(context, attachment);
|
||||
}
|
||||
|
||||
@@ -12,11 +12,13 @@ import 'package:tmail_ui_user/features/email/presentation/extensions/attachment_
|
||||
import 'package:tmail_ui_user/features/email/presentation/styles/attachment/attachment_item_widget_style.dart';
|
||||
|
||||
typedef OnDownloadAttachmentFileActionClick = void Function(Attachment attachment);
|
||||
typedef OnViewAttachmentFileActionClick = void Function(Attachment attachment);
|
||||
|
||||
class AttachmentItemWidget extends StatelessWidget {
|
||||
|
||||
final Attachment attachment;
|
||||
final OnDownloadAttachmentFileActionClick? downloadAttachmentAction;
|
||||
final OnViewAttachmentFileActionClick? viewAttachmentAction;
|
||||
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
@@ -25,6 +27,7 @@ class AttachmentItemWidget extends StatelessWidget {
|
||||
Key? key,
|
||||
required this.attachment,
|
||||
this.downloadAttachmentAction,
|
||||
this.viewAttachmentAction,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@@ -32,7 +35,7 @@ class AttachmentItemWidget extends StatelessWidget {
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () => downloadAttachmentAction?.call(attachment),
|
||||
onTap: () => viewAttachmentAction?.call(attachment),
|
||||
customBorder: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(AttachmentItemWidgetStyle.radius))
|
||||
),
|
||||
|
||||
+3
@@ -17,6 +17,7 @@ class AttachmentListDialogBodyBuilder extends StatelessWidget {
|
||||
final double? heightDialog;
|
||||
final OnDownloadAllButtonAction? onDownloadAllButtonAction;
|
||||
final OnDownloadAttachmentFileAction? onDownloadAttachmentFileAction;
|
||||
final OnViewAttachmentFileAction? onViewAttachmentFileAction;
|
||||
final OnCancelButtonAction? onCancelButtonAction;
|
||||
final OnCloseButtonAction? onCloseButtonAction;
|
||||
|
||||
@@ -30,6 +31,7 @@ class AttachmentListDialogBodyBuilder extends StatelessWidget {
|
||||
this.heightDialog,
|
||||
this.onDownloadAllButtonAction,
|
||||
this.onDownloadAttachmentFileAction,
|
||||
this.onViewAttachmentFileAction,
|
||||
this.onCancelButtonAction,
|
||||
this.onCloseButtonAction
|
||||
});
|
||||
@@ -108,6 +110,7 @@ class AttachmentListDialogBodyBuilder extends StatelessWidget {
|
||||
return AttachmentListItemWidget(
|
||||
attachment: attachments[index],
|
||||
downloadAttachmentAction: onDownloadAttachmentFileAction,
|
||||
viewAttachmentAction: onViewAttachmentFileAction,
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) {
|
||||
|
||||
+4
@@ -6,6 +6,7 @@ import 'package:tmail_ui_user/features/email/presentation/styles/attachment/atta
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/attachment_list/attachment_list_dialog_body_builder.dart';
|
||||
|
||||
typedef OnDownloadAttachmentFileAction = void Function(Attachment attachment);
|
||||
typedef OnViewAttachmentFileAction = void Function(Attachment attachment);
|
||||
typedef OnDownloadAllButtonAction = void Function();
|
||||
typedef OnCancelButtonAction = void Function();
|
||||
typedef OnCloseButtonAction = void Function();
|
||||
@@ -22,6 +23,7 @@ class AttachmentListDialogBuilder extends StatelessWidget {
|
||||
final double? heightDialog;
|
||||
final OnDownloadAllButtonAction? onDownloadAllButtonAction;
|
||||
final OnDownloadAttachmentFileAction? onDownloadAttachmentFileAction;
|
||||
final OnViewAttachmentFileAction? onViewAttachmentFileAction;
|
||||
final OnCancelButtonAction? onCancelButtonAction;
|
||||
final OnCloseButtonAction? onCloseButtonAction;
|
||||
|
||||
@@ -36,6 +38,7 @@ class AttachmentListDialogBuilder extends StatelessWidget {
|
||||
this.heightDialog,
|
||||
this.onDownloadAllButtonAction,
|
||||
this.onDownloadAttachmentFileAction,
|
||||
this.onViewAttachmentFileAction,
|
||||
this.onCancelButtonAction,
|
||||
this.onCloseButtonAction,
|
||||
}) : super(key: key);
|
||||
@@ -59,6 +62,7 @@ class AttachmentListDialogBuilder extends StatelessWidget {
|
||||
scrollController: scrollController,
|
||||
onDownloadAllButtonAction: onDownloadAllButtonAction,
|
||||
onDownloadAttachmentFileAction: onDownloadAttachmentFileAction,
|
||||
onViewAttachmentFileAction: onViewAttachmentFileAction,
|
||||
onCancelButtonAction: onCancelButtonAction,
|
||||
onCloseButtonAction: onCloseButtonAction,
|
||||
),
|
||||
|
||||
+4
-1
@@ -10,6 +10,7 @@ import 'package:get/get.dart';
|
||||
import 'package:model/email/attachment.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/extensions/attachment_extension.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/styles/attachment/attachment_list_item_widget_styles.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/attachment_item_widget.dart';
|
||||
|
||||
typedef OnDownloadAttachmentFileActionClick = void Function(Attachment attachment);
|
||||
|
||||
@@ -17,6 +18,7 @@ class AttachmentListItemWidget extends StatelessWidget {
|
||||
|
||||
final Attachment attachment;
|
||||
final OnDownloadAttachmentFileActionClick? downloadAttachmentAction;
|
||||
final OnViewAttachmentFileActionClick? viewAttachmentAction;
|
||||
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
|
||||
@@ -24,6 +26,7 @@ class AttachmentListItemWidget extends StatelessWidget {
|
||||
Key? key,
|
||||
required this.attachment,
|
||||
this.downloadAttachmentAction,
|
||||
this.viewAttachmentAction,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@@ -31,7 +34,7 @@ class AttachmentListItemWidget extends StatelessWidget {
|
||||
return Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
onTap: () => downloadAttachmentAction?.call(attachment),
|
||||
onTap: () => viewAttachmentAction?.call(attachment),
|
||||
child: Padding(
|
||||
padding: AttachmentListItemWidgetStyle.contentPadding,
|
||||
child: Row(
|
||||
|
||||
@@ -13,6 +13,7 @@ class DraggableAttachmentItemWidget extends StatelessWidget{
|
||||
final OnDragAttachmentStarted? onDragStarted;
|
||||
final OnDragAttachmentEnd? onDragEnd;
|
||||
final OnDownloadAttachmentFileActionClick? downloadAttachmentAction;
|
||||
final OnViewAttachmentFileActionClick? viewAttachmentAction;
|
||||
|
||||
const DraggableAttachmentItemWidget({
|
||||
Key? key,
|
||||
@@ -20,6 +21,7 @@ class DraggableAttachmentItemWidget extends StatelessWidget{
|
||||
this.onDragStarted,
|
||||
this.onDragEnd,
|
||||
this.downloadAttachmentAction,
|
||||
this.viewAttachmentAction,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@@ -31,7 +33,8 @@ class DraggableAttachmentItemWidget extends StatelessWidget{
|
||||
onDragEnd: onDragEnd,
|
||||
child: AttachmentItemWidget(
|
||||
attachment: attachment,
|
||||
downloadAttachmentAction: downloadAttachmentAction
|
||||
downloadAttachmentAction: downloadAttachmentAction,
|
||||
viewAttachmentAction: viewAttachmentAction,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ class EmailAttachmentsWidget extends StatelessWidget {
|
||||
final OnDragAttachmentStarted? onDragStarted;
|
||||
final OnDragAttachmentEnd? onDragEnd;
|
||||
final OnDownloadAttachmentFileActionClick? downloadAttachmentAction;
|
||||
final OnViewAttachmentFileActionClick? viewAttachmentAction;
|
||||
final ResponsiveUtils responsiveUtils;
|
||||
final ImagePaths imagePaths;
|
||||
final OnTapActionCallback? onTapShowAllAttachmentFile;
|
||||
@@ -32,6 +33,7 @@ class EmailAttachmentsWidget extends StatelessWidget {
|
||||
this.onDragStarted,
|
||||
this.onDragEnd,
|
||||
this.downloadAttachmentAction,
|
||||
this.viewAttachmentAction,
|
||||
this.onTapShowAllAttachmentFile,
|
||||
});
|
||||
|
||||
@@ -106,7 +108,8 @@ class EmailAttachmentsWidget extends StatelessWidget {
|
||||
attachment: attachment,
|
||||
onDragStarted: onDragStarted,
|
||||
onDragEnd: onDragEnd,
|
||||
downloadAttachmentAction: downloadAttachmentAction
|
||||
downloadAttachmentAction: downloadAttachmentAction,
|
||||
viewAttachmentAction: viewAttachmentAction,
|
||||
);
|
||||
} else {
|
||||
return AttachmentItemWidget(
|
||||
|
||||
Reference in New Issue
Block a user