TF-652 Fix responsive landscape screen some device mobile (iPhone 13 Pro Max)

This commit is contained in:
dab246
2022-06-17 12:05:36 +07:00
committed by Dat H. Pham
parent a0fe64e2cf
commit 6dfd964036
4 changed files with 22 additions and 19 deletions
@@ -66,4 +66,8 @@ class ResponsiveUtils {
return widthScreen < 444 ? widthScreen : 444; return widthScreen < 444 ? widthScreen : 444;
} }
} }
bool isSmallScreen(BuildContext context) {
return isPortraitMobile(context) || isLandscapeMobile(context) || isTablet(context);
}
} }
@@ -22,10 +22,11 @@ class ResponsiveWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (desktop != null && responsiveUtils.isDesktop(context)) return desktop!; log('ResponsiveWidget::build(): WIDTH_SIZE: ${responsiveUtils.getDeviceWidth(context)}');
if (tabletLarge != null && responsiveUtils.isTabletLarge(context)) return tabletLarge!;
if (landscapeMobile != null && responsiveUtils.isLandscapeMobile(context)) return landscapeMobile!; if (landscapeMobile != null && responsiveUtils.isLandscapeMobile(context)) return landscapeMobile!;
if (tablet != null && responsiveUtils.isTablet(context)) return tablet!; 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; return mobile;
} }
} }
@@ -119,7 +119,11 @@ class DestinationPickerView extends GetWidget<DestinationPickerController>
child: Container( child: Container(
color: Colors.white, color: Colors.white,
child: Column(children: [ 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), const Divider(color: AppColor.colorDividerMailbox, height: 0.5, thickness: 0.2),
Obx(() => controller.isSearchActive() Obx(() => controller.isSearchActive()
? SafeArea(bottom: false, top: false, right: false, child: _buildInputSearchFormWidget(context)) ? SafeArea(bottom: false, top: false, right: false, child: _buildInputSearchFormWidget(context))
@@ -129,7 +133,7 @@ class DestinationPickerView extends GetWidget<DestinationPickerController>
child: SafeArea( child: SafeArea(
top: false, top: false,
bottom: false, bottom: false,
left: _responsiveUtils.isLandscapeMobile(context) ? true : false, left: !BuildUtils.isWeb && _responsiveUtils.isLandscapeMobile(context),
right: false, right: false,
child: _buildBodyDestinationPicker(context, actions)))) child: _buildBodyDestinationPicker(context, actions))))
]) ])
@@ -261,8 +265,10 @@ class DestinationPickerView extends GetWidget<DestinationPickerController>
|| actions == MailboxActions.move ? 0 : 16); || actions == MailboxActions.move ? 0 : 16);
} else { } else {
return EdgeInsets.only( return EdgeInsets.only(
left: 16, left: _responsiveUtils.isLandscapeMobile(context) ? 0 : 16,
right: actions == MailboxActions.create ? 16 : 8); right: actions == MailboxActions.create
? 16
: _responsiveUtils.isLandscapeMobile(context) ? 0 : 8);
} }
} }
@@ -307,14 +307,12 @@ class AppBarThreadWidgetBuilder {
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
if (!_responsiveUtils.isTabletLarge(_context) if (_responsiveUtils.isSmallScreen(_context)) {
&& !_responsiveUtils.isDesktop(_context)) {
_onOpenMailboxMenuActionClick?.call(); _onOpenMailboxMenuActionClick?.call();
} }
}, },
child: Padding( child: Padding(
padding: (!_responsiveUtils.isTabletLarge(_context) padding: (_responsiveUtils.isSmallScreen(_context))
&& !_responsiveUtils.isDesktop(_context))
? EdgeInsets.zero ? EdgeInsets.zero
: const EdgeInsets.only(bottom: 8, top: 8), : const EdgeInsets.only(bottom: 8, top: 8),
child: Container( child: Container(
@@ -330,8 +328,7 @@ class AppBarThreadWidgetBuilder {
color: AppColor.colorNameEmail, color: AppColor.colorNameEmail,
fontWeight: FontWeight.w700)) fontWeight: FontWeight.w700))
))), ))),
if (!_responsiveUtils.isTabletLarge(_context) if (_responsiveUtils.isSmallScreen(_context))
&& !_responsiveUtils.isDesktop(_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(
@@ -341,12 +338,7 @@ class AppBarThreadWidgetBuilder {
width: 20, width: 20,
height: 16, height: 16,
fit: BoxFit.fill), fit: BoxFit.fill),
onPressed: () { onPressed: () => _onOpenMailboxMenuActionClick?.call()
if (!_responsiveUtils.isTabletLarge(_context)
&& !_responsiveUtils.isDesktop(_context)) {
_onOpenMailboxMenuActionClick?.call();
}
}
) )
) )
] ]
@@ -356,7 +348,7 @@ class AppBarThreadWidgetBuilder {
double _getMaxWidthAppBarTitle() { double _getMaxWidthAppBarTitle() {
var width = MediaQuery.of(_context).size.width; var width = MediaQuery.of(_context).size.width;
var widthSiblingsWidget = 220; var widthSiblingsWidget = 220;
if (_responsiveUtils.isTablet(_context)) { if (_responsiveUtils.isTablet(_context) || _responsiveUtils.isLandscapeMobile(_context)) {
width = width * 0.7; width = width * 0.7;
widthSiblingsWidget = 250; widthSiblingsWidget = 250;
} else if (_responsiveUtils.isTabletLarge(_context)) { } else if (_responsiveUtils.isTabletLarge(_context)) {