From cc7fedc8f57ddb19fbd984e7de731c1403122a95 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 2 Jun 2021 17:46:03 +0300 Subject: [PATCH] add middle screen height size --- lib/config/size_config.dart | 6 ++++-- lib/screens/auth/login_screen.dart | 5 ++--- .../auth/verification_methods_screen.dart | 14 +++----------- .../home/dashboard_referral_patient.dart | 4 ++-- .../home/dashboard_slider-item-widget.dart | 2 +- lib/screens/home/dashboard_swipe_widget.dart | 2 +- lib/screens/home/home_patient_card.dart | 4 ++-- lib/screens/home/home_screen.dart | 4 ++-- lib/widgets/auth/method_type_card.dart | 2 +- lib/widgets/auth/sms-popup.dart | 5 +---- lib/widgets/dashboard/activity_card.dart | 4 ++-- lib/widgets/dashboard/out_patient_stack.dart | 2 +- lib/widgets/shared/app_drawer_widget.dart | 17 ++++++++--------- lib/widgets/shared/bottom_navigation_item.dart | 8 ++++---- lib/widgets/shared/drawer_item_widget.dart | 2 +- 15 files changed, 35 insertions(+), 46 deletions(-) diff --git a/lib/config/size_config.dart b/lib/config/size_config.dart index 2763091b..9179d99a 100644 --- a/lib/config/size_config.dart +++ b/lib/config/size_config.dart @@ -18,16 +18,18 @@ class SizeConfig { static bool isMobilePortrait = false; static bool isMobile = false; static bool isHeightShort = false; + static bool isHeightVeryShort = false; void init(BoxConstraints constraints, Orientation orientation) { realScreenHeight = constraints.maxHeight; realScreenWidth = constraints.maxWidth; - if (constraints.maxWidth <= MAX_SMALL_SCREEN) { isMobile = true; } - if (constraints.maxHeight < 800) { + if (constraints.maxHeight < 600) { + isHeightVeryShort = true; + } else if (constraints.maxHeight < 800) { isHeightShort = true; } if (orientation == Orientation.portrait) { diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index a982ae79..909bdb0b 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -34,7 +34,7 @@ class _LoginScreenState extends State { @override Widget build(BuildContext context) { authenticationViewModel = Provider.of(context); - double textFieldHeight = SizeConfig.heightMultiplier * (SizeConfig.isHeightShort ?10:6); + double textFieldHeight = SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ?10:SizeConfig.isHeightShort?8:6); return AppScaffold( isShowAppBar: false, backgroundColor: HexColor('#F8F8F8'), @@ -163,7 +163,7 @@ class _LoginScreenState extends State { children: [ AppButton( height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightShort ? 8 : 6), + (SizeConfig.isHeightVeryShort ? 8 : 6), hPadding: 1, title: TranslationBase.of(context).login, color: Color(0xFFD02127), @@ -175,7 +175,6 @@ class _LoginScreenState extends State { }, ), - // SizedBox(height: SizeConfig.heightMultiplier * (SizeConfig.isHeightShort? 1 : 3),) ], ), ), diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index 2cc5b95f..54bf26a3 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -1,6 +1,5 @@ import 'dart:io' show Platform; -import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/auth_method_types.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; @@ -13,21 +12,15 @@ import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/secondary_button.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; -import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import '../../config/size_config.dart'; -import '../../landing_page.dart'; -import '../../root_page.dart'; -import '../../routes.dart'; import '../../util/dr_app_shared_pref.dart'; import '../../util/helpers.dart'; import '../../widgets/auth/verification_methods_list.dart'; -import 'login_screen.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = Helpers(); @@ -72,7 +65,7 @@ class _VerificationMethodsScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: SizeConfig.heightMultiplier * (SizeConfig.isHeightShort?6:4), + height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort?6:4), ), if(authenticationViewModel.isFromLogin) InkWell( @@ -86,7 +79,7 @@ class _VerificationMethodsScreenState extends State { Column( children: [ SizedBox( - height: SizeConfig.heightMultiplier*(SizeConfig.isHeightShort?3:4), + height: SizeConfig.heightMultiplier*(SizeConfig.isHeightVeryShort?3:4), ), authenticationViewModel.user != null && isMoreOption == false ? Column( @@ -439,7 +432,7 @@ class _VerificationMethodsScreenState extends State { color: Color(0xFFD02127), fontWeight: FontWeight.w700, - height: SizeConfig.heightMultiplier * (SizeConfig.isHeightShort? 8 : 6), + height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort? 8 : 6), hPadding: 1, onPressed: () { @@ -448,7 +441,6 @@ class _VerificationMethodsScreenState extends State { }, ), - // SizedBox(height: SizeConfig.heightMultiplier * (SizeConfig.isHeightShort? 1 : 3),) ], ), ), diff --git a/lib/screens/home/dashboard_referral_patient.dart b/lib/screens/home/dashboard_referral_patient.dart index 5e265303..c389b9d7 100644 --- a/lib/screens/home/dashboard_referral_patient.dart +++ b/lib/screens/home/dashboard_referral_patient.dart @@ -69,7 +69,7 @@ class DashboardReferralPatient extends StatelessWidget { fontWeight: FontWeight.bold, ), SizedBox( - height: SizeConfig.getHeightMultiplier(height: height) * (SizeConfig.isHeightShort?14: 20) + height: SizeConfig.getHeightMultiplier(height: height) * (SizeConfig.isHeightVeryShort?5:SizeConfig.isHeightShort?14: 20) ) ], ),), @@ -131,7 +131,7 @@ class DashboardReferralPatient extends StatelessWidget { ) ], ), - top: height * .40, + top: height * (SizeConfig.isHeightVeryShort?0.35:0.40), left: 0, right: 0) ]), diff --git a/lib/screens/home/dashboard_slider-item-widget.dart b/lib/screens/home/dashboard_slider-item-widget.dart index a3fbaedb..b28ded18 100644 --- a/lib/screens/home/dashboard_slider-item-widget.dart +++ b/lib/screens/home/dashboard_slider-item-widget.dart @@ -24,7 +24,7 @@ class DashboardSliderItemWidget extends StatelessWidget { ], ), new Container( - height: SizeConfig.heightMultiplier* (SizeConfig.isHeightShort?13:12), + height: SizeConfig.heightMultiplier* (SizeConfig.isHeightVeryShort?16:SizeConfig.isHeightShort?14:12), child: ListView( scrollDirection: Axis.horizontal, children: diff --git a/lib/screens/home/dashboard_swipe_widget.dart b/lib/screens/home/dashboard_swipe_widget.dart index 0315caf2..5bd178e3 100644 --- a/lib/screens/home/dashboard_swipe_widget.dart +++ b/lib/screens/home/dashboard_swipe_widget.dart @@ -26,7 +26,7 @@ class _DashboardSwipeWidgetState extends State { @override Widget build(BuildContext context) { double height = SizeConfig.heightMultiplier * - (SizeConfig.isHeightShort ? 40 : 37); + (SizeConfig.isHeightVeryShort ? 40 : 37); return Container( height: height, // height: 230, diff --git a/lib/screens/home/home_patient_card.dart b/lib/screens/home/home_patient_card.dart index 09590ef2..d6b278dd 100644 --- a/lib/screens/home/home_patient_card.dart +++ b/lib/screens/home/home_patient_card.dart @@ -22,7 +22,7 @@ class HomePatientCard extends StatelessWidget { @override Widget build(BuildContext context) { - double width = SizeConfig.heightMultiplier* (SizeConfig.isHeightShort?16:11); + double width = SizeConfig.heightMultiplier* (SizeConfig.isHeightVeryShort?16:SizeConfig.isHeightVeryShort?14:11); return HomePageCard( color: backgroundColor, width: width, @@ -72,7 +72,7 @@ class HomePatientCard extends StatelessWidget { text, color: textColor, textAlign: TextAlign.start, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: width) * (SizeConfig.isHeightShort?10:12), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: width) * (SizeConfig.isHeightVeryShort?10:12), ), ), ), diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index a45332f0..aa47e349 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -213,7 +213,7 @@ class _HomeScreenState extends State { ), isClinic: true, height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightShort ? 10 : 8), + (SizeConfig.isHeightVeryShort ? 10 : 8), ), ]) ])), @@ -291,7 +291,7 @@ class _HomeScreenState extends State { height: SizeConfig.heightMultiplier *1, ), Container( - height: SizeConfig.heightMultiplier* (SizeConfig.isHeightShort?16:11), + height: SizeConfig.heightMultiplier* (SizeConfig.isHeightVeryShort?16:SizeConfig.isHeightShort?14:11), child: ListView( scrollDirection: Axis.horizontal, children: [ diff --git a/lib/widgets/auth/method_type_card.dart b/lib/widgets/auth/method_type_card.dart index d02d8dc7..db3a724b 100644 --- a/lib/widgets/auth/method_type_card.dart +++ b/lib/widgets/auth/method_type_card.dart @@ -17,7 +17,7 @@ class MethodTypeCard extends StatelessWidget { @override Widget build(BuildContext context) { - double cardHeight = SizeConfig.heightMultiplier * (SizeConfig.isHeightShort? 22 : 15); + double cardHeight = SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort? 22 : 15); return InkWell( onTap: onTap, child: Container( diff --git a/lib/widgets/auth/sms-popup.dart b/lib/widgets/auth/sms-popup.dart index d2a65655..e93489ef 100644 --- a/lib/widgets/auth/sms-popup.dart +++ b/lib/widgets/auth/sms-popup.dart @@ -5,11 +5,8 @@ import 'package:doctor_app_flutter/core/enum/auth_method_types.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; class SMSOTP { final AuthMethodTypes type; final mobileNo; @@ -50,7 +47,7 @@ class SMSOTP { bool isClosed = false; displayDialog(BuildContext context) async { double dialogWidth = MediaQuery.of(context).size.width * 0.90; - double dialogHeight = SizeConfig.isHeightShort ?MediaQuery.of(context).size.height * 0.50:MediaQuery.of(context).size.height * 0.40; + double dialogHeight = SizeConfig.isHeightVeryShort ?MediaQuery.of(context).size.height * 0.50:MediaQuery.of(context).size.height * 0.40; return showDialog( context: context, builder: (ctx) => Center( diff --git a/lib/widgets/dashboard/activity_card.dart b/lib/widgets/dashboard/activity_card.dart index 4bb46e40..193f572d 100644 --- a/lib/widgets/dashboard/activity_card.dart +++ b/lib/widgets/dashboard/activity_card.dart @@ -9,7 +9,7 @@ class GetActivityCard extends StatelessWidget { @override Widget build(BuildContext context) { - double width = SizeConfig.heightMultiplier* (SizeConfig.isHeightShort?13:12); + double width = SizeConfig.heightMultiplier* (SizeConfig.isHeightVeryShort?16:SizeConfig.isHeightShort?14:12); return Container( width: width, padding: EdgeInsets.symmetric(horizontal: SizeConfig.heightMultiplier * .4, vertical: SizeConfig.heightMultiplier * .2), @@ -34,7 +34,7 @@ class GetActivityCard extends StatelessWidget { AppText( value.kPIParameter, textOverflow: TextOverflow.clip, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: width)* (SizeConfig.isHeightShort?6: 8), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: width)* (SizeConfig.isHeightVeryShort?8: SizeConfig.isHeightShort?8: 8), color: Color(0xFF2B353E), textAlign: TextAlign.start, fontWeight: FontWeight.w700, diff --git a/lib/widgets/dashboard/out_patient_stack.dart b/lib/widgets/dashboard/out_patient_stack.dart index 6ff1412d..6ada94f1 100644 --- a/lib/widgets/dashboard/out_patient_stack.dart +++ b/lib/widgets/dashboard/out_patient_stack.dart @@ -34,7 +34,7 @@ class GetOutPatientStack extends StatelessWidget { getStack(Summaryoptions value, max,context) { double barHeight = SizeConfig.heightMultiplier * - (SizeConfig.isHeightShort ? 23 : 25); + (SizeConfig.isHeightVeryShort ? 23 : 25); return Expanded( child: Container( margin: EdgeInsets.symmetric(horizontal: 2), diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index e44b6737..ee74590f 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -4,7 +4,6 @@ import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; @@ -51,10 +50,10 @@ class _AppDrawerState extends State { child: Image.asset( 'assets/images/dr_app_logo.png', width: SizeConfig.getWidthMultiplier( - width: drawerWidth) * (SizeConfig.isHeightShort? 30: 32), + width: drawerWidth) * (SizeConfig.isHeightVeryShort? 25:SizeConfig.isHeightVeryShort?30: 32), ), - margin: EdgeInsets.only(top: SizeConfig.heightMultiplier * (SizeConfig.isHeightShort?1:2), bottom: SizeConfig.heightMultiplier * 0.5), + margin: EdgeInsets.only(top: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort?1:2), bottom: SizeConfig.heightMultiplier * 0.5), ), Container( child: InkWell( @@ -66,13 +65,13 @@ class _AppDrawerState extends State { size: SizeConfig.heightMultiplier * 2, ), ), - margin: EdgeInsets.only(top: SizeConfig.heightMultiplier * (SizeConfig.isHeightShort?2:3), bottom: SizeConfig.heightMultiplier * 0.5), + margin: EdgeInsets.only(top: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort?2:3), bottom: SizeConfig.heightMultiplier * 0.5), ) ], crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, ), - SizedBox(height: SizeConfig.heightMultiplier * (SizeConfig.isHeightShort?0.5:1),), + SizedBox(height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort?0.5:1),), if (authenticationViewModel.doctorProfile != null) InkWell( onTap: () { @@ -116,7 +115,7 @@ class _AppDrawerState extends State { ], ), ), - SizedBox(height: SizeConfig.heightMultiplier * (SizeConfig.isHeightShort?4:6),), + SizedBox(height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort?4:6),), InkWell( child: DrawerItem( TranslationBase @@ -154,7 +153,7 @@ class _AppDrawerState extends State { // height: 80, child: Image.asset('assets/images/qr_code.png', width: SizeConfig.getWidthMultiplier( - width: drawerWidth) * 30, + width: drawerWidth) * (SizeConfig.isHeightVeryShort?25:30), ), ), onTap: () {}, @@ -163,7 +162,7 @@ class _AppDrawerState extends State { ), ), SizedBox( - height: SizeConfig.heightMultiplier *(SizeConfig.isHeightShort?10:16), + height: SizeConfig.heightMultiplier *(SizeConfig.isHeightVeryShort?8:SizeConfig.isHeightShort?10:16), ), Container( margin: EdgeInsets.symmetric(horizontal: 20), @@ -192,7 +191,7 @@ class _AppDrawerState extends State { projectsProvider.changeLanguage('ar'); }, ), - SizedBox(height: SizeConfig.heightMultiplier *(SizeConfig.isHeightShort?0.5:1) ), + SizedBox(height: SizeConfig.heightMultiplier *(SizeConfig.isHeightVeryShort?0.5:1) ), InkWell( child: DrawerItem( TranslationBase diff --git a/lib/widgets/shared/bottom_navigation_item.dart b/lib/widgets/shared/bottom_navigation_item.dart index f85636ff..f34802a9 100644 --- a/lib/widgets/shared/bottom_navigation_item.dart +++ b/lib/widgets/shared/bottom_navigation_item.dart @@ -23,7 +23,7 @@ class BottomNavigationItem extends StatelessWidget { return Expanded( child: SizedBox( height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightShort ? 10 : 6), + (SizeConfig.isHeightVeryShort ? 10 : 6), child: Material( type: MaterialType.transparency, child: InkWell( @@ -35,17 +35,17 @@ class BottomNavigationItem extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox(height: SizeConfig.getHeightMultiplier(height:SizeConfig.heightMultiplier * - (SizeConfig.isHeightShort ? 12 : 9) ) * 10,), + (SizeConfig.isHeightVeryShort ? 12 : 9) ) * 10,), Container( child: Icon(currentIndex == index ? activeIcon : icon, color: currentIndex == index ? Color(0xFF333C45) : Theme.of(context).dividerColor, size: SizeConfig.getHeightMultiplier(height:SizeConfig.heightMultiplier * - (SizeConfig.isHeightShort ? 10 : 6) ) * 40,), + (SizeConfig.isHeightVeryShort ? 10 : 6) ) * 40,), ), SizedBox(height: SizeConfig.getHeightMultiplier(height:SizeConfig.heightMultiplier * - (SizeConfig.isHeightShort ? 10 : 6) ) * 0.5,), + (SizeConfig.isHeightVeryShort ? 10 : 6) ) * 0.5,), Expanded( child: Text( name, diff --git a/lib/widgets/shared/drawer_item_widget.dart b/lib/widgets/shared/drawer_item_widget.dart index 3526f57a..71021f5d 100644 --- a/lib/widgets/shared/drawer_item_widget.dart +++ b/lib/widgets/shared/drawer_item_widget.dart @@ -51,7 +51,7 @@ class _DrawerItemState extends State { marginLeft: 5, marginRight: 5, color:widget.color ??Color(0xFF2E303A), - fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: widget.drawerWidth ) * 6, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: widget.drawerWidth ) * (SizeConfig.isHeightVeryShort?5:6), fontFamily: 'Poppins', fontWeight: FontWeight.w600, ),