TF-682 Support landscape tablet for ThreadView and EmailView
This commit is contained in:
@@ -74,7 +74,7 @@ class ButtonBuilder {
|
|||||||
_paddingIcon = paddingIcon;
|
_paddingIcon = paddingIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
void text(String text, {required bool isVertical}) {
|
void text(String? text, {required bool isVertical}) {
|
||||||
_text = text;
|
_text = text;
|
||||||
_isVertical = isVertical;
|
_isVertical = isVertical;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,26 +44,26 @@ class DestinationPickerView extends GetWidget<DestinationPickerController>
|
|||||||
responsiveUtils: _responsiveUtils,
|
responsiveUtils: _responsiveUtils,
|
||||||
mobile: SizedBox(child: _buildBodyMailboxLocation(context, actions), width: double.infinity),
|
mobile: SizedBox(child: _buildBodyMailboxLocation(context, actions), width: double.infinity),
|
||||||
landscapeMobile: Row(children: [
|
landscapeMobile: Row(children: [
|
||||||
SizedBox(child: _buildBodyMailboxLocation(context, actions), width: _responsiveUtils.defaultSizeDrawer),
|
SizedBox(child: _buildBodyMailboxLocation(context, actions), width: ResponsiveUtils.defaultSizeDrawer),
|
||||||
Expanded(child: Container(color: Colors.transparent)),
|
Expanded(child: Container(color: Colors.transparent)),
|
||||||
]),
|
]),
|
||||||
tablet: Row(children: [
|
tablet: Row(children: [
|
||||||
Expanded(child: Container(color: Colors.transparent)),
|
Expanded(child: Container(color: Colors.transparent)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
child: _buildBodyMailboxLocation(context, actions),
|
child: _buildBodyMailboxLocation(context, actions),
|
||||||
width: _responsiveUtils.getSizeScreenWidth(context) - _responsiveUtils.defaultSizeDrawer),
|
width: _responsiveUtils.getSizeScreenWidth(context) - ResponsiveUtils.defaultSizeDrawer),
|
||||||
]),
|
]),
|
||||||
tabletLarge: Row(children: [
|
tabletLarge: Row(children: [
|
||||||
Expanded(child: Container(color: Colors.transparent)),
|
Expanded(child: Container(color: Colors.transparent)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
child: _buildBodyMailboxLocation(context, actions),
|
child: _buildBodyMailboxLocation(context, actions),
|
||||||
width: _responsiveUtils.getSizeScreenWidth(context) - _responsiveUtils.defaultSizeDrawer),
|
width: _responsiveUtils.getSizeScreenWidth(context) - ResponsiveUtils.defaultSizeDrawer),
|
||||||
]),
|
]),
|
||||||
desktop: Row(children: [
|
desktop: Row(children: [
|
||||||
Expanded(child: Container(color: Colors.transparent)),
|
Expanded(child: Container(color: Colors.transparent)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
child: _buildBodyMailboxLocation(context, actions),
|
child: _buildBodyMailboxLocation(context, actions),
|
||||||
width: _responsiveUtils.getSizeScreenWidth(context) - _responsiveUtils.defaultSizeDrawer),
|
width: _responsiveUtils.getSizeScreenWidth(context) - ResponsiveUtils.defaultSizeDrawer),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -79,19 +79,19 @@ class DestinationPickerView extends GetWidget<DestinationPickerController>
|
|||||||
responsiveUtils: _responsiveUtils,
|
responsiveUtils: _responsiveUtils,
|
||||||
mobile: SizedBox(child: _buildBodyMailboxLocation(context, actions), width: double.infinity),
|
mobile: SizedBox(child: _buildBodyMailboxLocation(context, actions), width: double.infinity),
|
||||||
landscapeMobile: Row(children: [
|
landscapeMobile: Row(children: [
|
||||||
SizedBox(child: _buildBodyMailboxLocation(context, actions), width: _responsiveUtils.defaultSizeDrawer),
|
SizedBox(child: _buildBodyMailboxLocation(context, actions), width: ResponsiveUtils.defaultSizeDrawer),
|
||||||
Expanded(child: Container(color: Colors.transparent)),
|
Expanded(child: Container(color: Colors.transparent)),
|
||||||
]),
|
]),
|
||||||
tablet: Row(children: [
|
tablet: Row(children: [
|
||||||
SizedBox(child: _buildBodyMailboxLocation(context, actions), width: _responsiveUtils.defaultSizeDrawer),
|
SizedBox(child: _buildBodyMailboxLocation(context, actions), width: ResponsiveUtils.defaultSizeDrawer),
|
||||||
Expanded(child: Container(color: Colors.transparent)),
|
Expanded(child: Container(color: Colors.transparent)),
|
||||||
]),
|
]),
|
||||||
tabletLarge: Row(children: [
|
tabletLarge: Row(children: [
|
||||||
SizedBox(child: _buildBodyMailboxLocation(context, actions), width: _responsiveUtils.defaultSizeDrawer),
|
SizedBox(child: _buildBodyMailboxLocation(context, actions), width: ResponsiveUtils.defaultSizeDrawer),
|
||||||
Expanded(child: Container(color: Colors.transparent)),
|
Expanded(child: Container(color: Colors.transparent)),
|
||||||
]),
|
]),
|
||||||
desktop: Row(children: [
|
desktop: Row(children: [
|
||||||
SizedBox(child: _buildBodyMailboxLocation(context, actions), width: _responsiveUtils.defaultSizeDrawer),
|
SizedBox(child: _buildBodyMailboxLocation(context, actions), width: ResponsiveUtils.defaultSizeDrawer),
|
||||||
Expanded(child: Container(color: Colors.transparent)),
|
Expanded(child: Container(color: Colors.transparent)),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ class EmailController extends BaseController {
|
|||||||
if (success is MarkAsEmailReadSuccess
|
if (success is MarkAsEmailReadSuccess
|
||||||
&& success.readActions == ReadActions.markAsUnread
|
&& success.readActions == ReadActions.markAsUnread
|
||||||
&& currentContext != null) {
|
&& currentContext != null) {
|
||||||
backToThreadView(currentContext!);
|
closeEmailView(currentContext!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ class EmailController extends BaseController {
|
|||||||
if (failure is MarkAsEmailReadFailure
|
if (failure is MarkAsEmailReadFailure
|
||||||
&& failure.readActions == ReadActions.markAsUnread
|
&& failure.readActions == ReadActions.markAsUnread
|
||||||
&& currentContext != null) {
|
&& currentContext != null) {
|
||||||
backToThreadView(currentContext!);
|
closeEmailView(currentContext!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,7 +453,7 @@ class EmailController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _moveToTrashAction(BuildContext context, AccountId accountId, MoveToMailboxRequest moveRequest) {
|
void _moveToTrashAction(BuildContext context, AccountId accountId, MoveToMailboxRequest moveRequest) {
|
||||||
backToThreadView(context);
|
closeEmailView(context);
|
||||||
mailboxDashBoardController.moveToMailbox(accountId, moveRequest);
|
mailboxDashBoardController.moveToMailbox(accountId, moveRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,7 +489,7 @@ class EmailController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _moveToSpamAction(BuildContext context, AccountId accountId, MoveToMailboxRequest moveRequest) {
|
void _moveToSpamAction(BuildContext context, AccountId accountId, MoveToMailboxRequest moveRequest) {
|
||||||
backToThreadView(context);
|
closeEmailView(context);
|
||||||
mailboxDashBoardController.moveToMailbox(accountId, moveRequest);
|
mailboxDashBoardController.moveToMailbox(accountId, moveRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,17 +632,13 @@ class EmailController extends BaseController {
|
|||||||
|
|
||||||
void _deleteEmailPermanentlyAction(BuildContext context, PresentationEmail email) {
|
void _deleteEmailPermanentlyAction(BuildContext context, PresentationEmail email) {
|
||||||
popBack();
|
popBack();
|
||||||
backToThreadView(context);
|
closeEmailView(context);
|
||||||
mailboxDashBoardController.deleteEmailPermanently(email);
|
mailboxDashBoardController.deleteEmailPermanently(email);
|
||||||
}
|
}
|
||||||
|
|
||||||
void backToThreadView(BuildContext context) {
|
void closeEmailView(BuildContext context) {
|
||||||
mailboxDashBoardController.clearSelectedEmail();
|
mailboxDashBoardController.clearSelectedEmail();
|
||||||
if (responsiveUtils.isDesktop(context) || responsiveUtils.isTabletLarge(context)) {
|
mailboxDashBoardController.dispatchRoute(AppRoutes.THREAD);
|
||||||
mailboxDashBoardController.dispatchRoute(AppRoutes.THREAD);
|
|
||||||
} else {
|
|
||||||
popBack();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pressEmailAction(EmailActionType emailActionType) {
|
void pressEmailAction(EmailActionType emailActionType) {
|
||||||
|
|||||||
@@ -16,9 +16,8 @@ import 'package:tmail_ui_user/features/email/presentation/widgets/bottom_bar_mai
|
|||||||
import 'package:tmail_ui_user/features/email/presentation/widgets/email_action_cupertino_action_sheet_action_builder.dart';
|
import 'package:tmail_ui_user/features/email/presentation/widgets/email_action_cupertino_action_sheet_action_builder.dart';
|
||||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
class EmailView extends GetView with NetworkConnectionMixin {
|
class EmailView extends GetWidget<EmailController> with NetworkConnectionMixin {
|
||||||
|
|
||||||
final emailController = Get.find<EmailController>();
|
|
||||||
final responsiveUtils = Get.find<ResponsiveUtils>();
|
final responsiveUtils = Get.find<ResponsiveUtils>();
|
||||||
final imagePaths = Get.find<ImagePaths>();
|
final imagePaths = Get.find<ImagePaths>();
|
||||||
|
|
||||||
@@ -30,54 +29,63 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
emailController.backToThreadView(context);
|
controller.closeEmailView(context);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: responsiveUtils.isDesktop(context) ? AppColor.colorBgDesktop : Colors.white,
|
backgroundColor: responsiveUtils.isWebDesktop(context)
|
||||||
body: Stack(children: [
|
? AppColor.colorBgDesktop
|
||||||
Row(children: [
|
: Colors.white,
|
||||||
if ((!kIsWeb && !responsiveUtils.isMobile(context)) || (kIsWeb && responsiveUtils.isTabletLarge(context)))
|
body: Row(children: [
|
||||||
const VerticalDivider(color: AppColor.lineItemListColor, width: 1, thickness: 0.2),
|
if (_isMailboxDashboardSplitView(context))
|
||||||
Expanded(child: SafeArea(
|
const VerticalDivider(color: AppColor.lineItemListColor, width: 1, thickness: 0.2),
|
||||||
right: responsiveUtils.isLandscapeMobile(context),
|
Expanded(child: SafeArea(
|
||||||
left: responsiveUtils.isLandscapeMobile(context),
|
right: responsiveUtils.isLandscapeMobile(context),
|
||||||
child: _buildBody(context)))
|
left: responsiveUtils.isLandscapeMobile(context),
|
||||||
]),
|
child: Container(
|
||||||
Obx(() => !emailController.mailboxDashBoardController.isNetworkConnectionAvailable() && (responsiveUtils.isMobile(context) || responsiveUtils.isTablet(context))
|
decoration: responsiveUtils.isWebDesktop(context)
|
||||||
? Align(alignment: Alignment.bottomCenter, child: buildNetworkConnectionWidget(context))
|
? BoxDecoration(
|
||||||
: const SizedBox.shrink()),
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
border: Border.all(color: AppColor.colorBorderBodyThread, width: 1),
|
||||||
|
color: Colors.white)
|
||||||
|
: null,
|
||||||
|
margin: responsiveUtils.isWebDesktop(context)
|
||||||
|
? const EdgeInsets.only(right: 16, top: 16, bottom: 16)
|
||||||
|
: EdgeInsets.zero,
|
||||||
|
padding: responsiveUtils.isWebDesktop(context)
|
||||||
|
? const EdgeInsets.only(top: 5, bottom: 5, left: 5, right: 3)
|
||||||
|
: EdgeInsets.zero,
|
||||||
|
child: Column(children: [
|
||||||
|
_buildAppBar(context),
|
||||||
|
if (responsiveUtils.isWebDesktop(context))
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Obx(() {
|
||||||
|
if (controller.currentEmail != null &&
|
||||||
|
!responsiveUtils.isWebDesktop(context)) {
|
||||||
|
return _buildDivider();
|
||||||
|
}
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}),
|
||||||
|
Expanded(child: _buildEmailBody(context)),
|
||||||
|
Obx(() => controller.currentEmail != null
|
||||||
|
? const Divider(color: AppColor.colorDividerEmailView, height: 1)
|
||||||
|
: const SizedBox.shrink()),
|
||||||
|
_buildBottomBar(context),
|
||||||
|
])
|
||||||
|
)
|
||||||
|
))
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBody(BuildContext context) {
|
bool _isMailboxDashboardSplitView(BuildContext context) {
|
||||||
return Container(
|
if (BuildUtils.isWeb) {
|
||||||
decoration: responsiveUtils.isDesktop(context)
|
return responsiveUtils.isTabletLarge(context);
|
||||||
? BoxDecoration(
|
} else {
|
||||||
borderRadius: BorderRadius.circular(20),
|
return responsiveUtils.isLandscapeTablet(context)
|
||||||
border: Border.all(color: AppColor.colorBorderBodyThread, width: 1),
|
|| responsiveUtils.isDesktop(context);
|
||||||
color: Colors.white)
|
}
|
||||||
: null,
|
|
||||||
margin: responsiveUtils.isDesktop(context)
|
|
||||||
? const EdgeInsets.only(right: 16, top: 16, bottom: 16)
|
|
||||||
: EdgeInsets.zero,
|
|
||||||
padding: responsiveUtils.isDesktop(context)
|
|
||||||
? const EdgeInsets.only(top: 5, bottom: 5, left: 5, right: 3)
|
|
||||||
: EdgeInsets.zero,
|
|
||||||
child: Column(children: [
|
|
||||||
_buildAppBar(context),
|
|
||||||
if (responsiveUtils.isDesktop(context)) const SizedBox(height: 5),
|
|
||||||
Obx(() => emailController.currentEmail != null && !responsiveUtils.isDesktop(context)
|
|
||||||
? _buildDivider() : const SizedBox.shrink()),
|
|
||||||
Expanded(child: _buildEmailBody(context)),
|
|
||||||
Obx(() => emailController.currentEmail != null
|
|
||||||
? const Divider(color: AppColor.colorDividerEmailView, height: 1)
|
|
||||||
: const SizedBox.shrink()),
|
|
||||||
_buildBottomBar(context),
|
|
||||||
])
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildDivider({EdgeInsets? edgeInsets}){
|
Widget _buildDivider({EdgeInsets? edgeInsets}){
|
||||||
@@ -89,24 +97,43 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
Widget _buildAppBar(BuildContext context) {
|
Widget _buildAppBar(BuildContext context) {
|
||||||
return Obx(() => Padding(
|
return Obx(() => Padding(
|
||||||
padding: const EdgeInsets.only(top: 6),
|
padding: const EdgeInsets.only(top: 6),
|
||||||
child: (AppBarMailWidgetBuilder(context, imagePaths, responsiveUtils, emailController.currentEmail, emailController.currentMailbox)
|
child: (AppBarMailWidgetBuilder(
|
||||||
..onBackActionClick(() => emailController.backToThreadView(context))
|
context,
|
||||||
..addOnEmailActionClick((email, action) => emailController.handleEmailAction(context, email, action))
|
imagePaths,
|
||||||
..addOnMoreActionClick((email, position) => responsiveUtils.isMobile(context)
|
responsiveUtils,
|
||||||
? emailController.openContextMenuAction(context, _emailActionMoreActionTile(context, email))
|
controller.currentEmail,
|
||||||
: emailController.openPopupMenuAction(context, position, _popupMenuEmailActionTile(context, email))))
|
controller.currentMailbox)
|
||||||
|
..onBackActionClick(() => controller.closeEmailView(context))
|
||||||
|
..addOnEmailActionClick((email, action) =>
|
||||||
|
controller.handleEmailAction(context, email, action))
|
||||||
|
..addOnMoreActionClick((email, position) {
|
||||||
|
if (responsiveUtils.isMobile(context)) {
|
||||||
|
controller.openContextMenuAction(
|
||||||
|
context,
|
||||||
|
_emailActionMoreActionTile(context, email));
|
||||||
|
} else {
|
||||||
|
controller.openPopupMenuAction(
|
||||||
|
context,
|
||||||
|
position,
|
||||||
|
_popupMenuEmailActionTile(context, email));
|
||||||
|
}
|
||||||
|
}))
|
||||||
.build()));
|
.build()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBottomBar(BuildContext context) {
|
Widget _buildBottomBar(BuildContext context) {
|
||||||
|
bool isMobileDevice = responsiveUtils.isPortraitMobile(context) &&
|
||||||
|
responsiveUtils.isLandscapeMobile(context);
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 16),
|
padding: EdgeInsets.only(
|
||||||
|
bottom: !BuildUtils.isWeb && isMobileDevice ? 16 : 0),
|
||||||
child: Obx(() => (BottomBarMailWidgetBuilder(
|
child: Obx(() => (BottomBarMailWidgetBuilder(
|
||||||
context,
|
context,
|
||||||
imagePaths,
|
imagePaths,
|
||||||
responsiveUtils,
|
responsiveUtils,
|
||||||
emailController.mailboxDashBoardController.selectedEmail.value)
|
controller.mailboxDashBoardController.selectedEmail.value)
|
||||||
..addOnPressEmailAction((emailActionType) => emailController.pressEmailAction(emailActionType)))
|
..addOnPressEmailAction((emailActionType) =>
|
||||||
|
controller.pressEmailAction(emailActionType)))
|
||||||
.build()));
|
.build()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +143,7 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
margin: EdgeInsets.zero,
|
margin: EdgeInsets.zero,
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: Obx(() {
|
child: Obx(() {
|
||||||
if (emailController.currentEmail != null) {
|
if (controller.currentEmail != null) {
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
return _buildEmailMessage(context);
|
return _buildEmailMessage(context);
|
||||||
} else {
|
} else {
|
||||||
@@ -150,7 +177,7 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(right: 16),
|
padding: const EdgeInsets.only(right: 16),
|
||||||
child: SelectableText(
|
child: SelectableText(
|
||||||
'${emailController.mailboxDashBoardController.selectedEmail.value?.getEmailTitle()}',
|
'${controller.mailboxDashBoardController.selectedEmail.value?.getEmailTitle()}',
|
||||||
maxLines: kIsWeb ? 3 : null,
|
maxLines: kIsWeb ? 3 : null,
|
||||||
minLines: kIsWeb ? 1 : null,
|
minLines: kIsWeb ? 1 : null,
|
||||||
cursorColor: AppColor.colorTextButton,
|
cursorColor: AppColor.colorTextButton,
|
||||||
@@ -178,12 +205,12 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
]),
|
]),
|
||||||
if (responsiveUtils.isDesktop(context)) const SizedBox(height: 20),
|
if (responsiveUtils.isDesktop(context)) const SizedBox(height: 20),
|
||||||
if (!responsiveUtils.isDesktop(context)) _buildDivider(edgeInsets: const EdgeInsets.only(top: 16)),
|
if (!responsiveUtils.isDesktop(context)) _buildDivider(edgeInsets: const EdgeInsets.only(top: 16)),
|
||||||
Obx(() => emailController.currentEmail != null
|
Obx(() => controller.currentEmail != null
|
||||||
? _buildEmailAddress(
|
? _buildEmailAddress(
|
||||||
context,
|
context,
|
||||||
emailController.currentEmail!,
|
controller.currentEmail!,
|
||||||
emailController.emailAddressExpandMode.value,
|
controller.emailAddressExpandMode.value,
|
||||||
emailController.isDisplayFullEmailAddress.value)
|
controller.isDisplayFullEmailAddress.value)
|
||||||
: const SizedBox.shrink()),
|
: const SizedBox.shrink()),
|
||||||
_buildDivider(edgeInsets: const EdgeInsets.only(top: 8)),
|
_buildDivider(edgeInsets: const EdgeInsets.only(top: 8)),
|
||||||
_buildLoadingView(),
|
_buildLoadingView(),
|
||||||
@@ -201,8 +228,8 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
|
|
||||||
Widget _buildLoadingView() {
|
Widget _buildLoadingView() {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
if (emailController.emailContents.isEmpty) {
|
if (controller.emailContents.isEmpty) {
|
||||||
return emailController.viewState.value.fold(
|
return controller.viewState.value.fold(
|
||||||
(failure) => const SizedBox.shrink(),
|
(failure) => const SizedBox.shrink(),
|
||||||
(success) {
|
(success) {
|
||||||
if (success is LoadingState) {
|
if (success is LoadingState) {
|
||||||
@@ -226,9 +253,9 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
return Transform(
|
return Transform(
|
||||||
transform: Matrix4.translationValues(0.0, 12.0, 0.0),
|
transform: Matrix4.translationValues(0.0, 12.0, 0.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'${emailController.currentEmail?.getReceivedAt(
|
'${controller.currentEmail?.getReceivedAt(
|
||||||
Localizations.localeOf(context).toLanguageTag(),
|
Localizations.localeOf(context).toLanguageTag(),
|
||||||
pattern: emailController.currentEmail?.receivedAt?.value.toLocal().toPatternForEmailView())}',
|
pattern: controller.currentEmail?.receivedAt?.value.toLocal().toPatternForEmailView())}',
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow:TextOverflow.ellipsis,
|
overflow:TextOverflow.ellipsis,
|
||||||
style: const TextStyle(fontSize: 13, color: AppColor.colorTime)));
|
style: const TextStyle(fontSize: 13, color: AppColor.colorTime)));
|
||||||
@@ -303,7 +330,7 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(left: 10),
|
padding: const EdgeInsets.only(left: 10),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () => emailController.openEmailAddressDialog(context, emailAddress),
|
onTap: () => controller.openEmailAddressDialog(context, emailAddress),
|
||||||
child: Chip(
|
child: Chip(
|
||||||
labelPadding: const EdgeInsets.only(left: 8, right: 8, bottom: 2),
|
labelPadding: const EdgeInsets.only(left: 8, right: 8, bottom: 2),
|
||||||
label: Text(emailAddress.asString(), maxLines: 1, overflow: TextOverflow.ellipsis),
|
label: Text(emailAddress.asString(), maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||||
@@ -337,9 +364,9 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(top: 4, left: 16),
|
padding: const EdgeInsets.only(top: 4, left: 16),
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: () => emailController.toggleDisplayEmailAddressAction(),
|
onPressed: () => controller.toggleDisplayEmailAddressAction(),
|
||||||
child: Text(
|
child: Text(
|
||||||
emailController.isExpandEmailAddress
|
controller.isExpandEmailAddress
|
||||||
? AppLocalizations.of(context).hide
|
? AppLocalizations.of(context).hide
|
||||||
: AppLocalizations.of(context).details,
|
: AppLocalizations.of(context).details,
|
||||||
style: const TextStyle(fontSize: 15, color: AppColor.colorTextButton, fontWeight: FontWeight.normal),
|
style: const TextStyle(fontSize: 15, color: AppColor.colorTextButton, fontWeight: FontWeight.normal),
|
||||||
@@ -358,7 +385,7 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
|
|
||||||
Widget _buildEmailAddressCounter(BuildContext context, PresentationEmail email) {
|
Widget _buildEmailAddressCounter(BuildContext context, PresentationEmail email) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => emailController.showFullEmailAddress(),
|
onTap: () => controller.showFullEmailAddress(),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 8),
|
padding: const EdgeInsets.only(left: 8),
|
||||||
child: Chip(
|
child: Chip(
|
||||||
@@ -377,7 +404,7 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
|
|
||||||
Widget _buildAttachments(BuildContext context) {
|
Widget _buildAttachments(BuildContext context) {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
final attachments = emailController.attachments.listAttachmentsDisplayedOutSide;
|
final attachments = controller.attachments.listAttachmentsDisplayedOutSide;
|
||||||
return attachments.isNotEmpty
|
return attachments.isNotEmpty
|
||||||
? _buildAttachmentsBody(context, attachments)
|
? _buildAttachmentsBody(context, attachments)
|
||||||
: const SizedBox.shrink();
|
: const SizedBox.shrink();
|
||||||
@@ -398,10 +425,10 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
final attachmentLimitDisplayed = _getAttachmentLimitDisplayed(context);
|
final attachmentLimitDisplayed = _getAttachmentLimitDisplayed(context);
|
||||||
final countAttachments = _getListAttachmentsSize(
|
final countAttachments = _getListAttachmentsSize(
|
||||||
context,
|
context,
|
||||||
emailController.attachmentsExpandMode.value,
|
controller.attachmentsExpandMode.value,
|
||||||
attachments,
|
attachments,
|
||||||
attachmentLimitDisplayed);
|
attachmentLimitDisplayed);
|
||||||
final isExpand = emailController.attachmentsExpandMode.value == ExpandMode.EXPAND
|
final isExpand = controller.attachmentsExpandMode.value == ExpandMode.EXPAND
|
||||||
&& attachments.length > attachmentLimitDisplayed;
|
&& attachments.length > attachmentLimitDisplayed;
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -428,13 +455,13 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
attachments[index],
|
attachments[index],
|
||||||
attachments.length,
|
attachments.length,
|
||||||
attachmentLimitDisplayed)
|
attachmentLimitDisplayed)
|
||||||
..setExpandMode((countAttachments - 1 == index) ? emailController.attachmentsExpandMode.value : null)
|
..setExpandMode((countAttachments - 1 == index) ? controller.attachmentsExpandMode.value : null)
|
||||||
..onExpandAttachmentActionClick(() => emailController.toggleDisplayAttachmentsAction())
|
..onExpandAttachmentActionClick(() => controller.toggleDisplayAttachmentsAction())
|
||||||
..onDownloadAttachmentFileActionClick((attachment) {
|
..onDownloadAttachmentFileActionClick((attachment) {
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
emailController.downloadAttachmentForWeb(context, attachment);
|
controller.downloadAttachmentForWeb(context, attachment);
|
||||||
} else {
|
} else {
|
||||||
emailController.exportAttachment(context, attachment);
|
controller.exportAttachment(context, attachment);
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
.build())
|
.build())
|
||||||
@@ -485,7 +512,7 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
height: 20,
|
height: 20,
|
||||||
color: AppColor.primaryColor,
|
color: AppColor.primaryColor,
|
||||||
fit: BoxFit.fill),
|
fit: BoxFit.fill),
|
||||||
onPressed: () => emailController.toggleDisplayAttachmentsAction()
|
onPressed: () => controller.toggleDisplayAttachmentsAction()
|
||||||
))
|
))
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -493,8 +520,8 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
|
|
||||||
Widget _buildEmailContent(BuildContext context, BoxConstraints constraints) {
|
Widget _buildEmailContent(BuildContext context, BoxConstraints constraints) {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
if (emailController.emailContents.isNotEmpty) {
|
if (controller.emailContents.isNotEmpty) {
|
||||||
final allEmailContents = emailController.emailContents.asHtmlString;
|
final allEmailContents = controller.emailContents.asHtmlString;
|
||||||
|
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
return HtmlContentViewerOnWeb(
|
return HtmlContentViewerOnWeb(
|
||||||
@@ -502,12 +529,12 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
heightContent: responsiveUtils.getSizeScreenHeight(context),
|
heightContent: responsiveUtils.getSizeScreenHeight(context),
|
||||||
contentHtml: allEmailContents,
|
contentHtml: allEmailContents,
|
||||||
controller: HtmlViewerControllerForWeb(),
|
controller: HtmlViewerControllerForWeb(),
|
||||||
mailtoDelegate: (uri) => emailController.openMailToLink(uri));
|
mailtoDelegate: (uri) => controller.openMailToLink(uri));
|
||||||
} else {
|
} else {
|
||||||
return HtmlContentViewer(
|
return HtmlContentViewer(
|
||||||
heightContent: responsiveUtils.getSizeScreenHeight(context),
|
heightContent: responsiveUtils.getSizeScreenHeight(context),
|
||||||
contentHtml: allEmailContents,
|
contentHtml: allEmailContents,
|
||||||
mailtoDelegate: (uri) async => emailController.openMailToLink(uri));
|
mailtoDelegate: (uri) async => controller.openMailToLink(uri));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
@@ -534,7 +561,7 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
iconRightPadding: responsiveUtils.isMobile(context)
|
iconRightPadding: responsiveUtils.isMobile(context)
|
||||||
? const EdgeInsets.only(right: 12)
|
? const EdgeInsets.only(right: 12)
|
||||||
: EdgeInsets.zero)
|
: EdgeInsets.zero)
|
||||||
..onActionClick((email) => emailController.handleEmailAction(context, email, EmailActionType.markAsUnread)))
|
..onActionClick((email) => controller.handleEmailAction(context, email, EmailActionType.markAsUnread)))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -542,9 +569,9 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
return (EmailActionCupertinoActionSheetActionBuilder(
|
return (EmailActionCupertinoActionSheetActionBuilder(
|
||||||
const Key('mark_as_spam_or_un_spam_action'),
|
const Key('mark_as_spam_or_un_spam_action'),
|
||||||
SvgPicture.asset(
|
SvgPicture.asset(
|
||||||
emailController.currentMailbox?.isSpam == true ? imagePaths.icNotSpam : imagePaths.icSpam,
|
controller.currentMailbox?.isSpam == true ? imagePaths.icNotSpam : imagePaths.icSpam,
|
||||||
width: 28, height: 28, fit: BoxFit.fill, color: AppColor.colorTextButton),
|
width: 28, height: 28, fit: BoxFit.fill, color: AppColor.colorTextButton),
|
||||||
emailController.currentMailbox?.isSpam == true
|
controller.currentMailbox?.isSpam == true
|
||||||
? AppLocalizations.of(context).remove_from_spam
|
? AppLocalizations.of(context).remove_from_spam
|
||||||
: AppLocalizations.of(context).mark_as_spam,
|
: AppLocalizations.of(context).mark_as_spam,
|
||||||
email,
|
email,
|
||||||
@@ -554,8 +581,8 @@ class EmailView extends GetView with NetworkConnectionMixin {
|
|||||||
iconRightPadding: responsiveUtils.isMobile(context)
|
iconRightPadding: responsiveUtils.isMobile(context)
|
||||||
? const EdgeInsets.only(right: 12)
|
? const EdgeInsets.only(right: 12)
|
||||||
: EdgeInsets.zero)
|
: EdgeInsets.zero)
|
||||||
..onActionClick((email) => emailController.handleEmailAction(context, email,
|
..onActionClick((email) => controller.handleEmailAction(context, email,
|
||||||
emailController.currentMailbox?.isSpam == true ? EmailActionType.unSpam : EmailActionType.moveToSpam)))
|
controller.currentMailbox?.isSpam == true ? EmailActionType.unSpam : EmailActionType.moveToSpam)))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import 'package:core/core.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:model/model.dart';
|
import 'package:model/model.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/app_setting.dart';
|
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/reading_pane.dart';
|
|
||||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
typedef OnBackActionClick = void Function();
|
typedef OnBackActionClick = void Function();
|
||||||
@@ -53,8 +51,10 @@ class AppBarMailWidgetBuilder {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
if (_conditionShow(_context)) _buildBackButton(),
|
if (_mailboxDashboardOnlyHasEmailView(_context))
|
||||||
if (_conditionShow(_context)) Expanded(child: _buildMailboxName()),
|
_buildBackButton(),
|
||||||
|
if (_mailboxDashboardOnlyHasEmailView(_context))
|
||||||
|
Expanded(child: _buildMailboxName()),
|
||||||
if (_presentationEmail != null) _buildListOptionButton(),
|
if (_presentationEmail != null) _buildListOptionButton(),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@@ -62,12 +62,13 @@ class AppBarMailWidgetBuilder {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _conditionShow(BuildContext context) {
|
bool _mailboxDashboardOnlyHasEmailView(BuildContext context) {
|
||||||
if (AppSetting.readingPane == ReadingPane.rightOfInbox
|
if (BuildUtils.isWeb) {
|
||||||
&& (_responsiveUtils.isDesktop(context) || _responsiveUtils.isTabletLarge(context))) {
|
return _responsiveUtils.isDesktop(context);
|
||||||
return false;
|
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return _responsiveUtils.isPortraitMobile(context) ||
|
||||||
|
_responsiveUtils.isLandscapeMobile(context) ||
|
||||||
|
_responsiveUtils.isTablet(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ class MailboxController extends BaseMailboxController {
|
|||||||
mailboxDashBoardController.searchController.disableSearch();
|
mailboxDashBoardController.searchController.disableSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_responsiveUtils.isDesktop(context) && !_responsiveUtils.isTabletLarge(context)) {
|
if (_responsiveUtils.hasLeftMenuDrawerActive(context)) {
|
||||||
mailboxDashBoardController.closeMailboxMenuDrawer();
|
mailboxDashBoardController.closeMailboxMenuDrawer();
|
||||||
} else {
|
} else {
|
||||||
mailboxDashBoardController.dispatchRoute(AppRoutes.THREAD);
|
mailboxDashBoardController.dispatchRoute(AppRoutes.THREAD);
|
||||||
|
|||||||
@@ -101,9 +101,9 @@ class MailboxView extends GetWidget<MailboxController> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
_responsiveUtils.isMobile(context) || _responsiveUtils.isTablet(context)
|
Padding(
|
||||||
? Padding(padding: const EdgeInsets.only(left: 10), child: _buildCloseScreenButton(context))
|
padding: const EdgeInsets.only(left: 10),
|
||||||
: const SizedBox(width: 50),
|
child: _buildCloseScreenButton(context)),
|
||||||
Obx(() {
|
Obx(() {
|
||||||
if (controller.isSearchActive()) {
|
if (controller.isSearchActive()) {
|
||||||
return controller.listMailboxSearched.isNotEmpty
|
return controller.listMailboxSearched.isNotEmpty
|
||||||
|
|||||||
@@ -28,15 +28,15 @@ class MailboxCreatorView extends GetWidget<MailboxCreatorController> {
|
|||||||
mobile: SizedBox(child: _buildBody(context), width: double.infinity),
|
mobile: SizedBox(child: _buildBody(context), width: double.infinity),
|
||||||
landscapeMobile: SizedBox(child: _buildBody(context), width: double.infinity),
|
landscapeMobile: SizedBox(child: _buildBody(context), width: double.infinity),
|
||||||
tablet: Row(children: [
|
tablet: Row(children: [
|
||||||
SizedBox(child: _buildBody(context), width: _responsiveUtils.defaultSizeDrawer),
|
SizedBox(child: _buildBody(context), width: ResponsiveUtils.defaultSizeDrawer),
|
||||||
Expanded(child: Container(color: Colors.transparent)),
|
Expanded(child: Container(color: Colors.transparent)),
|
||||||
]),
|
]),
|
||||||
tabletLarge: Row(children: [
|
tabletLarge: Row(children: [
|
||||||
SizedBox(child: _buildBody(context), width: _responsiveUtils.defaultSizeDrawer),
|
SizedBox(child: _buildBody(context), width: ResponsiveUtils.defaultSizeDrawer),
|
||||||
Expanded(child: Container(color: Colors.transparent)),
|
Expanded(child: Container(color: Colors.transparent)),
|
||||||
]),
|
]),
|
||||||
desktop: Row(children: [
|
desktop: Row(children: [
|
||||||
SizedBox(child: _buildBody(context), width: _responsiveUtils.defaultSizeDrawer),
|
SizedBox(child: _buildBody(context), width: ResponsiveUtils.defaultSizeDrawer),
|
||||||
Expanded(child: Container(color: Colors.transparent)),
|
Expanded(child: Container(color: Colors.transparent)),
|
||||||
])
|
])
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -2,17 +2,14 @@ import 'package:core/core.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:tmail_ui_user/features/base/mixin/network_connection_mixin.dart';
|
import 'package:tmail_ui_user/features/base/mixin/network_connection_mixin.dart';
|
||||||
import 'package:tmail_ui_user/features/composer/presentation/composer_view.dart';
|
|
||||||
import 'package:tmail_ui_user/features/email/presentation/email_view.dart';
|
import 'package:tmail_ui_user/features/email/presentation/email_view.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox/presentation/mailbox_view.dart';
|
import 'package:tmail_ui_user/features/mailbox/presentation/mailbox_view.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/composer_overlay_state.dart';
|
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/app_setting.dart';
|
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/reading_pane.dart';
|
|
||||||
import 'package:tmail_ui_user/features/thread/presentation/thread_view.dart';
|
import 'package:tmail_ui_user/features/thread/presentation/thread_view.dart';
|
||||||
import 'package:tmail_ui_user/main/routes/app_routes.dart';
|
import 'package:tmail_ui_user/main/routes/app_routes.dart';
|
||||||
|
|
||||||
class MailboxDashBoardView extends GetWidget<MailboxDashBoardController> with NetworkConnectionMixin {
|
class MailboxDashBoardView extends GetWidget<MailboxDashBoardController>
|
||||||
|
with NetworkConnectionMixin {
|
||||||
|
|
||||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||||
|
|
||||||
@@ -20,87 +17,72 @@ class MailboxDashBoardView extends GetWidget<MailboxDashBoardController> with Ne
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final bodyLandscapeTablet = Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: ResponsiveUtils.defaultSizeLeftMenuMobile,
|
||||||
|
child: ThreadView()),
|
||||||
|
Expanded(child: EmailView()),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: controller.scaffoldKey,
|
key: controller.scaffoldKey,
|
||||||
drawer: ResponsiveWidget(
|
drawer: ResponsiveWidget(
|
||||||
responsiveUtils: _responsiveUtils,
|
responsiveUtils: _responsiveUtils,
|
||||||
mobile: SizedBox(child: MailboxView(), width: double.infinity),
|
mobile: SizedBox(child: MailboxView(), width: double.infinity),
|
||||||
landscapeMobile: SizedBox(child: MailboxView(), width: _responsiveUtils.defaultSizeDrawer),
|
landscapeMobile: SizedBox(
|
||||||
tablet: SizedBox(child: MailboxView(), width: _responsiveUtils.defaultSizeDrawer),
|
child: MailboxView(),
|
||||||
tabletLarge: const SizedBox.shrink(),
|
width: ResponsiveUtils.defaultSizeDrawer),
|
||||||
desktop: const SizedBox.shrink(),
|
tablet: SizedBox(
|
||||||
),
|
child: MailboxView(),
|
||||||
drawerEnableOpenDragGesture: _responsiveUtils.isMobile(context)
|
width: ResponsiveUtils.defaultSizeDrawer),
|
||||||
|| _responsiveUtils.isLandscapeMobile(context)
|
landscapeTablet: SizedBox(
|
||||||
|| _responsiveUtils.isTablet(context),
|
child: MailboxView(),
|
||||||
|
width: ResponsiveUtils.defaultSizeLeftMenuMobile),
|
||||||
|
tabletLarge: SizedBox(
|
||||||
|
child: MailboxView(),
|
||||||
|
width: ResponsiveUtils.defaultSizeLeftMenuMobile),
|
||||||
|
desktop: SizedBox(
|
||||||
|
child: MailboxView(),
|
||||||
|
width: ResponsiveUtils.defaultSizeLeftMenuMobile)),
|
||||||
|
drawerEnableOpenDragGesture: _responsiveUtils.hasLeftMenuDrawerActive(context),
|
||||||
body: Stack(children: [
|
body: Stack(children: [
|
||||||
ResponsiveWidget(
|
Obx(() {
|
||||||
responsiveUtils: _responsiveUtils,
|
switch(controller.routePath.value) {
|
||||||
desktop: _buildLargeScreenView(context),
|
case AppRoutes.THREAD:
|
||||||
tabletLarge: _buildLargeScreenView(context),
|
return ResponsiveWidget(
|
||||||
tablet: ThreadView(),
|
responsiveUtils: _responsiveUtils,
|
||||||
landscapeMobile: ThreadView(),
|
desktop: bodyLandscapeTablet,
|
||||||
mobile: ThreadView(),
|
tabletLarge: bodyLandscapeTablet,
|
||||||
),
|
landscapeTablet: bodyLandscapeTablet,
|
||||||
Obx(() => controller.composerOverlayState.value == ComposerOverlayState.active
|
mobile: ThreadView());
|
||||||
? ComposerView()
|
case AppRoutes.EMAIL:
|
||||||
: const SizedBox.shrink()),
|
return ResponsiveWidget(
|
||||||
Obx(() => controller.isNetworkConnectionAvailable()
|
responsiveUtils: _responsiveUtils,
|
||||||
? const SizedBox.shrink()
|
desktop: bodyLandscapeTablet,
|
||||||
: Align(alignment: Alignment.bottomCenter, child: buildNetworkConnectionWidget(context))),
|
tabletLarge: bodyLandscapeTablet,
|
||||||
|
landscapeTablet: bodyLandscapeTablet,
|
||||||
|
mobile: EmailView());
|
||||||
|
default:
|
||||||
|
return ResponsiveWidget(
|
||||||
|
responsiveUtils: _responsiveUtils,
|
||||||
|
desktop: bodyLandscapeTablet,
|
||||||
|
tabletLarge: bodyLandscapeTablet,
|
||||||
|
landscapeTablet: bodyLandscapeTablet,
|
||||||
|
mobile: ThreadView());
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
Obx(() {
|
||||||
|
if (controller.isNetworkConnectionAvailable()) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
return Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: buildNetworkConnectionWidget(context));
|
||||||
|
}),
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _wrapContainerForThreadAndEmail(BuildContext context) {
|
|
||||||
switch(AppSetting.readingPane) {
|
|
||||||
case ReadingPane.noSplit:
|
|
||||||
return Obx(() {
|
|
||||||
switch(controller.routePath.value) {
|
|
||||||
case AppRoutes.THREAD:
|
|
||||||
return ThreadView();
|
|
||||||
case AppRoutes.EMAIL:
|
|
||||||
return EmailView();
|
|
||||||
default:
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
case ReadingPane.rightOfInbox:
|
|
||||||
if (_responsiveUtils.isDesktop(context)) {
|
|
||||||
return Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Expanded(flex: 1, child: ThreadView()),
|
|
||||||
Expanded(flex: 2, child: EmailView()),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Expanded(flex: 1, child: ThreadView()),
|
|
||||||
Expanded(flex: 1, child: EmailView()),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildLargeScreenView(BuildContext context) {
|
|
||||||
if (controller.isDrawerOpen && (_responsiveUtils.isDesktop(context) || _responsiveUtils.isTabletLarge(context))) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
controller.closeMailboxMenuDrawer();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
SizedBox(child: MailboxView(), width: _responsiveUtils.defaultSizeDrawer),
|
|
||||||
Expanded(child: _wrapContainerForThreadAndEmail(context))
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -46,8 +46,8 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
|||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
drawer: ResponsiveWidget(
|
drawer: ResponsiveWidget(
|
||||||
responsiveUtils: responsiveUtils,
|
responsiveUtils: responsiveUtils,
|
||||||
mobile: SizedBox(child: MailboxView(), width: responsiveUtils.defaultSizeDrawer),
|
mobile: SizedBox(child: MailboxView(), width: ResponsiveUtils.defaultSizeDrawer),
|
||||||
tablet: SizedBox(child: MailboxView(), width: responsiveUtils.defaultSizeDrawer),
|
tablet: SizedBox(child: MailboxView(), width: ResponsiveUtils.defaultSizeDrawer),
|
||||||
tabletLarge: const SizedBox.shrink(),
|
tabletLarge: const SizedBox.shrink(),
|
||||||
desktop: const SizedBox.shrink(),
|
desktop: const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardControl
|
|||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
drawer: ResponsiveWidget(
|
drawer: ResponsiveWidget(
|
||||||
responsiveUtils: _responsiveUtils,
|
responsiveUtils: _responsiveUtils,
|
||||||
mobile: SizedBox(child: ManageAccountMenuView(), width: _responsiveUtils.defaultSizeDrawer),
|
mobile: SizedBox(child: ManageAccountMenuView(), width: ResponsiveUtils.defaultSizeDrawer),
|
||||||
desktop: const SizedBox.shrink()
|
desktop: const SizedBox.shrink()
|
||||||
),
|
),
|
||||||
drawerEnableOpenDragGesture: !_responsiveUtils.isDesktop(context),
|
drawerEnableOpenDragGesture: !_responsiveUtils.isDesktop(context),
|
||||||
|
|||||||
@@ -459,11 +459,7 @@ class ThreadController extends BaseController {
|
|||||||
|
|
||||||
void previewEmail(BuildContext context, PresentationEmail presentationEmailSelected) {
|
void previewEmail(BuildContext context, PresentationEmail presentationEmailSelected) {
|
||||||
mailboxDashBoardController.setSelectedEmail(presentationEmailSelected);
|
mailboxDashBoardController.setSelectedEmail(presentationEmailSelected);
|
||||||
if (_responsiveUtils.isDesktop(context) || _responsiveUtils.isTabletLarge(context)) {
|
mailboxDashBoardController.dispatchRoute(AppRoutes.EMAIL);
|
||||||
mailboxDashBoardController.dispatchRoute(AppRoutes.EMAIL);
|
|
||||||
} else {
|
|
||||||
goToEmail(context);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void selectEmail(BuildContext context, PresentationEmail presentationEmailSelected) {
|
void selectEmail(BuildContext context, PresentationEmail presentationEmailSelected) {
|
||||||
@@ -1255,10 +1251,6 @@ class ThreadController extends BaseController {
|
|||||||
mailboxDashBoardController.openMailboxMenuDrawer();
|
mailboxDashBoardController.openMailboxMenuDrawer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void goToEmail(BuildContext context) {
|
|
||||||
push(AppRoutes.EMAIL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void editEmail(PresentationEmail presentationEmail) {
|
void editEmail(PresentationEmail presentationEmail) {
|
||||||
final arguments = ComposerArguments(
|
final arguments = ComposerArguments(
|
||||||
emailActionType: EmailActionType.edit,
|
emailActionType: EmailActionType.edit,
|
||||||
|
|||||||
@@ -362,12 +362,12 @@ class AppBarThreadWidgetBuilder {
|
|||||||
children: [
|
children: [
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (_responsiveUtils.isSmallScreen(_context)) {
|
if (_responsiveUtils.hasLeftMenuDrawerActive(_context)) {
|
||||||
_onOpenMailboxMenuActionClick?.call();
|
_onOpenMailboxMenuActionClick?.call();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: (_responsiveUtils.isSmallScreen(_context))
|
padding: (_responsiveUtils.hasLeftMenuDrawerActive(_context))
|
||||||
? EdgeInsets.zero
|
? EdgeInsets.zero
|
||||||
: const EdgeInsets.only(bottom: 8, top: 8),
|
: const EdgeInsets.only(bottom: 8, top: 8),
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -383,7 +383,7 @@ class AppBarThreadWidgetBuilder {
|
|||||||
color: AppColor.colorNameEmail,
|
color: AppColor.colorNameEmail,
|
||||||
fontWeight: FontWeight.w700))
|
fontWeight: FontWeight.w700))
|
||||||
))),
|
))),
|
||||||
if (_responsiveUtils.isSmallScreen(_context))
|
if (_responsiveUtils.hasLeftMenuDrawerActive(_context))
|
||||||
Transform(
|
Transform(
|
||||||
transform: Matrix4.translationValues(-8.0, 0.0, 0.0),
|
transform: Matrix4.translationValues(-8.0, 0.0, 0.0),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class BottomBarThreadSelectionWidget {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(child: (ButtonBuilder(_listSelectionEmail.isAllEmailRead ? _imagePaths.icUnread : _imagePaths.icRead)
|
Expanded(child: (ButtonBuilder(_listSelectionEmail.isAllEmailRead ? _imagePaths.icUnread : _imagePaths.icRead)
|
||||||
..key(const Key('button_mark_read_email'))
|
..key(const Key('button_mark_read_email'))
|
||||||
..paddingIcon(const EdgeInsets.all(8))
|
..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4))
|
||||||
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
||||||
..onPressActionClick(() {
|
..onPressActionClick(() {
|
||||||
if (_onPressEmailSelectionActionClick != null) {
|
if (_onPressEmailSelectionActionClick != null) {
|
||||||
@@ -54,13 +54,11 @@ class BottomBarThreadSelectionWidget {
|
|||||||
_listSelectionEmail.isAllEmailRead ? EmailActionType.markAsUnread : EmailActionType.markAsRead,
|
_listSelectionEmail.isAllEmailRead ? EmailActionType.markAsUnread : EmailActionType.markAsRead,
|
||||||
_listSelectionEmail);
|
_listSelectionEmail);
|
||||||
}})
|
}})
|
||||||
..text(
|
..text(_textButtonMarkAsRead, isVertical: _responsiveUtils.isMobile(_context)))
|
||||||
_listSelectionEmail.isAllEmailRead ? AppLocalizations.of(_context).unread : AppLocalizations.of(_context).read,
|
|
||||||
isVertical: _responsiveUtils.isMobile(_context)))
|
|
||||||
.build()),
|
.build()),
|
||||||
Expanded(child: (ButtonBuilder(_listSelectionEmail.isAllEmailStarred ? _imagePaths.icUnStar : _imagePaths.icStar)
|
Expanded(child: (ButtonBuilder(_listSelectionEmail.isAllEmailStarred ? _imagePaths.icUnStar : _imagePaths.icStar)
|
||||||
..key(const Key('button_mark_as_star_email'))
|
..key(const Key('button_mark_as_star_email'))
|
||||||
..paddingIcon(const EdgeInsets.all(8))
|
..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4))
|
||||||
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
||||||
..onPressActionClick(() {
|
..onPressActionClick(() {
|
||||||
if (_onPressEmailSelectionActionClick != null) {
|
if (_onPressEmailSelectionActionClick != null) {
|
||||||
@@ -68,24 +66,23 @@ class BottomBarThreadSelectionWidget {
|
|||||||
_listSelectionEmail.isAllEmailStarred ? EmailActionType.unMarkAsStarred : EmailActionType.markAsStarred,
|
_listSelectionEmail.isAllEmailStarred ? EmailActionType.unMarkAsStarred : EmailActionType.markAsStarred,
|
||||||
_listSelectionEmail);
|
_listSelectionEmail);
|
||||||
}})
|
}})
|
||||||
..text(_listSelectionEmail.isAllEmailStarred ? AppLocalizations.of(_context).un_star : AppLocalizations.of(_context).star,
|
..text(_textButtonMarkAsStar, isVertical: _responsiveUtils.isMobile(_context)))
|
||||||
isVertical: _responsiveUtils.isMobile(_context)))
|
|
||||||
.build()),
|
.build()),
|
||||||
if (_currentMailbox?.isDrafts == false)
|
if (_currentMailbox?.isDrafts == false)
|
||||||
Expanded(child: (ButtonBuilder(_imagePaths.icMove)
|
Expanded(child: (ButtonBuilder(_imagePaths.icMove)
|
||||||
..key(const Key('button_move_to_mailbox'))
|
..key(const Key('button_move_to_mailbox'))
|
||||||
..paddingIcon(const EdgeInsets.all(8))
|
..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4))
|
||||||
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
||||||
..onPressActionClick(() {
|
..onPressActionClick(() {
|
||||||
if (_onPressEmailSelectionActionClick != null) {
|
if (_onPressEmailSelectionActionClick != null) {
|
||||||
_onPressEmailSelectionActionClick!(EmailActionType.moveToMailbox, _listSelectionEmail);
|
_onPressEmailSelectionActionClick!(EmailActionType.moveToMailbox, _listSelectionEmail);
|
||||||
}})
|
}})
|
||||||
..text(AppLocalizations.of(_context).move, isVertical: _responsiveUtils.isMobile(_context)))
|
..text(_textButtonMove, isVertical: _responsiveUtils.isMobile(_context)))
|
||||||
.build()),
|
.build()),
|
||||||
if (_currentMailbox?.isDrafts == false)
|
if (_currentMailbox?.isDrafts == false)
|
||||||
Expanded(child: (ButtonBuilder(_currentMailbox?.isSpam == true ? _imagePaths.icNotSpam : _imagePaths.icSpam)
|
Expanded(child: (ButtonBuilder(_currentMailbox?.isSpam == true ? _imagePaths.icNotSpam : _imagePaths.icSpam)
|
||||||
..key(const Key('button_move_to_spam'))
|
..key(const Key('button_move_to_spam'))
|
||||||
..paddingIcon(const EdgeInsets.all(8))
|
..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4))
|
||||||
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
||||||
..onPressActionClick(() {
|
..onPressActionClick(() {
|
||||||
if (_currentMailbox?.isSpam == true) {
|
if (_currentMailbox?.isSpam == true) {
|
||||||
@@ -94,14 +91,11 @@ class BottomBarThreadSelectionWidget {
|
|||||||
_onPressEmailSelectionActionClick?.call(EmailActionType.moveToSpam, _listSelectionEmail);
|
_onPressEmailSelectionActionClick?.call(EmailActionType.moveToSpam, _listSelectionEmail);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
..text(_currentMailbox?.isSpam == true
|
..text(_textButtonSpam, isVertical: _responsiveUtils.isMobile(_context)))
|
||||||
? AppLocalizations.of(_context).un_spam
|
|
||||||
: AppLocalizations.of(_context).spam,
|
|
||||||
isVertical: _responsiveUtils.isMobile(_context)))
|
|
||||||
.build()),
|
.build()),
|
||||||
Expanded(child: (ButtonBuilder(_imagePaths.icDelete)
|
Expanded(child: (ButtonBuilder(_imagePaths.icDelete)
|
||||||
..key(const Key('button_delete_email'))
|
..key(const Key('button_delete_email'))
|
||||||
..paddingIcon(const EdgeInsets.all(8))
|
..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4))
|
||||||
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
||||||
..onPressActionClick(() {
|
..onPressActionClick(() {
|
||||||
if (_currentMailbox?.isTrash == true) {
|
if (_currentMailbox?.isTrash == true) {
|
||||||
@@ -110,9 +104,60 @@ class BottomBarThreadSelectionWidget {
|
|||||||
_onPressEmailSelectionActionClick?.call(EmailActionType.moveToTrash, _listSelectionEmail);
|
_onPressEmailSelectionActionClick?.call(EmailActionType.moveToTrash, _listSelectionEmail);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
..text(AppLocalizations.of(_context).delete, isVertical: _responsiveUtils.isMobile(_context)))
|
..text(_textButtonDelete, isVertical: _responsiveUtils.isMobile(_context)))
|
||||||
.build())
|
.build())
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String? get _textButtonMarkAsRead {
|
||||||
|
if (!_isMailboxDashboardSplitView(_context)) {
|
||||||
|
return _listSelectionEmail.isAllEmailRead
|
||||||
|
? AppLocalizations.of(_context).unread
|
||||||
|
: AppLocalizations.of(_context).read;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String? get _textButtonMarkAsStar {
|
||||||
|
if (!_isMailboxDashboardSplitView(_context)) {
|
||||||
|
return _listSelectionEmail.isAllEmailStarred
|
||||||
|
? AppLocalizations.of(_context).un_star
|
||||||
|
: AppLocalizations.of(_context).star;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String? get _textButtonMove {
|
||||||
|
if (!_isMailboxDashboardSplitView(_context)) {
|
||||||
|
return AppLocalizations.of(_context).move;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String? get _textButtonSpam {
|
||||||
|
if (!_isMailboxDashboardSplitView(_context)) {
|
||||||
|
return _currentMailbox?.isSpam == true
|
||||||
|
? AppLocalizations.of(_context).un_spam
|
||||||
|
: AppLocalizations.of(_context).spam;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String? get _textButtonDelete {
|
||||||
|
if (!_isMailboxDashboardSplitView(_context)) {
|
||||||
|
return AppLocalizations.of(_context).delete;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _isMailboxDashboardSplitView(BuildContext context) {
|
||||||
|
if (BuildUtils.isWeb) {
|
||||||
|
return _responsiveUtils.isTabletLarge(context);
|
||||||
|
} else {
|
||||||
|
return _responsiveUtils.isLandscapeTablet(context) ||
|
||||||
|
_responsiveUtils.isTabletLarge(context) ||
|
||||||
|
_responsiveUtils.isDesktop(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user