TF-2261 Fix app bar email view broken
Signed-off-by: dab246 <tdvu@linagora.com> (cherry picked from commit 5e26472141f1f4562f4e7e75034c4566dcd9351b)
This commit is contained in:
@@ -55,12 +55,44 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
backgroundColor: responsiveUtils.isWebDesktop(context)
|
||||
? AppColor.colorBgDesktop
|
||||
: Colors.white,
|
||||
body: Row(children: [
|
||||
if (_supportVerticalDivider(context))
|
||||
const VerticalDivider(
|
||||
color: AppColor.lineItemListColor,
|
||||
width: 12),
|
||||
Expanded(child: SafeArea(
|
||||
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,
|
||||
@@ -77,6 +109,7 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
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,
|
||||
@@ -230,8 +263,7 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
}
|
||||
})
|
||||
)
|
||||
))
|
||||
])
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -253,16 +285,6 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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(
|
||||
|
||||
@@ -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()),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -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()),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user