From 987fe73128664902b3bc503c5a87743de8ac42cc Mon Sep 17 00:00:00 2001 From: aamir-csol Date: Sun, 19 Oct 2025 10:20:47 +0300 Subject: [PATCH] family screen add fixes & remove & switch & widgets --- lib/core/utils/size_utils.dart | 1 + lib/core/utils/utils.dart | 2 +- lib/presentation/authentication/login.dart | 17 ++++------- .../authentication/quick_login.dart | 30 +++++++++---------- lib/presentation/authentication/register.dart | 7 ++--- .../authentication/register_step2.dart | 20 ++++++------- .../medical_file/medical_file_page.dart | 16 ++++------ .../my_family/widget/family_cards.dart | 8 ++--- 8 files changed, 43 insertions(+), 58 deletions(-) diff --git a/lib/core/utils/size_utils.dart b/lib/core/utils/size_utils.dart index 0be751e..f2ba0e8 100644 --- a/lib/core/utils/size_utils.dart +++ b/lib/core/utils/size_utils.dart @@ -129,6 +129,7 @@ class SizeUtils { } log("longerSide: $longerSide"); + log("shorterSide: $shorterSide"); log("isTablet: $isTablet"); } } diff --git a/lib/core/utils/utils.dart b/lib/core/utils/utils.dart index a88d9c2..54d3131 100644 --- a/lib/core/utils/utils.dart +++ b/lib/core/utils/utils.dart @@ -315,7 +315,7 @@ class Utils { crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox(height: isSmallWidget ? 0.h : 48.h), - Lottie.asset(AppAnimations.noData, repeat: false, reverse: false, frameRate: FrameRate(60), width: width.h, height: height.h, fit: BoxFit.fill), + Lottie.asset(AppAnimations.noData, repeat: false, reverse: false, frameRate: FrameRate(60), width: width, height: height, fit: BoxFit.cover), SizedBox(height: 16.h), (noDataText ?? LocaleKeys.noDataAvailable.tr()) .toText16(weight: FontWeight.w500, color: AppColors.greyTextColor, isCenter: true) diff --git a/lib/presentation/authentication/login.dart b/lib/presentation/authentication/login.dart index 7e5f4a1..a97cbb9 100644 --- a/lib/presentation/authentication/login.dart +++ b/lib/presentation/authentication/login.dart @@ -87,10 +87,10 @@ class LoginScreenState extends State { isAllowLeadingIcon: true, padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 10.h), leadingIcon: AppAssets.student_card, - errorMessage: "Please enter a valid national ID or file number", + errorMessage: "Please enter a valid national ID or file number".needTranslation, hasError: false, ), - SizedBox(height: 16.h), // Adjusted to sizer unit (approx 16px) + SizedBox(height: 16.h), CustomButton( height: 50.h, text: LocaleKeys.login.tr(), @@ -109,17 +109,12 @@ class LoginScreenState extends State { } }, ), - SizedBox(height: 10.h), // Adjusted to sizer unit (approx 14px) + SizedBox(height: 10.h), Center( child: RichText( textAlign: TextAlign.center, text: TextSpan( - style: context.dynamicTextStyle( - color: Colors.black, - fontSize: 14.f, // Adjusted to sizer unit - height: 26 / 16, // This height is a ratio, may need re-evaluation - fontWeight: FontWeight.w500, - ), + style: context.dynamicTextStyle(color: Colors.black, fontSize: 14.f, height: 26 / 16, fontWeight: FontWeight.w500), children: [ TextSpan(text: LocaleKeys.dontHaveAccount.tr(), style: context.dynamicTextStyle()), TextSpan(text: " "), @@ -139,9 +134,9 @@ class LoginScreenState extends State { ), ], ), - ).withVerticalPadding(2), // Adjusted to sizer unit + ).withVerticalPadding(2.h), ), - SizedBox(height: 20.h), // Adjusted to sizer unit (approx 14px) + SizedBox(height: 20.h), ], ), ), diff --git a/lib/presentation/authentication/quick_login.dart b/lib/presentation/authentication/quick_login.dart index f10d84f..9a12e13 100644 --- a/lib/presentation/authentication/quick_login.dart +++ b/lib/presentation/authentication/quick_login.dart @@ -25,14 +25,14 @@ class QuickLoginState extends State { Widget build(BuildContext context) { NavigationService navigationService = getIt.get(); return Container( - decoration: const BoxDecoration( + decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( - topLeft: Radius.circular(24), - topRight: Radius.circular(24), + topLeft: Radius.circular(24.r), + topRight: Radius.circular(24.r), ), ), - padding: const EdgeInsets.all(24), + padding: EdgeInsets.all(24.w), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, @@ -50,7 +50,7 @@ class QuickLoginState extends State { child: Utils.buildSvgWithAssets(icon: AppAssets.cross_circle)), ], ), - Utils.showLottie(context: context, assetPath: AppAnimations.checkmark, width: 120, height: 120, repeat: true), + Utils.showLottie(context: context, assetPath: AppAnimations.checkmark, width: 120.w, height: 120.h, repeat: true), LocaleKeys.allSet.tr().toText16(textAlign: TextAlign.center, weight: FontWeight.w500) // Text( // ' TranslationBase.of(context).allSet', @@ -67,7 +67,7 @@ class QuickLoginState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset(AppAssets.lockIcon, height: 100), + Image.asset(AppAssets.lockIcon, height: 100.h), SizedBox(height: 10.h), LocaleKeys.enableQuickLogin.tr().toText26(isBold: true), // Text( @@ -89,7 +89,7 @@ class QuickLoginState extends State { // height: 1.5, // ), //), - const SizedBox(height: 24), + SizedBox(height: 24.h), // Buttons Row( mainAxisAlignment: MainAxisAlignment.end, @@ -115,15 +115,13 @@ class QuickLoginState extends State { children: [ Expanded( child: CustomButton( - text: LocaleKeys.notNow.tr(), - onPressed: () { - Navigator.pop(context, "true"); - }, - backgroundColor: Color(0xffFEE9EA), - borderColor: Color(0xffFEE9EA), - textColor: Colors.red, - // icon: "assets/images/svg/apple-finder.svg", - )), + text: LocaleKeys.notNow.tr(), + onPressed: () { + Navigator.pop(context, "true"); + }, + backgroundColor: Color(0xffFEE9EA), + borderColor: Color(0xffFEE9EA), + textColor: Colors.red)), ], ), ], diff --git a/lib/presentation/authentication/register.dart b/lib/presentation/authentication/register.dart index 9551ba1..f04f7dd 100644 --- a/lib/presentation/authentication/register.dart +++ b/lib/presentation/authentication/register.dart @@ -78,8 +78,7 @@ class _RegisterNew extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Utils.showLottie( - context: context, assetPath: 'assets/animations/lottie/register.json', width: 200.h, height: 200.h, fit: BoxFit.cover, repeat: true), + Utils.showLottie(context: context, assetPath: 'assets/animations/lottie/register.json', width: 200.w, height: 200.h, fit: BoxFit.cover, repeat: true), SizedBox(height: 16.h), LocaleKeys.prepareToElevate.tr().toText32(isBold: true), SizedBox(height: 24.h), @@ -113,7 +112,7 @@ class _RegisterNew extends State { Divider(height: 1), TextInputWidget( labelText: LocaleKeys.dob.tr(), - hintText: "11 July, 1994", + hintText: "11 July, 1994".needTranslation, controller: authVm.dobController, focusNode: _dobFocusNode, isEnable: true, @@ -240,7 +239,7 @@ class _RegisterNew extends State { ), ), ), - SizedBox(height: 30), + SizedBox(height: 30.h), ], ), ), diff --git a/lib/presentation/authentication/register_step2.dart b/lib/presentation/authentication/register_step2.dart index 3466497..71cef96 100644 --- a/lib/presentation/authentication/register_step2.dart +++ b/lib/presentation/authentication/register_step2.dart @@ -69,7 +69,7 @@ class _RegisterNew extends State { height: double.infinity, child: SingleChildScrollView( reverse: false, - padding: EdgeInsets.only(left: 24.h, right: 24.h, top: 0.h), + padding: EdgeInsets.only(left: 24.w, right: 24.w, top: 0.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -98,7 +98,7 @@ class _RegisterNew extends State { leadingIcon: AppAssets.user_circle, labelColor: AppColors.textColor, ).paddingSymmetrical(0.h, 16.h), - Divider(height: 1, color: AppColors.greyColor), + Divider(height: 1.h, color: AppColors.greyColor), TextInputWidget( labelText: LocaleKeys.nationalIdNumber.tr(), hintText: authVM!.isUserFromUAE() ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : (appState.getNHICUserData.idNumber ?? ""), @@ -130,7 +130,7 @@ class _RegisterNew extends State { hasSelectionCustomIcon: true, isAllowRadius: false, labelColor: AppColors.textColor, - padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), + padding: EdgeInsets.only(top: 8.h, bottom: 8.h, left: 0, right: 0), selectionCustomIcon: AppAssets.arrow_down, leadingIcon: AppAssets.user_full, ).withVerticalPadding(8); @@ -167,7 +167,7 @@ class _RegisterNew extends State { hasSelectionCustomIcon: true, isAllowRadius: false, labelColor: AppColors.textColor, - padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), + padding: EdgeInsets.only(top: 8.h, bottom: 8.h, left: 0, right: 0), selectionCustomIcon: AppAssets.arrow_down, leadingIcon: AppAssets.smart_phone, ).withVerticalPadding(8); @@ -188,7 +188,7 @@ class _RegisterNew extends State { leadingIcon: AppAssets.smart_phone, onChange: (value) {}) .paddingSymmetrical(0.h, 16.h), - Divider(height: 1, color: AppColors.greyColor), + Divider(height: 1.h, color: AppColors.greyColor), authVM!.isUserFromUAE() ? Selector? countriesList, NationalityCountries? selectedCountry, bool isArabic})>( selector: (context, authViewModel) { @@ -217,10 +217,10 @@ class _RegisterNew extends State { hasSelectionCustomIcon: true, labelColor: AppColors.textColor, isAllowRadius: false, - padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), + padding: EdgeInsets.only(top: 8.h, bottom: 8.h, left: 0, right: 0), selectionCustomIcon: AppAssets.arrow_down, leadingIcon: AppAssets.globe, - ).withVerticalPadding(8); + ).withVerticalPadding(8.h); }, ) : TextInputWidget( @@ -256,7 +256,7 @@ class _RegisterNew extends State { leadingIcon: AppAssets.call) .paddingSymmetrical(0.h, 16.h), Divider( - height: 1, + height: 1.h, color: AppColors.greyColor, ), TextInputWidget( @@ -292,9 +292,7 @@ class _RegisterNew extends State { iconColor: AppColors.primaryRedColor, ), ), - SizedBox( - width: 16, - ), + SizedBox(width: 16.w), Expanded( child: CustomButton( backgroundColor: AppColors.primaryRedColor, diff --git a/lib/presentation/medical_file/medical_file_page.dart b/lib/presentation/medical_file/medical_file_page.dart index cea3cf1..a435f83 100644 --- a/lib/presentation/medical_file/medical_file_page.dart +++ b/lib/presentation/medical_file/medical_file_page.dart @@ -235,8 +235,7 @@ class _MedicalFilePageState extends State { iconColor: insuranceVM.isInsuranceExpired ? AppColors.primaryRedColor : AppColors.successColor, textColor: insuranceVM.isInsuranceExpired ? AppColors.primaryRedColor : AppColors.successColor, iconSize: 12.w, - backgroundColor: - insuranceVM.isInsuranceExpired ? AppColors.primaryRedColor.withOpacity(0.1) : AppColors.successColor.withOpacity(0.1), + backgroundColor: insuranceVM.isInsuranceExpired ? AppColors.primaryRedColor.withOpacity(0.1) : AppColors.successColor.withOpacity(0.1), labelPadding: EdgeInsetsDirectional.only(start: 4.w, end: 8.w), ); }), @@ -517,11 +516,7 @@ class _MedicalFilePageState extends State { Transform.flip( flipX: appState.isArabic(), child: Utils.buildSvgWithAssets( - icon: AppAssets.forward_arrow_icon_small, - width: 15.w, - height: 15.h, - fit: BoxFit.contain, - iconColor: AppColors.textColor)), + icon: AppAssets.forward_arrow_icon_small, width: 15.w, height: 15.h, fit: BoxFit.contain, iconColor: AppColors.textColor)), ], ).onPress(() { prescriptionVM.setPrescriptionsDetailsLoading(); @@ -597,8 +592,8 @@ class _MedicalFilePageState extends State { context, noDataText: "You don't have any prescriptions yet.".needTranslation, isSmallWidget: true, - width: 62.w, - height: 62.h, + width: 30.w, + height: 30.h, ), ).paddingSymmetrical(24.w, 0.h); }), @@ -811,8 +806,7 @@ class _MedicalFilePageState extends State { insuranceViewModel.setIsInsuranceUpdateDetailsLoading(true); insuranceViewModel.getPatientInsuranceDetailsForUpdate( appState.getAuthenticatedUser()!.patientId.toString(), appState.getAuthenticatedUser()!.patientIdentificationNo.toString()); - showCommonBottomSheetWithoutHeight(context, - child: PatientInsuranceCardUpdateCard(), callBackFunc: () {}, title: "", isCloseButtonVisible: false, isFullScreen: false); + showCommonBottomSheetWithoutHeight(context, child: PatientInsuranceCardUpdateCard(), callBackFunc: () {}, title: "", isCloseButtonVisible: false, isFullScreen: false); }, backgroundColor: AppColors.bgGreenColor.withOpacity(0.20), borderColor: AppColors.bgGreenColor.withOpacity(0.0), diff --git a/lib/presentation/my_family/widget/family_cards.dart b/lib/presentation/my_family/widget/family_cards.dart index 50aec1c..dfa7d0d 100644 --- a/lib/presentation/my_family/widget/family_cards.dart +++ b/lib/presentation/my_family/widget/family_cards.dart @@ -141,10 +141,10 @@ class _FamilyCardsState extends State { physics: NeverScrollableScrollPhysics(), itemCount: widget.profiles.length, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, + crossAxisCount: isTablet ? 3 : 2, crossAxisSpacing: 10.h, mainAxisSpacing: 10.h, - childAspectRatio: widget.isShowDetails ? 0.56.h : 0.65.h, + childAspectRatio: widget.isShowDetails ? 0.56 : 0.65, ), padding: EdgeInsets.only(bottom: 20.h), itemBuilder: (context, index) { @@ -153,8 +153,8 @@ class _FamilyCardsState extends State { final isParentUser = appState.getAuthenticatedUser()?.isParentUser ?? false; final canSwitch = isParentUser || (!isParentUser && profile.responseId == appState.getSuperUserID); return Container( - padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.h), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24), + padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), child: Opacity( opacity: isActive || profile.status == FamilyFileEnum.pending.toInt || !canSwitch ? 0.4 : 1.0, // Fade all content if active child: Stack(