Fix cannot open email on tablet/ipad device
This commit is contained in:
@@ -5,7 +5,6 @@ import 'package:get/get.dart';
|
|||||||
class ResponsiveUtils {
|
class ResponsiveUtils {
|
||||||
|
|
||||||
static const double defaultSizeLeftMenuMobile = 375;
|
static const double defaultSizeLeftMenuMobile = 375;
|
||||||
static const double defaultSizeDrawer = 320;
|
|
||||||
static const double defaultSizeMenu = 256;
|
static const double defaultSizeMenu = 256;
|
||||||
static const double mobileLeftMenuSize = 339;
|
static const double mobileLeftMenuSize = 339;
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,66 @@
|
|||||||
|
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||||
|
import 'package:core/presentation/views/responsive/responsive_widget.dart';
|
||||||
|
import 'package:core/utils/platform_info.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/app_loader_mixin.dart';
|
import 'package:tmail_ui_user/features/base/mixin/app_loader_mixin.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/extensions/handle_drawer_changed_extension.dart';
|
||||||
|
|
||||||
abstract class BaseMailboxDashBoardView extends GetWidget<MailboxDashBoardController>
|
abstract class BaseMailboxDashBoardView
|
||||||
with AppLoaderMixin {
|
extends GetWidget<MailboxDashBoardController> with AppLoaderMixin {
|
||||||
BaseMailboxDashBoardView({Key? key}) : super(key: key);
|
BaseMailboxDashBoardView({Key? key}) : super(key: key);
|
||||||
}
|
|
||||||
|
Widget buildScaffoldHaveDrawer({required Widget body}) {
|
||||||
|
return Scaffold(
|
||||||
|
key: controller.scaffoldKey,
|
||||||
|
drawer: ResponsiveWidget(
|
||||||
|
responsiveUtils: controller.responsiveUtils,
|
||||||
|
mobile: SizedBox(
|
||||||
|
width: ResponsiveUtils.mobileLeftMenuSize,
|
||||||
|
child: MailboxView(),
|
||||||
|
),
|
||||||
|
tabletLarge: SizedBox(
|
||||||
|
width: ResponsiveUtils.defaultSizeLeftMenuMobile,
|
||||||
|
child: MailboxView(),
|
||||||
|
),
|
||||||
|
desktop: const SizedBox.shrink(),
|
||||||
|
),
|
||||||
|
onDrawerChanged:
|
||||||
|
PlatformInfo.isWeb ? controller.handleDrawerChanged : null,
|
||||||
|
body: body,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildTwoPaneLayout({
|
||||||
|
required Widget left,
|
||||||
|
required Widget right,
|
||||||
|
}) {
|
||||||
|
return buildScaffoldHaveDrawer(
|
||||||
|
body: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: ResponsiveUtils.defaultSizeLeftMenuMobile,
|
||||||
|
child: left,
|
||||||
|
),
|
||||||
|
const VerticalDivider(width: 1),
|
||||||
|
Expanded(child: right),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildResponsiveWithDrawer({
|
||||||
|
required Widget left,
|
||||||
|
required Widget right,
|
||||||
|
required Widget mobile,
|
||||||
|
}) {
|
||||||
|
return ResponsiveWidget(
|
||||||
|
responsiveUtils: controller.responsiveUtils,
|
||||||
|
tablet: buildTwoPaneLayout(left: left, right: right),
|
||||||
|
mobile: mobile,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
import 'package:core/presentation/extensions/color_extension.dart';
|
import 'package:core/presentation/extensions/color_extension.dart';
|
||||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
|
||||||
import 'package:core/presentation/views/responsive/responsive_widget.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:focus_detector_v2/focus_detector_v2.dart';
|
import 'package:focus_detector_v2/focus_detector_v2.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.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_dashboard/presentation/base_mailbox_dashboard_view.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/base_mailbox_dashboard_view.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/dashboard_routes.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/dashboard_routes.dart';
|
||||||
import 'package:tmail_ui_user/features/search/email/presentation/search_email_view.dart';
|
import 'package:tmail_ui_user/features/search/email/presentation/search_email_view.dart';
|
||||||
@@ -15,111 +12,65 @@ import 'package:tmail_ui_user/features/thread/presentation/thread_view.dart';
|
|||||||
import 'package:tmail_ui_user/features/thread_detail/presentation/thread_detail_view.dart';
|
import 'package:tmail_ui_user/features/thread_detail/presentation/thread_detail_view.dart';
|
||||||
|
|
||||||
class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
||||||
|
|
||||||
MailboxDashBoardView({Key? key}) : super(key: key);
|
MailboxDashBoardView({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
Widget _loadingIndicator() {
|
||||||
|
return const Center(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 30,
|
||||||
|
height: 30,
|
||||||
|
child: CupertinoActivityIndicator(
|
||||||
|
color: AppColor.colorLoading,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final bodyLandscapeTablet = Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: ResponsiveUtils.defaultSizeLeftMenuMobile,
|
|
||||||
child: _buildScaffoldHaveDrawer(body: ThreadView())),
|
|
||||||
const VerticalDivider(width: 12),
|
|
||||||
const Expanded(child: EmailView()),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
return FocusDetector(
|
return FocusDetector(
|
||||||
onForegroundGained: controller.handleOnForegroundGained,
|
onForegroundGained: controller.handleOnForegroundGained,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
drawerEnableOpenDragGesture: controller.responsiveUtils.hasLeftMenuDrawerActive(context),
|
drawerEnableOpenDragGesture:
|
||||||
|
controller.responsiveUtils.hasLeftMenuDrawerActive(context),
|
||||||
body: Obx(() {
|
body: Obx(() {
|
||||||
var bodyView = controller.searchController.isSearchEmailRunning
|
switch (controller.dashboardRoute.value) {
|
||||||
? const EmailView()
|
|
||||||
: bodyLandscapeTablet;
|
|
||||||
|
|
||||||
switch(controller.dashboardRoute.value) {
|
|
||||||
case DashboardRoutes.thread:
|
case DashboardRoutes.thread:
|
||||||
return ResponsiveWidget(
|
return buildResponsiveWithDrawer(
|
||||||
responsiveUtils: controller.responsiveUtils,
|
left: ThreadView(),
|
||||||
desktop: bodyView,
|
right: const EmailView(),
|
||||||
tabletLarge: bodyView,
|
mobile: buildScaffoldHaveDrawer(body: ThreadView()),
|
||||||
landscapeTablet: bodyView,
|
);
|
||||||
mobile: _buildScaffoldHaveDrawer(body: ThreadView()));
|
|
||||||
case DashboardRoutes.emailDetailed:
|
case DashboardRoutes.emailDetailed:
|
||||||
return ResponsiveWidget(
|
return controller.searchController.isSearchEmailRunning
|
||||||
responsiveUtils: controller.responsiveUtils,
|
? const EmailView()
|
||||||
desktop: bodyView,
|
: buildResponsiveWithDrawer(
|
||||||
tabletLarge: bodyView,
|
left: ThreadView(),
|
||||||
landscapeTablet: bodyView,
|
right: const EmailView(),
|
||||||
mobile: const EmailView());
|
mobile: const EmailView(),
|
||||||
|
);
|
||||||
|
|
||||||
case DashboardRoutes.threadDetailed:
|
case DashboardRoutes.threadDetailed:
|
||||||
return ResponsiveWidget(
|
return controller.searchController.isSearchEmailRunning
|
||||||
responsiveUtils: controller.responsiveUtils,
|
? const ThreadDetailView()
|
||||||
desktop: bodyView,
|
: buildResponsiveWithDrawer(
|
||||||
tabletLarge: bodyView,
|
left: ThreadView(),
|
||||||
landscapeTablet: bodyView,
|
right: const ThreadDetailView(),
|
||||||
mobile: const ThreadDetailView());
|
mobile: const ThreadDetailView(),
|
||||||
|
);
|
||||||
|
|
||||||
case DashboardRoutes.searchEmail:
|
case DashboardRoutes.searchEmail:
|
||||||
return SafeArea(child: SearchEmailView());
|
return SafeArea(child: SearchEmailView());
|
||||||
|
|
||||||
case DashboardRoutes.sendingQueue:
|
case DashboardRoutes.sendingQueue:
|
||||||
bodyView = Row(
|
return buildScaffoldHaveDrawer(body: const SendingQueueView());
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: ResponsiveUtils.defaultSizeLeftMenuMobile,
|
|
||||||
child: _buildScaffoldHaveDrawer(body: const SendingQueueView())),
|
|
||||||
const VerticalDivider(width: 12),
|
|
||||||
const Expanded(child: EmailView()),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
return ResponsiveWidget(
|
|
||||||
responsiveUtils: controller.responsiveUtils,
|
|
||||||
desktop: bodyView,
|
|
||||||
tabletLarge: bodyView,
|
|
||||||
landscapeTablet: bodyView,
|
|
||||||
mobile: _buildScaffoldHaveDrawer(body: const SendingQueueView()));
|
|
||||||
case DashboardRoutes.waiting:
|
case DashboardRoutes.waiting:
|
||||||
return const Center(
|
return _loadingIndicator();
|
||||||
child: SizedBox(
|
|
||||||
width: 30,
|
|
||||||
height: 30,
|
|
||||||
child: CupertinoActivityIndicator(color: AppColor.colorLoading)));
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
_buildScaffoldHaveDrawer({required Widget body}) {
|
|
||||||
return Scaffold(
|
|
||||||
key: controller.scaffoldKey,
|
|
||||||
body: body,
|
|
||||||
drawer: ResponsiveWidget(
|
|
||||||
responsiveUtils: controller.responsiveUtils,
|
|
||||||
mobile: SizedBox(
|
|
||||||
width: ResponsiveUtils.mobileLeftMenuSize,
|
|
||||||
child: MailboxView()
|
|
||||||
),
|
|
||||||
tablet: SizedBox(
|
|
||||||
width: ResponsiveUtils.defaultSizeDrawer,
|
|
||||||
child: MailboxView()
|
|
||||||
),
|
|
||||||
landscapeTablet: SizedBox(
|
|
||||||
width: ResponsiveUtils.defaultSizeLeftMenuMobile,
|
|
||||||
child: MailboxView()
|
|
||||||
),
|
|
||||||
tabletLarge: SizedBox(
|
|
||||||
width: ResponsiveUtils.defaultSizeLeftMenuMobile,
|
|
||||||
child: MailboxView()
|
|
||||||
),
|
|
||||||
desktop: SizedBox(
|
|
||||||
width: ResponsiveUtils.defaultSizeLeftMenuMobile,
|
|
||||||
child: MailboxView()
|
|
||||||
)
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import 'package:tmail_ui_user/features/mailbox/presentation/mailbox_view_web.dar
|
|||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/model/spam_report_state.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/model/spam_report_state.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/action/dashboard_action.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/action/dashboard_action.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/base_mailbox_dashboard_view.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/base_mailbox_dashboard_view.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/handle_drawer_changed_extension.dart';
|
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/handle_open_context_menu_extension.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/handle_open_context_menu_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/handle_profile_setting_action_type_click_extension.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/handle_profile_setting_action_type_click_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/open_and_close_composer_extension.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/open_and_close_composer_extension.dart';
|
||||||
@@ -295,56 +294,31 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
tabletLarge: Obx(() {
|
tabletLarge: Obx(() {
|
||||||
switch(controller.dashboardRoute.value) {
|
switch (controller.dashboardRoute.value) {
|
||||||
case DashboardRoutes.searchEmail:
|
case DashboardRoutes.searchEmail:
|
||||||
return SearchEmailView();
|
return SearchEmailView();
|
||||||
case DashboardRoutes.emailDetailed:
|
case DashboardRoutes.threadDetailed:
|
||||||
|
return controller.searchController.isSearchEmailRunning
|
||||||
|
? const ThreadDetailView()
|
||||||
|
: buildResponsiveWithDrawer(
|
||||||
|
left: ThreadView(),
|
||||||
|
right: const ThreadDetailView(),
|
||||||
|
mobile: const ThreadDetailView(),
|
||||||
|
);
|
||||||
|
default:
|
||||||
return controller.searchController.isSearchEmailRunning
|
return controller.searchController.isSearchEmailRunning
|
||||||
? const EmailView()
|
? const EmailView()
|
||||||
: _buildScaffoldHaveDrawer(
|
: buildResponsiveWithDrawer(
|
||||||
body: Row(
|
left: ThreadView(),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
right: const EmailView(),
|
||||||
children: [
|
mobile: const EmailView(),
|
||||||
SizedBox(
|
);
|
||||||
width: ResponsiveUtils.defaultSizeLeftMenuMobile,
|
|
||||||
child: ThreadView()),
|
|
||||||
const VerticalDivider(width: 1),
|
|
||||||
const Expanded(child: EmailView()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
case DashboardRoutes.threadDetailed:
|
|
||||||
return _buildScaffoldHaveDrawer(
|
|
||||||
body: Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: ResponsiveUtils.defaultSizeLeftMenuMobile,
|
|
||||||
child: ThreadView()),
|
|
||||||
const VerticalDivider(width: 1),
|
|
||||||
const Expanded(child: ThreadDetailView()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
default:
|
|
||||||
return _buildScaffoldHaveDrawer(
|
|
||||||
body: Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: ResponsiveUtils.defaultSizeLeftMenuMobile,
|
|
||||||
child: ThreadView()),
|
|
||||||
const VerticalDivider(width: 1),
|
|
||||||
const Expanded(child: EmailView()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
mobile: Obx(() {
|
mobile: Obx(() {
|
||||||
switch(controller.dashboardRoute.value) {
|
switch(controller.dashboardRoute.value) {
|
||||||
case DashboardRoutes.thread:
|
case DashboardRoutes.thread:
|
||||||
return _buildScaffoldHaveDrawer(body: ThreadView());
|
return buildScaffoldHaveDrawer(body: ThreadView());
|
||||||
case DashboardRoutes.threadDetailed:
|
case DashboardRoutes.threadDetailed:
|
||||||
return const ThreadDetailView();
|
return const ThreadDetailView();
|
||||||
case DashboardRoutes.emailDetailed:
|
case DashboardRoutes.emailDetailed:
|
||||||
@@ -352,7 +326,7 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
|||||||
case DashboardRoutes.searchEmail:
|
case DashboardRoutes.searchEmail:
|
||||||
return SearchEmailView();
|
return SearchEmailView();
|
||||||
default:
|
default:
|
||||||
return _buildScaffoldHaveDrawer(body: ThreadView());
|
return buildScaffoldHaveDrawer(body: ThreadView());
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@@ -391,23 +365,6 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildScaffoldHaveDrawer({required Widget body}) {
|
|
||||||
return Scaffold(
|
|
||||||
key: controller.scaffoldKey,
|
|
||||||
drawer: ResponsiveWidget(
|
|
||||||
responsiveUtils: controller.responsiveUtils,
|
|
||||||
mobile: SizedBox(
|
|
||||||
width: ResponsiveUtils.mobileLeftMenuSize,
|
|
||||||
child: MailboxView(),
|
|
||||||
),
|
|
||||||
tabletLarge: SizedBox(width: ResponsiveUtils.defaultSizeLeftMenuMobile, child: MailboxView()),
|
|
||||||
desktop: const SizedBox.shrink()
|
|
||||||
),
|
|
||||||
onDrawerChanged: controller.handleDrawerChanged,
|
|
||||||
body: body,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildThreadViewForWebDesktop(BuildContext context) {
|
Widget _buildThreadViewForWebDesktop(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsetsDirectional.only(end: 16, bottom: 16),
|
margin: const EdgeInsetsDirectional.only(end: 16, bottom: 16),
|
||||||
|
|||||||
Reference in New Issue
Block a user