Split styles file for some widget in email view
(cherry picked from commit 75b11811e8036298fe11ab7e6613498b8aa349ea)
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/icon_utils.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/presentation/views/button/icon_button_web.dart';
|
||||
import 'package:core/presentation/views/button/tmail_button_widget.dart';
|
||||
import 'package:core/presentation/views/html_viewer/html_content_viewer_on_web_widget.dart';
|
||||
import 'package:core/presentation/views/html_viewer/html_content_viewer_widget.dart';
|
||||
import 'package:core/presentation/views/html_viewer/html_viewer_controller_for_web.dart';
|
||||
@@ -25,8 +24,8 @@ import 'package:tmail_ui_user/features/base/widget/popup_item_widget.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';
|
||||
import 'package:tmail_ui_user/features/email/presentation/styles/email_view_styles.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/app_bar_mail_widget_builder.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/bottom_bar_mail_widget_builder.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/email_view_app_bar_widget.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/email_view_bottom_bar_widget.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/calendar_event_action_banner_widget.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/calendar_event_detail_widget.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/calendar_event_information_widget.dart';
|
||||
@@ -74,21 +73,155 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
: const BoxDecoration(color: Colors.white),
|
||||
margin: _getMarginEmailView(context),
|
||||
child: Obx(() {
|
||||
if (controller.currentEmail != null) {
|
||||
final currentEmail = controller.currentEmail;
|
||||
if (currentEmail != null) {
|
||||
return Column(children: [
|
||||
_buildAppBar(context, controller.currentEmail!),
|
||||
_buildVacationNotificationMessage(context),
|
||||
const Divider(color: AppColor.colorDividerHorizontal, height: 1),
|
||||
Obx(() => EmailViewAppBarWidget(
|
||||
key: const Key('email_view_app_bar_widget'),
|
||||
presentationEmail: currentEmail,
|
||||
mailboxContain: _getMailboxContain(currentEmail),
|
||||
isSearchActivated: controller.mailboxDashBoardController.searchController.isSearchEmailRunning,
|
||||
onBackAction: () => controller.closeEmailView(context),
|
||||
onEmailActionClick: (email, action) => controller.handleEmailAction(context, email, action),
|
||||
onMoreActionClick: (email, position) {
|
||||
if (position == null) {
|
||||
controller.openContextMenuAction(
|
||||
context,
|
||||
_emailActionMoreActionTile(context, email)
|
||||
);
|
||||
} else {
|
||||
controller.openPopupMenuAction(
|
||||
context,
|
||||
position,
|
||||
_popupMenuEmailActionTile(context, email)
|
||||
);
|
||||
}
|
||||
},
|
||||
optionsWidget: PlatformInfo.isWeb && controller.emailSupervisorController.supportedPageView.isTrue
|
||||
? _buildNavigatorPageViewWidgets(context)
|
||||
: null,
|
||||
)),
|
||||
Obx(() {
|
||||
final vacation = controller.mailboxDashBoardController.vacationResponse.value;
|
||||
if (vacation?.vacationResponderIsValid == true &&
|
||||
(
|
||||
responsiveUtils.isMobile(context) ||
|
||||
responsiveUtils.isTablet(context) ||
|
||||
responsiveUtils.isLandscapeMobile(context)
|
||||
)
|
||||
) {
|
||||
return VacationNotificationMessageWidget(
|
||||
margin: const EdgeInsets.only(left: 12, right: 12, bottom: 5),
|
||||
vacationResponse: vacation!,
|
||||
actionGotoVacationSetting: controller.mailboxDashBoardController.goToVacationSetting,
|
||||
actionEndNow: controller.mailboxDashBoardController.disableVacationResponder
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
Expanded(
|
||||
child: Obx(() {
|
||||
return controller.emailSupervisorController.supportedPageView.isTrue
|
||||
? _buildMultipleEmailView(controller.emailSupervisorController.currentListEmail)
|
||||
: _buildSingleEmailView(context, controller.currentEmail!);
|
||||
if (controller.emailSupervisorController.supportedPageView.isTrue) {
|
||||
final currentListEmail = controller.emailSupervisorController.currentListEmail;
|
||||
return PageView.builder(
|
||||
physics: controller.emailSupervisorController.scrollPhysicsPageView.value,
|
||||
itemCount: currentListEmail.length,
|
||||
allowImplicitScrolling: true,
|
||||
controller: controller.emailSupervisorController.pageController,
|
||||
onPageChanged: controller.emailSupervisorController.onPageChanged,
|
||||
itemBuilder: (context, index) {
|
||||
final currentEmail = currentListEmail[index];
|
||||
if (PlatformInfo.isMobile) {
|
||||
return SingleChildScrollView(
|
||||
physics : const ClampingScrollPhysics(),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
color: Colors.white,
|
||||
child: Obx(() => _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
calendarEvent: controller.calendarEvent.value
|
||||
))
|
||||
)
|
||||
);
|
||||
} else {
|
||||
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(),
|
||||
)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
if (PlatformInfo.isMobile) {
|
||||
return SingleChildScrollView(
|
||||
physics : const ClampingScrollPhysics(),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
color: Colors.white,
|
||||
child: Obx(() => _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
calendarEvent: controller.calendarEvent.value
|
||||
))
|
||||
)
|
||||
);
|
||||
} else {
|
||||
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(),
|
||||
)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
),
|
||||
BottomBarMailWidgetBuilder(
|
||||
controller.currentEmail!,
|
||||
onPressEmailActionClick: controller.pressEmailAction
|
||||
EmailViewBottomBarWidget(
|
||||
key: const Key('email_view_button_bar'),
|
||||
presentationEmail: currentEmail,
|
||||
emailActionCallback: controller.pressEmailAction
|
||||
),
|
||||
]);
|
||||
} else {
|
||||
@@ -119,19 +252,6 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildMultipleEmailView(List<PresentationEmail> listEmails) {
|
||||
return Obx(
|
||||
() => PageView.builder(
|
||||
physics: controller.emailSupervisorController.scrollPhysicsPageView.value,
|
||||
itemCount: listEmails.length,
|
||||
allowImplicitScrolling: true,
|
||||
controller: controller.emailSupervisorController.pageController,
|
||||
onPageChanged: controller.emailSupervisorController.onPageChanged,
|
||||
itemBuilder: (context, index) => _buildSingleEmailView(context, listEmails[index])
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
bool _supportVerticalDivider(BuildContext context) {
|
||||
if (PlatformInfo.isWeb) {
|
||||
return responsiveUtils.isTabletLarge(context);
|
||||
@@ -142,259 +262,167 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildVacationNotificationMessage(BuildContext context) {
|
||||
return Obx(() {
|
||||
final vacation = controller.mailboxDashBoardController.vacationResponse.value;
|
||||
if (vacation?.vacationResponderIsValid == true &&
|
||||
(responsiveUtils.isMobile(context) ||
|
||||
responsiveUtils.isTablet(context) ||
|
||||
responsiveUtils.isLandscapeMobile(context))) {
|
||||
return VacationNotificationMessageWidget(
|
||||
margin: const EdgeInsets.only(left: 12, right: 12, bottom: 5),
|
||||
vacationResponse: vacation!,
|
||||
actionGotoVacationSetting: controller.mailboxDashBoardController.goToVacationSetting,
|
||||
actionEndNow: controller.mailboxDashBoardController.disableVacationResponder);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildAppBar(BuildContext context, PresentationEmail presentationEmail) {
|
||||
return Obx(() => AppBarMailWidgetBuilder(
|
||||
presentationEmail,
|
||||
mailboxContain: _getMailboxContain(presentationEmail),
|
||||
isSearchIsRunning: controller.mailboxDashBoardController.searchController.isSearchEmailRunning,
|
||||
onBackActionClick: () => controller.closeEmailView(context),
|
||||
onEmailActionClick: (email, action) =>
|
||||
controller.handleEmailAction(context, email, action),
|
||||
onMoreActionClick: (email, position) {
|
||||
if (position == null) {
|
||||
controller.openContextMenuAction(
|
||||
context,
|
||||
_emailActionMoreActionTile(context, email));
|
||||
} else {
|
||||
controller.openPopupMenuAction(
|
||||
context,
|
||||
position,
|
||||
_popupMenuEmailActionTile(context, email));
|
||||
}
|
||||
},
|
||||
optionsWidget: PlatformInfo.isWeb && controller.emailSupervisorController.supportedPageView.isTrue
|
||||
? _buildNavigatorPageViewWidgets(context)
|
||||
: null,
|
||||
));
|
||||
}
|
||||
|
||||
PresentationMailbox? _getMailboxContain(PresentationEmail currentEmail) {
|
||||
return currentEmail.findMailboxContain(controller.mailboxDashBoardController.mapMailboxById);
|
||||
}
|
||||
|
||||
List<Widget> _buildNavigatorPageViewWidgets(BuildContext context) {
|
||||
return [
|
||||
buildIconWeb(
|
||||
icon: SvgPicture.asset(
|
||||
DirectionUtils.isDirectionRTLByLanguage(context) ? imagePaths.icOlder : imagePaths.icNewer,
|
||||
colorFilter: controller.emailSupervisorController.nextEmailActivated
|
||||
? AppColor.primaryColor.asFilter()
|
||||
: AppColor.colorAttachmentIcon.asFilter(),
|
||||
width: IconUtils.defaultIconSize,
|
||||
height: IconUtils.defaultIconSize,
|
||||
fit: BoxFit.fill),
|
||||
tooltip: AppLocalizations.of(context).newer,
|
||||
onTap: controller.emailSupervisorController.moveToNextEmail),
|
||||
buildIconWeb(
|
||||
icon: SvgPicture.asset(
|
||||
DirectionUtils.isDirectionRTLByLanguage(context) ? imagePaths.icNewer : imagePaths.icOlder,
|
||||
width: IconUtils.defaultIconSize,
|
||||
height: IconUtils.defaultIconSize,
|
||||
colorFilter: controller.emailSupervisorController.previousEmailActivated
|
||||
? AppColor.primaryColor.asFilter()
|
||||
: AppColor.colorAttachmentIcon.asFilter(),
|
||||
fit: BoxFit.fill),
|
||||
tooltip: AppLocalizations.of(context).older,
|
||||
onTap: controller.emailSupervisorController.backToPreviousEmail),
|
||||
TMailButtonWidget.fromIcon(
|
||||
icon: DirectionUtils.isDirectionRTLByLanguage(context)
|
||||
? imagePaths.icOlder
|
||||
: imagePaths.icNewer,
|
||||
iconColor: controller.emailSupervisorController.nextEmailActivated
|
||||
? AppColor.primaryColor
|
||||
: AppColor.colorAttachmentIcon,
|
||||
iconSize: EmailViewStyles.pageViewIconSize,
|
||||
backgroundColor: Colors.transparent,
|
||||
padding: EmailViewStyles.pageViewButtonPadding,
|
||||
tooltipMessage: AppLocalizations.of(context).newer,
|
||||
onTapActionCallback: controller.emailSupervisorController.moveToNextEmail
|
||||
),
|
||||
TMailButtonWidget.fromIcon(
|
||||
icon: DirectionUtils.isDirectionRTLByLanguage(context)
|
||||
? imagePaths.icNewer
|
||||
: imagePaths.icOlder,
|
||||
iconColor: controller.emailSupervisorController.previousEmailActivated
|
||||
? AppColor.primaryColor
|
||||
: AppColor.colorAttachmentIcon,
|
||||
iconSize: EmailViewStyles.pageViewIconSize,
|
||||
padding: EmailViewStyles.pageViewButtonPadding,
|
||||
backgroundColor: Colors.transparent,
|
||||
tooltipMessage: AppLocalizations.of(context).older,
|
||||
onTapActionCallback: controller.emailSupervisorController.backToPreviousEmail
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Widget _buildSingleEmailView(BuildContext context, PresentationEmail presentationEmail) {
|
||||
if (PlatformInfo.isMobile) {
|
||||
return SingleChildScrollView(
|
||||
physics : const ClampingScrollPhysics(),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
color: Colors.white,
|
||||
child: Obx(() => _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: presentationEmail,
|
||||
calendarEvent: controller.calendarEvent.value
|
||||
))
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return Obx(() {
|
||||
final calendarEvent = controller.calendarEvent.value;
|
||||
if (presentationEmail.hasCalendarEvent && calendarEvent != null) {
|
||||
return SingleChildScrollView(
|
||||
physics : const ClampingScrollPhysics(),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
color: Colors.white,
|
||||
child: _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: presentationEmail,
|
||||
calendarEvent: calendarEvent,
|
||||
emailAddressSender: presentationEmail.listEmailAddressSender.getListAddress(),
|
||||
)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return _buildEmailMessage(context: context, presentationEmail: presentationEmail);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildEmailMessage({
|
||||
required BuildContext context,
|
||||
required PresentationEmail presentationEmail,
|
||||
CalendarEvent? calendarEvent,
|
||||
List<String>? emailAddressSender,
|
||||
}) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return Column(crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
EmailSubjectWidget(presentationEmail: presentationEmail),
|
||||
InformationSenderAndReceiverBuilder(
|
||||
controller: controller,
|
||||
emailSelected: presentationEmail,
|
||||
imagePaths: imagePaths,
|
||||
responsiveUtils: responsiveUtils,
|
||||
),
|
||||
Obx(() {
|
||||
final attachments = controller.attachments.listAttachmentsDisplayedOutSide;
|
||||
if (attachments.isNotEmpty) {
|
||||
return EmailAttachmentsWidget(
|
||||
attachments: attachments,
|
||||
onDragStarted: () {
|
||||
log('EmailView::_buildEmailMessage:onDragStarted:');
|
||||
controller.mailboxDashBoardController.enableDraggableApp();
|
||||
},
|
||||
onDragEnd: (details) {
|
||||
log('EmailView::_buildEmailMessage:onDragEnd:');
|
||||
controller.mailboxDashBoardController.disableDraggableApp();
|
||||
},
|
||||
downloadAttachmentAction: (attachment) {
|
||||
if (PlatformInfo.isWeb) {
|
||||
controller.downloadAttachmentForWeb(context, attachment);
|
||||
} else {
|
||||
controller.exportAttachment(context, attachment);
|
||||
}
|
||||
},
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
EmailSubjectWidget(presentationEmail: presentationEmail),
|
||||
InformationSenderAndReceiverBuilder(
|
||||
controller: controller,
|
||||
emailSelected: presentationEmail,
|
||||
imagePaths: imagePaths,
|
||||
responsiveUtils: responsiveUtils,
|
||||
),
|
||||
Obx(() {
|
||||
final attachments = controller.attachments.listAttachmentsDisplayedOutSide;
|
||||
if (attachments.isNotEmpty) {
|
||||
return EmailAttachmentsWidget(
|
||||
attachments: attachments,
|
||||
onDragStarted: () {
|
||||
log('EmailView::_buildEmailMessage:onDragStarted:');
|
||||
controller.mailboxDashBoardController.enableDraggableApp();
|
||||
},
|
||||
onDragEnd: (details) {
|
||||
log('EmailView::_buildEmailMessage:onDragEnd:');
|
||||
controller.mailboxDashBoardController.disableDraggableApp();
|
||||
},
|
||||
downloadAttachmentAction: (attachment) {
|
||||
if (PlatformInfo.isWeb) {
|
||||
controller.downloadAttachmentForWeb(context, attachment);
|
||||
} else {
|
||||
controller.exportAttachment(context, attachment);
|
||||
}
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
Obx(() => EmailViewLoadingBarWidget(
|
||||
viewState: controller.emailLoadedViewState.value
|
||||
)),
|
||||
if (calendarEvent != null)
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
CalendarEventInformationWidget(
|
||||
calendarEvent: calendarEvent,
|
||||
eventActions: controller.eventActions,
|
||||
onOpenComposerAction: controller.openNewComposerAction,
|
||||
onOpenNewTabAction: controller.openNewTabAction,
|
||||
),
|
||||
if (calendarEvent.getTitleEventAction(context, emailAddressSender ?? []).isNotEmpty)
|
||||
CalendarEventActionBannerWidget(
|
||||
calendarEvent: calendarEvent,
|
||||
listEmailAddressSender: emailAddressSender ?? []
|
||||
),
|
||||
CalendarEventDetailWidget(
|
||||
calendarEvent: calendarEvent,
|
||||
eventActions: controller.eventActions,
|
||||
onOpenComposerAction: controller.openNewComposerAction,
|
||||
onOpenNewTabAction: controller.openNewTabAction,
|
||||
),
|
||||
],
|
||||
)
|
||||
else if (presentationEmail.id == controller.currentEmail?.id)
|
||||
Obx(() {
|
||||
if (controller.emailContents.value != null) {
|
||||
final allEmailContents = controller.emailContents.value ?? '';
|
||||
|
||||
if (PlatformInfo.isWeb) {
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(start: 16, bottom: 16),
|
||||
child: LayoutBuilder(builder: (context, constraints) {
|
||||
return Obx(() {
|
||||
return Stack(
|
||||
children: [
|
||||
HtmlContentViewerOnWeb(
|
||||
widthContent: constraints.maxWidth,
|
||||
heightContent: constraints.maxHeight,
|
||||
contentHtml: allEmailContents,
|
||||
controller: HtmlViewerControllerForWeb(),
|
||||
mailtoDelegate: controller.openMailToLink,
|
||||
direction: AppUtils.getCurrentDirection(context),
|
||||
),
|
||||
if (controller.mailboxDashBoardController.isDraggableAppActive)
|
||||
PointerInterceptor(
|
||||
child: SizedBox(
|
||||
width: constraints.maxWidth,
|
||||
height: constraints.maxHeight,
|
||||
)
|
||||
)
|
||||
],
|
||||
);
|
||||
});
|
||||
}),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
Obx(() => EmailViewLoadingBarWidget(
|
||||
viewState: controller.emailLoadedViewState.value
|
||||
)),
|
||||
if (calendarEvent != null)
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
CalendarEventInformationWidget(
|
||||
calendarEvent: calendarEvent,
|
||||
eventActions: controller.eventActions,
|
||||
onOpenComposerAction: controller.openNewComposerAction,
|
||||
onOpenNewTabAction: controller.openNewTabAction,
|
||||
return Padding(
|
||||
padding: const EdgeInsetsDirectional.symmetric(
|
||||
vertical: EmailViewStyles.mobileContentVerticalMargin,
|
||||
horizontal: EmailViewStyles.mobileContentHorizontalMargin
|
||||
),
|
||||
if (calendarEvent.getTitleEventAction(context, emailAddressSender ?? []).isNotEmpty)
|
||||
CalendarEventActionBannerWidget(
|
||||
calendarEvent: calendarEvent,
|
||||
listEmailAddressSender: emailAddressSender ?? []
|
||||
),
|
||||
CalendarEventDetailWidget(
|
||||
calendarEvent: calendarEvent,
|
||||
eventActions: controller.eventActions,
|
||||
onOpenComposerAction: controller.openNewComposerAction,
|
||||
onOpenNewTabAction: controller.openNewTabAction,
|
||||
child: HtmlContentViewer(
|
||||
contentHtml: allEmailContents,
|
||||
mailtoDelegate: controller.openMailToLink,
|
||||
onScrollHorizontalEnd: controller.toggleScrollPhysicsPagerView,
|
||||
onWebViewLoaded: (isScrollPageViewActivated) {
|
||||
log('EmailView::_buildEmailContent(): isScrollPageViewActivated: $isScrollPageViewActivated');
|
||||
controller.emailSupervisorController.updateScrollPhysicPageView(isScrollPageViewActivated: isScrollPageViewActivated);
|
||||
},
|
||||
direction: AppUtils.getCurrentDirection(context),
|
||||
),
|
||||
],
|
||||
)
|
||||
else
|
||||
_buildEmailContentOnHtmlViewer(context, constraints, presentationEmail)
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildEmailContentOnHtmlViewer(
|
||||
BuildContext context,
|
||||
BoxConstraints constraints,
|
||||
PresentationEmail email
|
||||
) {
|
||||
if (email.id != controller.currentEmail?.id) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return Obx(() {
|
||||
if (controller.emailContents.value != null) {
|
||||
final allEmailContents = controller.emailContents.value;
|
||||
|
||||
if (PlatformInfo.isWeb) {
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(start: 16, bottom: 16),
|
||||
child: Obx(() {
|
||||
return Stack(
|
||||
children: [
|
||||
HtmlContentViewerOnWeb(
|
||||
widthContent: constraints.maxWidth,
|
||||
heightContent: responsiveUtils.getSizeScreenHeight(context),
|
||||
contentHtml: allEmailContents ?? "",
|
||||
controller: HtmlViewerControllerForWeb(),
|
||||
mailtoDelegate: (uri) => controller.openMailToLink(uri),
|
||||
direction: AppUtils.getCurrentDirection(context),
|
||||
),
|
||||
if (controller.mailboxDashBoardController.isDraggableAppActive)
|
||||
PointerInterceptor(
|
||||
child: SizedBox(
|
||||
width: constraints.maxWidth,
|
||||
height: constraints.maxHeight,
|
||||
)
|
||||
)
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Padding(
|
||||
padding: const EdgeInsetsDirectional.symmetric(
|
||||
vertical: EmailViewStyles.mobileContentVerticalMargin,
|
||||
horizontal: EmailViewStyles.mobileContentHorizontalMargin
|
||||
),
|
||||
child: HtmlContentViewer(
|
||||
heightContent: responsiveUtils.getSizeScreenHeight(context),
|
||||
contentHtml: allEmailContents ?? "",
|
||||
mailtoDelegate: (uri) async => controller.openMailToLink(uri),
|
||||
onScrollHorizontalEnd: controller.toggleScrollPhysicsPagerView,
|
||||
onWebViewLoaded: (isScrollPageViewActivated) {
|
||||
log('EmailView::_buildEmailContent(): isScrollPageViewActivated: $isScrollPageViewActivated');
|
||||
controller.emailSupervisorController.updateScrollPhysicPageView(isScrollPageViewActivated: isScrollPageViewActivated);
|
||||
},
|
||||
direction: AppUtils.getCurrentDirection(context),
|
||||
),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
})
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _emailActionMoreActionTile(BuildContext context, PresentationEmail email) {
|
||||
|
||||
Reference in New Issue
Block a user