TF-4075 Jump to attachments list position on web responsive mobile
This commit is contained in:
@@ -68,4 +68,8 @@ extension GetThreadDetailActionStatus on ThreadDetailController {
|
||||
bool get threadDetailCanPermanentlyDelete {
|
||||
return threadDetailIsTrashed || threadDetailIsSpam || threadDetailIsDraft;
|
||||
}
|
||||
|
||||
bool get isEmailExpandedHasAttachments {
|
||||
return currentEmailLoaded.value?.attachments.isNotEmpty == true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:model/email/read_actions.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
import 'package:tmail_ui_user/features/base/widget/popup_menu/popup_menu_item_action_widget.dart';
|
||||
import 'package:tmail_ui_user/features/destination_picker/presentation/model/destination_picker_arguments.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/action/email_ui_action.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/model/context_item_email_action.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/model/popup_menu_item_email_action.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_actions.dart';
|
||||
@@ -217,4 +218,10 @@ extension OnThreadDetailActionClick on ThreadDetailController {
|
||||
|
||||
return destinationMailbox.id;
|
||||
}
|
||||
|
||||
void onOpenAttachmentListAction() {
|
||||
mailboxDashBoardController.dispatchEmailUIAction(
|
||||
OpenAttachmentListAction(currentExpandedEmailId.value),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,9 @@ class ThreadDetailView extends GetWidget<ThreadDetailController> {
|
||||
threadDetailCanPermanentlyDelete: controller.threadDetailCanPermanentlyDelete,
|
||||
onThreadActionClick: controller.onThreadDetailActionClick,
|
||||
onThreadMoreActionClick: controller.onThreadDetailMoreActionClick,
|
||||
onOpenAttachmentListAction: controller.isEmailExpandedHasAttachments
|
||||
? controller.onOpenAttachmentListAction
|
||||
: null,
|
||||
optionWidgets: [
|
||||
if (controller.previousAvailable)
|
||||
TMailButtonWidget.fromIcon(
|
||||
@@ -135,8 +138,11 @@ class ThreadDetailView extends GetWidget<ThreadDetailController> {
|
||||
itemCount: manager.isThreadDetailEnabled
|
||||
? manager.availableThreadIds.length
|
||||
: manager.currentDisplayedEmails.length,
|
||||
itemBuilder: (context, index) {
|
||||
return SingleChildScrollView(child: threadBody);
|
||||
itemBuilder: (_, __) {
|
||||
return SingleChildScrollView(
|
||||
controller: controller.scrollController,
|
||||
child: threadBody,
|
||||
);
|
||||
},
|
||||
onPageChanged: controller.onThreadPageChanged,
|
||||
),
|
||||
|
||||
@@ -29,6 +29,7 @@ class ThreadDetailAppBar extends StatelessWidget {
|
||||
this.optionWidgets = const [],
|
||||
this.onThreadActionClick,
|
||||
this.onThreadMoreActionClick,
|
||||
this.onOpenAttachmentListAction,
|
||||
});
|
||||
|
||||
final ResponsiveUtils responsiveUtils;
|
||||
@@ -43,6 +44,7 @@ class ThreadDetailAppBar extends StatelessWidget {
|
||||
final List<Widget> optionWidgets;
|
||||
final OnThreadActionClick? onThreadActionClick;
|
||||
final OnThreadMoreActionClick? onThreadMoreActionClick;
|
||||
final VoidCallback? onOpenAttachmentListAction;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -114,6 +116,14 @@ class ThreadDetailAppBar extends StatelessWidget {
|
||||
childrenWidgets = [
|
||||
if (_supportDisplayMailboxNameTitle(context)) backButton,
|
||||
if (isRTL) ...optionWidgets.reversed else ...optionWidgets,
|
||||
if (onOpenAttachmentListAction != null)
|
||||
_ThreadDetailAppBarButton(
|
||||
icon: imagePaths.icAttachment,
|
||||
tooltipMessage: AppLocalizations.of(context).attachments,
|
||||
responsiveUtils: responsiveUtils,
|
||||
iconColor: EmailViewAppBarWidgetStyles.iconColor,
|
||||
onTapActionCallback: (_) => onOpenAttachmentListAction?.call(),
|
||||
),
|
||||
if (isThreadActionAvailable) ...listShortcutActions,
|
||||
];
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user