From 6469776a7b6ec41a777c9be2fc4302d7f55e6a1a Mon Sep 17 00:00:00 2001 From: dab246 Date: Mon, 27 Nov 2023 15:10:21 +0700 Subject: [PATCH] TF-2351 Apply scrollbar for email event calendar view Signed-off-by: dab246 (cherry picked from commit 7e1207dba5fb801fd31a42ffa161824793ad68c4) --- .../controller/single_email_controller.dart | 2 + .../email/presentation/email_view.dart | 67 ++++++++++++------- 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/lib/features/email/presentation/controller/single_email_controller.dart b/lib/features/email/presentation/controller/single_email_controller.dart index f52900739..234ead2fc 100644 --- a/lib/features/email/presentation/controller/single_email_controller.dart +++ b/lib/features/email/presentation/controller/single_email_controller.dart @@ -95,6 +95,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin { final emailSupervisorController = Get.find(); final _downloadManager = Get.find(); final _attachmentListScrollController = ScrollController(); + final emailContentScrollController = ScrollController(); final GetEmailContentInteractor _getEmailContentInteractor; final MarkAsEmailReadInteractor _markAsEmailReadInteractor; @@ -154,6 +155,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin { void onClose() { _downloadProgressStateController.close(); _attachmentListScrollController.dispose(); + emailContentScrollController.dispose(); super.onClose(); } diff --git a/lib/features/email/presentation/email_view.dart b/lib/features/email/presentation/email_view.dart index b18f68bc4..523708e44 100644 --- a/lib/features/email/presentation/email_view.dart +++ b/lib/features/email/presentation/email_view.dart @@ -16,6 +16,7 @@ import 'package:model/extensions/presentation_mailbox_extension.dart'; import 'package:model/mailbox/presentation_mailbox.dart'; import 'package:pointer_interceptor/pointer_interceptor.dart'; import 'package:tmail_ui_user/features/base/widget/popup_item_widget.dart'; +import 'package:tmail_ui_user/features/base/widget/scrollbar_list_view.dart'; import 'package:tmail_ui_user/features/composer/presentation/extensions/email_action_type_extension.dart'; import 'package:tmail_ui_user/features/email/presentation/controller/single_email_controller.dart'; import 'package:tmail_ui_user/features/email/presentation/extensions/calendar_event_extension.dart'; @@ -153,19 +154,26 @@ class EmailView extends GetWidget { return Obx(() { final calendarEvent = controller.calendarEvent.value; if (currentEmail.hasCalendarEvent && calendarEvent != null) { - return SingleChildScrollView( - physics : const ClampingScrollPhysics(), - child: Container( - width: double.infinity, - alignment: Alignment.center, - color: Colors.white, - child: _buildEmailMessage( - context: context, - presentationEmail: currentEmail, - calendarEvent: calendarEvent, - emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(), - ) - ) + return Padding( + padding: const EdgeInsetsDirectional.symmetric(horizontal: 4), + child: ScrollbarListView( + scrollController: controller.emailContentScrollController, + child: SingleChildScrollView( + physics : const ClampingScrollPhysics(), + controller: controller.emailContentScrollController, + child: Container( + width: double.infinity, + alignment: Alignment.center, + color: Colors.white, + child: _buildEmailMessage( + context: context, + presentationEmail: currentEmail, + calendarEvent: calendarEvent, + emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(), + ) + ) + ), + ), ); } else { return _buildEmailMessage( @@ -196,19 +204,26 @@ class EmailView extends GetWidget { return Obx(() { final calendarEvent = controller.calendarEvent.value; if (currentEmail.hasCalendarEvent && calendarEvent != null) { - return SingleChildScrollView( - physics : const ClampingScrollPhysics(), - child: Container( - width: double.infinity, - alignment: Alignment.center, - color: Colors.white, - child: _buildEmailMessage( - context: context, - presentationEmail: currentEmail, - calendarEvent: calendarEvent, - emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(), - ) - ) + return Padding( + padding: const EdgeInsetsDirectional.symmetric(horizontal: 4), + child: ScrollbarListView( + scrollController: controller.emailContentScrollController, + child: SingleChildScrollView( + physics : const ClampingScrollPhysics(), + controller: controller.emailContentScrollController, + child: Container( + width: double.infinity, + alignment: Alignment.center, + color: Colors.white, + child: _buildEmailMessage( + context: context, + presentationEmail: currentEmail, + calendarEvent: calendarEvent, + emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(), + ) + ) + ), + ), ); } else { return _buildEmailMessage(