diff --git a/lib/features/email/presentation/email_view.dart b/lib/features/email/presentation/email_view.dart index 94b75e1a2..c9c5235fc 100644 --- a/lib/features/email/presentation/email_view.dart +++ b/lib/features/email/presentation/email_view.dart @@ -53,185 +53,217 @@ class EmailView extends GetWidget { onWillPop: () => controller.backButtonPressedCallbackAction.call(context), child: Scaffold( backgroundColor: responsiveUtils.isWebDesktop(context) - ? AppColor.colorBgDesktop - : Colors.white, - body: Row(children: [ - if (_supportVerticalDivider(context)) - const VerticalDivider( - color: AppColor.lineItemListColor, - width: 12), - Expanded(child: SafeArea( - right: responsiveUtils.isLandscapeMobile(context), - left: responsiveUtils.isLandscapeMobile(context), - bottom: !PlatformInfo.isIOS, - child: Container( - clipBehavior: Clip.antiAlias, - decoration: responsiveUtils.isWebDesktop(context) - ? BoxDecoration( - borderRadius: BorderRadius.circular(20), - border: Border.all(color: AppColor.colorBorderBodyThread, width: 1), - color: Colors.white) - : const BoxDecoration(color: Colors.white), - margin: _getMarginEmailView(context), - child: Obx(() { - final currentEmail = controller.currentEmail; - if (currentEmail != null) { - return Column(children: [ - 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(() { - 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, - ); - } - }); - } - } - }), - ), - EmailViewBottomBarWidget( - key: const Key('email_view_button_bar'), - presentationEmail: currentEmail, - emailActionCallback: controller.pressEmailAction - ), - ]); + ? AppColor.colorBgDesktop + : Colors.white, + appBar: PlatformInfo.isIOS + ? PreferredSize( + preferredSize: const Size(double.infinity, 100), + child: Obx(() { + if (controller.currentEmail != null) { + return SafeArea( + top: false, + bottom: false, + child: EmailViewAppBarWidget( + key: const Key('email_view_app_bar_widget'), + presentationEmail: controller.currentEmail!, + mailboxContain: _getMailboxContain(controller.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) + ); + } + }, + ), + ); + } else { + return const SizedBox.shrink(); + } + }) + ) + : null, + body: SafeArea( + right: responsiveUtils.isLandscapeMobile(context), + left: responsiveUtils.isLandscapeMobile(context), + bottom: !PlatformInfo.isIOS, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: responsiveUtils.isWebDesktop(context) + ? BoxDecoration( + borderRadius: BorderRadius.circular(20), + border: Border.all(color: AppColor.colorBorderBodyThread, width: 1), + color: Colors.white) + : const BoxDecoration(color: Colors.white), + margin: _getMarginEmailView(context), + child: Obx(() { + final currentEmail = controller.currentEmail; + if (currentEmail != null) { + return Column(children: [ + if (!PlatformInfo.isIOS) + 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 EmailViewEmptyWidget(); + return const SizedBox.shrink(); } - }) - ) - )) - ]) + }), + Expanded( + child: Obx(() { + 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, + ); + } + }); + } + } + }), + ), + EmailViewBottomBarWidget( + key: const Key('email_view_button_bar'), + presentationEmail: currentEmail, + emailActionCallback: controller.pressEmailAction + ), + ]); + } else { + return const EmailViewEmptyWidget(); + } + }) + ) + ) ) ); } @@ -253,16 +285,6 @@ class EmailView extends GetWidget { } } - bool _supportVerticalDivider(BuildContext context) { - if (PlatformInfo.isWeb) { - return responsiveUtils.isTabletLarge(context); - } else { - return responsiveUtils.isLandscapeTablet(context) || - responsiveUtils.isDesktop(context) || - responsiveUtils.isTabletLarge(context); - } - } - PresentationMailbox? _getMailboxContain(PresentationEmail currentEmail) { return currentEmail.findMailboxContain(controller.mailboxDashBoardController.mapMailboxById); } diff --git a/lib/features/email/presentation/styles/email_view_app_bar_widget_styles.dart b/lib/features/email/presentation/styles/email_view_app_bar_widget_styles.dart index b5a4ff01b..ecf5cccb1 100644 --- a/lib/features/email/presentation/styles/email_view_app_bar_widget_styles.dart +++ b/lib/features/email/presentation/styles/email_view_app_bar_widget_styles.dart @@ -1,6 +1,7 @@ import 'package:core/presentation/extensions/color_extension.dart'; import 'package:core/presentation/utils/icon_utils.dart'; +import 'package:core/presentation/utils/responsive_utils.dart'; import 'package:flutter/material.dart'; class EmailViewAppBarWidgetStyles { @@ -11,7 +12,13 @@ class EmailViewAppBarWidgetStyles { static const double buttonIconSize = IconUtils.defaultIconSize; static const double deleteButtonIconSize = 20; static const double space = 5; - + static double? heightIOS(BuildContext context, ResponsiveUtils responsiveUtils) { + if (responsiveUtils.isLandscapeMobile(context)) { + return 60; + } else { + return null; + } + } static const Color bottomBorderColor = AppColor.colorDividerHorizontal; static const Color backgroundColor = Colors.white; static const Color emptyTrashButtonColor = AppColor.primaryColor; @@ -19,6 +26,15 @@ class EmailViewAppBarWidgetStyles { static const Color buttonActivatedColor = AppColor.primaryColor; static const Color buttonDeactivatedColor = AppColor.colorAttachmentIcon; - static const EdgeInsetsGeometry padding = EdgeInsets.symmetric(horizontal: 16); + static EdgeInsetsGeometry paddingIOS(BuildContext context, ResponsiveUtils responsiveUtils) { + if (responsiveUtils.isLandscapeMobile(context)) { + return EdgeInsets.zero; + } else if (responsiveUtils.isPortraitTablet(context) || responsiveUtils.isLandscapeTablet(context)) { + return const EdgeInsetsDirectional.only(top: 40, start: 16, end: 16, bottom: 4); + } else { + return const EdgeInsetsDirectional.only(top: 60, start: 16, end: 16, bottom: 4); + } + } + static const EdgeInsetsGeometry padding = EdgeInsetsDirectional.symmetric(horizontal: 16); static const EdgeInsetsGeometry buttonPadding = EdgeInsets.all(5); } \ No newline at end of file diff --git a/lib/features/email/presentation/widgets/email_view_app_bar_widget.dart b/lib/features/email/presentation/widgets/email_view_app_bar_widget.dart index fa36c0d58..a1e180689 100644 --- a/lib/features/email/presentation/widgets/email_view_app_bar_widget.dart +++ b/lib/features/email/presentation/widgets/email_view_app_bar_widget.dart @@ -42,8 +42,12 @@ class EmailViewAppBarWidget extends StatelessWidget { Widget build(BuildContext context) { return LayoutBuilder(builder: (context, constraints) { return Container( - height: EmailViewAppBarWidgetStyles.height, - padding: EmailViewAppBarWidgetStyles.padding, + height: PlatformInfo.isIOS + ? EmailViewAppBarWidgetStyles.heightIOS(context, _responsiveUtils) + : EmailViewAppBarWidgetStyles.height, + padding: PlatformInfo.isIOS + ? EmailViewAppBarWidgetStyles.paddingIOS(context, _responsiveUtils) + : EmailViewAppBarWidgetStyles.padding, decoration: const BoxDecoration( border: Border( bottom: BorderSide( diff --git a/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view.dart b/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view.dart index e1af34905..9f0a33655 100644 --- a/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view.dart +++ b/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view.dart @@ -25,6 +25,7 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView { SizedBox( width: ResponsiveUtils.defaultSizeLeftMenuMobile, child: _buildScaffoldHaveDrawer(body: ThreadView())), + const VerticalDivider(color: AppColor.lineItemListColor, width: 12), Expanded(child: EmailView()), ], ); @@ -62,6 +63,7 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView { SizedBox( width: ResponsiveUtils.defaultSizeLeftMenuMobile, child: _buildScaffoldHaveDrawer(body: const SendingQueueView())), + const VerticalDivider(color: AppColor.lineItemListColor, width: 12), Expanded(child: EmailView()), ], ); diff --git a/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart b/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart index e6c64dc44..948cd5306 100644 --- a/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart +++ b/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart @@ -184,6 +184,7 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView { SizedBox( width: ResponsiveUtils.defaultSizeLeftMenuMobile, child: ThreadView()), + const VerticalDivider(color: AppColor.lineItemListColor, width: 12), Expanded(child: EmailView()), ], ), @@ -196,6 +197,7 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView { SizedBox( width: ResponsiveUtils.defaultSizeLeftMenuMobile, child: ThreadView()), + const VerticalDivider(color: AppColor.lineItemListColor, width: 12), Expanded(child: EmailView()), ], ),