From 6dfd964036d05d12a310173e2ae854d0c14d0dcb Mon Sep 17 00:00:00 2001 From: dab246 Date: Fri, 17 Jun 2022 12:05:36 +0700 Subject: [PATCH] TF-652 Fix responsive landscape screen some device mobile (iPhone 13 Pro Max) --- .../presentation/utils/responsive_utils.dart | 4 ++++ .../views/responsive/responsive_widget.dart | 5 +++-- .../presentation/destination_picker_view.dart | 14 ++++++++++---- .../widgets/app_bar_thread_widget_builder.dart | 18 +++++------------- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/core/lib/presentation/utils/responsive_utils.dart b/core/lib/presentation/utils/responsive_utils.dart index d26df50a2..925bcaa57 100644 --- a/core/lib/presentation/utils/responsive_utils.dart +++ b/core/lib/presentation/utils/responsive_utils.dart @@ -66,4 +66,8 @@ class ResponsiveUtils { return widthScreen < 444 ? widthScreen : 444; } } + + bool isSmallScreen(BuildContext context) { + return isPortraitMobile(context) || isLandscapeMobile(context) || isTablet(context); + } } \ No newline at end of file diff --git a/core/lib/presentation/views/responsive/responsive_widget.dart b/core/lib/presentation/views/responsive/responsive_widget.dart index a0d286d02..e5971bb34 100644 --- a/core/lib/presentation/views/responsive/responsive_widget.dart +++ b/core/lib/presentation/views/responsive/responsive_widget.dart @@ -22,10 +22,11 @@ class ResponsiveWidget extends StatelessWidget { @override Widget build(BuildContext context) { - if (desktop != null && responsiveUtils.isDesktop(context)) return desktop!; - if (tabletLarge != null && responsiveUtils.isTabletLarge(context)) return tabletLarge!; + log('ResponsiveWidget::build(): WIDTH_SIZE: ${responsiveUtils.getDeviceWidth(context)}'); if (landscapeMobile != null && responsiveUtils.isLandscapeMobile(context)) return landscapeMobile!; if (tablet != null && responsiveUtils.isTablet(context)) return tablet!; + if (tabletLarge != null && responsiveUtils.isTabletLarge(context)) return tabletLarge!; + if (desktop != null && responsiveUtils.isDesktop(context)) return desktop!; return mobile; } } \ No newline at end of file diff --git a/lib/features/destination_picker/presentation/destination_picker_view.dart b/lib/features/destination_picker/presentation/destination_picker_view.dart index 475b6641a..d4d92baa7 100644 --- a/lib/features/destination_picker/presentation/destination_picker_view.dart +++ b/lib/features/destination_picker/presentation/destination_picker_view.dart @@ -119,7 +119,11 @@ class DestinationPickerView extends GetWidget child: Container( color: Colors.white, child: Column(children: [ - SafeArea(left: false, right: false, bottom: false, child: _buildAppBar(context)), + SafeArea( + left: !BuildUtils.isWeb && _responsiveUtils.isLandscapeMobile(context), + right: false, + bottom: false, + child: _buildAppBar(context)), const Divider(color: AppColor.colorDividerMailbox, height: 0.5, thickness: 0.2), Obx(() => controller.isSearchActive() ? SafeArea(bottom: false, top: false, right: false, child: _buildInputSearchFormWidget(context)) @@ -129,7 +133,7 @@ class DestinationPickerView extends GetWidget child: SafeArea( top: false, bottom: false, - left: _responsiveUtils.isLandscapeMobile(context) ? true : false, + left: !BuildUtils.isWeb && _responsiveUtils.isLandscapeMobile(context), right: false, child: _buildBodyDestinationPicker(context, actions)))) ]) @@ -261,8 +265,10 @@ class DestinationPickerView extends GetWidget || actions == MailboxActions.move ? 0 : 16); } else { return EdgeInsets.only( - left: 16, - right: actions == MailboxActions.create ? 16 : 8); + left: _responsiveUtils.isLandscapeMobile(context) ? 0 : 16, + right: actions == MailboxActions.create + ? 16 + : _responsiveUtils.isLandscapeMobile(context) ? 0 : 8); } } diff --git a/lib/features/thread/presentation/widgets/app_bar_thread_widget_builder.dart b/lib/features/thread/presentation/widgets/app_bar_thread_widget_builder.dart index cbd665d90..a66aab7a7 100644 --- a/lib/features/thread/presentation/widgets/app_bar_thread_widget_builder.dart +++ b/lib/features/thread/presentation/widgets/app_bar_thread_widget_builder.dart @@ -307,14 +307,12 @@ class AppBarThreadWidgetBuilder { children: [ InkWell( onTap: () { - if (!_responsiveUtils.isTabletLarge(_context) - && !_responsiveUtils.isDesktop(_context)) { + if (_responsiveUtils.isSmallScreen(_context)) { _onOpenMailboxMenuActionClick?.call(); } }, child: Padding( - padding: (!_responsiveUtils.isTabletLarge(_context) - && !_responsiveUtils.isDesktop(_context)) + padding: (_responsiveUtils.isSmallScreen(_context)) ? EdgeInsets.zero : const EdgeInsets.only(bottom: 8, top: 8), child: Container( @@ -330,8 +328,7 @@ class AppBarThreadWidgetBuilder { color: AppColor.colorNameEmail, fontWeight: FontWeight.w700)) ))), - if (!_responsiveUtils.isTabletLarge(_context) - && !_responsiveUtils.isDesktop(_context)) + if (_responsiveUtils.isSmallScreen(_context)) Transform( transform: Matrix4.translationValues(-8.0, 0.0, 0.0), child: IconButton( @@ -341,12 +338,7 @@ class AppBarThreadWidgetBuilder { width: 20, height: 16, fit: BoxFit.fill), - onPressed: () { - if (!_responsiveUtils.isTabletLarge(_context) - && !_responsiveUtils.isDesktop(_context)) { - _onOpenMailboxMenuActionClick?.call(); - } - } + onPressed: () => _onOpenMailboxMenuActionClick?.call() ) ) ] @@ -356,7 +348,7 @@ class AppBarThreadWidgetBuilder { double _getMaxWidthAppBarTitle() { var width = MediaQuery.of(_context).size.width; var widthSiblingsWidget = 220; - if (_responsiveUtils.isTablet(_context)) { + if (_responsiveUtils.isTablet(_context) || _responsiveUtils.isLandscapeMobile(_context)) { width = width * 0.7; widthSiblingsWidget = 250; } else if (_responsiveUtils.isTabletLarge(_context)) {