From 3e61df218ba222d60400008e684609ea614f6960 Mon Sep 17 00:00:00 2001 From: faizatflutter Date: Thu, 16 Oct 2025 10:53:25 +0300 Subject: [PATCH] Some Minor design updated --- lib/core/utils/size_utils.dart | 21 +++--- lib/presentation/home/landing_page.dart | 54 ++++++------- .../home/widgets/large_service_card.dart | 75 ++++++++----------- 3 files changed, 66 insertions(+), 84 deletions(-) diff --git a/lib/core/utils/size_utils.dart b/lib/core/utils/size_utils.dart index dbe6f2f..0be751e 100644 --- a/lib/core/utils/size_utils.dart +++ b/lib/core/utils/size_utils.dart @@ -11,6 +11,15 @@ extension ResponsiveExtension on num { double get _screenHeight => SizeUtils.height; + /// Scale text size + double get f { + double aspectRatio = _screenWidth / _screenHeight; + double scale = (_screenWidth < _screenHeight ? _screenWidth : _screenHeight) / figmaDesignWidth; + double clamp = (aspectRatio > 1.3 || aspectRatio < 0.77) ? 1.6 : 1.2; + if (scale > clamp) scale = clamp; + return this * scale; + } + /// Scale horizontally (width-based) double get w => (this * _screenWidth) / figmaDesignWidth; @@ -20,13 +29,6 @@ extension ResponsiveExtension on num { //radius double get r => (this * _screenWidth) / figmaDesignWidth; - /// Scale text size - double get f { - double scale = _screenWidth / figmaDesignWidth; - if (scale > 1.6) scale = 1.6; // optional clamp for tablets - return this * scale; - } - /// Optional: direct accessors for full width/height static double get screenWidth => SizeUtils.width; @@ -91,10 +93,7 @@ class SizeUtils { /// Device's Width static double width = 375; - static void setScreenSize( - BoxConstraints constraints, - Orientation currentOrientation, - ) { + static void setScreenSize(BoxConstraints constraints, Orientation currentOrientation) { boxConstraints = constraints; orientation = currentOrientation; diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index 9cd72fa..3c0f4f6 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -413,7 +413,7 @@ class _LandingPageState extends State { height: 127.h, decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, - borderRadius: 24, + borderRadius: 24.r, ), child: Column( children: [ @@ -464,36 +464,30 @@ class _LandingPageState extends State { ], ).paddingSymmetrical(24.h, 0.h), SizedBox( - height: 325.h, - child: Column( - children: [ - Expanded( - child: ListView.separated( - scrollDirection: Axis.horizontal, - itemCount: LandingPageData.getServiceCardsList.length, - shrinkWrap: true, - padding: EdgeInsets.only(left: 24.h, right: 24.h), - itemBuilder: (context, index) { - return AnimationConfiguration.staggeredList( - position: index, - duration: const Duration(milliseconds: 1000), - child: SlideAnimation( - horizontalOffset: 100.0, - child: FadeInAnimation( - child: LargeServiceCard( - image: LandingPageData.getServiceCardsList[index].icon, - title: LandingPageData.getServiceCardsList[index].title, - subtitle: LandingPageData.getServiceCardsList[index].subtitle, - icon: LandingPageData.getServiceCardsList[index].largeCardIcon, - ), - ), - ), - ); - }, - separatorBuilder: (BuildContext cxt, int index) => 8.width, + height: 350.h, + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: LandingPageData.getServiceCardsList.length, + shrinkWrap: true, + padding: EdgeInsets.only(left: 24.w, right: 24.w), + itemBuilder: (context, index) { + return AnimationConfiguration.staggeredList( + position: index, + duration: const Duration(milliseconds: 1000), + child: SlideAnimation( + horizontalOffset: 100.0, + child: FadeInAnimation( + child: LargeServiceCard( + image: LandingPageData.getServiceCardsList[index].icon, + title: LandingPageData.getServiceCardsList[index].title, + subtitle: LandingPageData.getServiceCardsList[index].subtitle, + icon: LandingPageData.getServiceCardsList[index].largeCardIcon, + ), + ), ), - ), - ], + ); + }, + separatorBuilder: (BuildContext cxt, int index) => SizedBox(width: 8.w), ), ), appState.isAuthenticated ? HabibWalletCard() : SizedBox(), diff --git a/lib/presentation/home/widgets/large_service_card.dart b/lib/presentation/home/widgets/large_service_card.dart index 8473eff..af03168 100644 --- a/lib/presentation/home/widgets/large_service_card.dart +++ b/lib/presentation/home/widgets/large_service_card.dart @@ -16,7 +16,7 @@ class LargeServiceCard extends StatelessWidget { final String title; final String subtitle; - LargeServiceCard({ + const LargeServiceCard({ super.key, this.image = "", this.icon = "", @@ -27,49 +27,38 @@ class LargeServiceCard extends StatelessWidget { @override Widget build(BuildContext context) { return Padding( - padding: EdgeInsets.symmetric(horizontal: 3.h), + padding: EdgeInsets.symmetric(horizontal: 3.w), child: Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: Colors.transparent, - borderRadius: 16, - ), - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 0.h), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset(AppAssets.livecare_service, width: 220.h, height: 220.h, fit: BoxFit.contain), - SizedBox(height: 3.h), - Row( - children: [ - Utils.buildSvgWithAssets(icon: icon, width: 24.h, height: 24.h), - title.toText14(color: AppColors.blackColor, isBold: true), - ], - ), - SizedBox(width: 220.h, child: subtitle.toText11(color: AppColors.blackColor)), - SizedBox(height: 6.h), - SizedBox( - width: 220.h, - child: CustomButton( - text: LocaleKeys.bookNow.tr(context: context), - onPressed: () { - // Navigator.of(context).pushReplacement( - // MaterialPageRoute(builder: (BuildContext context) => LandingPage()), - // ); - }, - backgroundColor: AppColors.borderOnlyColor, - borderColor: AppColors.borderOnlyColor, - textColor: AppColors.whiteColor, - fontSize: 14, - fontWeight: FontWeight.bold, - borderRadius: 12, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 40.h, - ), - ), - ], - ), + width: 150.w, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: Colors.transparent, borderRadius: 16.r), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset(AppAssets.livecare_service, width: 220.w, height: 220.h, fit: BoxFit.contain), + SizedBox(height: 3.h), + Row( + children: [ + Utils.buildSvgWithAssets(icon: icon, width: 24.w, height: 24.h), + title.toText14(color: AppColors.blackColor, isBold: true), + ], + ), + subtitle.toText11(color: AppColors.blackColor), + SizedBox(height: 10.h), + CustomButton( + width: 150.w, + text: LocaleKeys.bookNow.tr(context: context), + onPressed: () {}, + backgroundColor: AppColors.borderOnlyColor, + borderColor: AppColors.borderOnlyColor, + textColor: AppColors.whiteColor, + fontSize: 14.f, + fontWeight: FontWeight.bold, + borderRadius: 12.r, + padding: EdgeInsets.fromLTRB(10.w, 0, 10.w, 0), + height: 40.h, + ), + ], ), ), );