From 13ce350434413cd244f116cb844826b4afe35663 Mon Sep 17 00:00:00 2001 From: aamir-csol Date: Thu, 9 Apr 2026 15:00:56 +0300 Subject: [PATCH] family file --- .../my_family/widget/family_cards.dart | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/lib/presentation/my_family/widget/family_cards.dart b/lib/presentation/my_family/widget/family_cards.dart index f53239be..3bd65e30 100644 --- a/lib/presentation/my_family/widget/family_cards.dart +++ b/lib/presentation/my_family/widget/family_cards.dart @@ -66,6 +66,29 @@ class _FamilyCardsState extends State { super.initState(); } + + double _calculateAspectRatio(BuildContext context) { + final screenWidth = MediaQuery.of(context).size.width; + final itemWidth = (screenWidth - 32.w - 10.w) / 2; + double itemHeight = 0; + itemHeight += 30.h; // 15.h top + 15.h bottom + itemHeight += 70.h; + itemHeight += 8.h; + itemHeight += 20.h; + + if (widget.isShowDetails) { + itemHeight += 4.h; + itemHeight += 30.h; + itemHeight += 8.h; + } else { + itemHeight += 4.h; + } + + itemHeight += 70.h; + final aspectRatio = itemWidth / itemHeight; + return aspectRatio; + } + @override Widget build(BuildContext context) { widget.profileViewList = []; @@ -138,10 +161,8 @@ class _FamilyCardsState extends State { SizedBox(height: 8.h), Wrap(alignment: WrapAlignment.start, crossAxisAlignment: WrapCrossAlignment.start, runAlignment: WrapAlignment.start, spacing: 0.h, children: [ (profile.patientName ?? "").toText14(isBold: true, isCenter: false, maxlines: 1), - (getStatusTextByRequest( - FamilyFileEnum.values.firstWhere((e) => e.toInt == profile.status), profile.isRequestFromMySide ?? false)) - .toText12( - isCenter: false, maxLine: 1, isBold: true, color: AppColors.greyTextColor), + (getStatusTextByRequest(FamilyFileEnum.values.firstWhere((e) => e.toInt == profile.status), profile.isRequestFromMySide ?? false)) + .toText12(isCenter: false, maxLine: 1, isBold: true, color: AppColors.greyTextColor), ]), SizedBox(height: 8.h), CustomChipWidget( @@ -188,8 +209,8 @@ class _FamilyCardsState extends State { children: [ SizedBox( width: MediaQuery.of(context).size.width * 0.6, - child: "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}" - .toText18(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 2), + child: + "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}".toText18(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 2), ), SizedBox(height: 4.h), Wrap( @@ -311,8 +332,7 @@ class _FamilyCardsState extends State { crossAxisCount: 2, crossAxisSpacing: 10.w, mainAxisSpacing: 10.h, - // childAspectRatio: widget.isShowDetails ? 0.56.h : 0.74.h, - // childAspectRatio: 0.7.h, + childAspectRatio: _calculateAspectRatio(context), ), padding: EdgeInsets.only(bottom: 20.h), itemBuilder: (context, index) {