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;
}
}
bool isSmallScreen(BuildContext context) {
return isPortraitMobile(context) || isLandscapeMobile(context) || isTablet(context);
}
}
@@ -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;
}
}
@@ -119,7 +119,11 @@ class DestinationPickerView extends GetWidget<DestinationPickerController>
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<DestinationPickerController>
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<DestinationPickerController>
|| 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);
}
}
@@ -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)) {