TF-4075 Jump to attachments list position on web responsive mobile
This commit is contained in:
@@ -81,6 +81,15 @@ class CollapseEmailInThreadDetailAction extends EmailUIAction {
|
||||
|
||||
final EmailId emailId;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [emailId];
|
||||
}
|
||||
|
||||
class OpenAttachmentListAction extends EmailUIAction {
|
||||
OpenAttachmentListAction(this.emailId);
|
||||
|
||||
final EmailId? emailId;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [emailId];
|
||||
}
|
||||
@@ -189,10 +189,11 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
final isEmailContentClipped = RxBool(false);
|
||||
final attendanceStatus = Rxn<AttendanceStatus>();
|
||||
final htmlContentViewKey = GlobalKey<HtmlContentViewState>();
|
||||
final attachmentListKey = GlobalKey();
|
||||
|
||||
Identity? _identitySelected;
|
||||
ButtonState? _printEmailButtonState;
|
||||
GlobalKey? attachmentListKey;
|
||||
|
||||
final obxListeners = <Worker>[];
|
||||
late final EmailActionReactor emailActionReactor;
|
||||
|
||||
@@ -249,6 +250,9 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
if (PlatformInfo.isWeb) {
|
||||
attachmentListKey = GlobalKey();
|
||||
}
|
||||
_threadDetailController = getBinding<ThreadDetailController>();
|
||||
_injectCalendarEventBindings(session, accountId);
|
||||
_registerObxStreamListener();
|
||||
|
||||
@@ -450,6 +450,9 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
return Obx(() {
|
||||
if (controller.attachments.isNotEmpty) {
|
||||
return EmailAttachmentsWidget(
|
||||
key: PlatformInfo.isWeb && controller.responsiveUtils.isMobile(context)
|
||||
? controller.attachmentListKey
|
||||
: null,
|
||||
responsiveUtils: controller.responsiveUtils,
|
||||
attachments: controller.attachments,
|
||||
imagePaths: controller.imagePaths,
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import 'package:core/presentation/extensions/scroll_controller_extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/controller/single_email_controller.dart';
|
||||
|
||||
extension HandleOpenAttachmentListExtension on SingleEmailController {
|
||||
void jumpToAttachmentList() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (attachmentListKey == null) return;
|
||||
|
||||
threadDetailController?.scrollController?.scrollToWidgetTop(
|
||||
key: attachmentListKey!,
|
||||
padding: 70,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user