From 441516a47288ff443cda20abbdeb0557acd030c1 Mon Sep 17 00:00:00 2001 From: MhdZiadHirati Date: Wed, 25 Oct 2023 12:41:12 +0300 Subject: [PATCH] ui fixes --- lib/common/widgets/button.dart | 101 +++++++++++------- lib/core/localization/localization.dart | 2 + .../widgets/appointment_details.dart | 9 +- 3 files changed, 71 insertions(+), 41 deletions(-) diff --git a/lib/common/widgets/button.dart b/lib/common/widgets/button.dart index b9a3a86..99b351b 100644 --- a/lib/common/widgets/button.dart +++ b/lib/common/widgets/button.dart @@ -17,20 +17,23 @@ class ButtonWidget extends StatelessWidget { final double? buttonHeight; final bool hideTextOnLoading; final double? fontSize; - const ButtonWidget( - {super.key, - required this.onTap, - required this.title, - this.color, - this.hideTextOnLoading = false, - this.haveIcon = false, - this.child, - this.loaderColor, - this.width, - this.buttonHeight, - this.fontSize, - this.textColor, - this.isLoading = false}); + final bool columnShapeOnLoading; + const ButtonWidget({ + super.key, + required this.onTap, + required this.title, + this.color, + this.hideTextOnLoading = false, + this.haveIcon = false, + this.child, + this.loaderColor, + this.width, + this.buttonHeight, + this.fontSize, + this.textColor, + this.isLoading = false, + this.columnShapeOnLoading = false, + }); @override Widget build(BuildContext context) { @@ -52,29 +55,53 @@ class ButtonWidget extends StatelessWidget { ]) : isLoading! //wrap (Loader with visibility instead of repeating it) - ? Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Visibility( - visible: !((isLoading != null) && - hideTextOnLoading && - isLoading!), - child: BoldTextWidget( - title, - fontSize: fontSize, - textAlign: TextAlign.center, - color: textColor ?? Colors.white, - ).paddingSymmetric(horizontal: 20), - ), - SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator( - color: loaderColor ?? Colors.white, - ), - ), - ], - ) + ? (columnShapeOnLoading) + ? Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Visibility( + visible: !((isLoading != null) && + hideTextOnLoading && + isLoading!), + child: BoldTextWidget( + title, + fontSize: fontSize, + textAlign: TextAlign.center, + color: textColor ?? Colors.white, + ).paddingSymmetric(horizontal: 20), + ), + SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator( + color: loaderColor ?? Colors.white, + ), + ), + ], + ) + : Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Visibility( + visible: !((isLoading != null) && + hideTextOnLoading && + isLoading!), + child: BoldTextWidget( + title, + fontSize: fontSize, + textAlign: TextAlign.center, + color: textColor ?? Colors.white, + ).paddingSymmetric(horizontal: 20), + ), + SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator( + color: loaderColor ?? Colors.white, + ), + ), + ], + ) : BoldTextWidget( title, fontSize: fontSize, diff --git a/lib/core/localization/localization.dart b/lib/core/localization/localization.dart index bfe7c91..c8937bb 100644 --- a/lib/core/localization/localization.dart +++ b/lib/core/localization/localization.dart @@ -4,6 +4,7 @@ class PagesTranslations implements Translations { @override Map> get keys => { 'en': { + 'cancel_appointment': 'Cancel Appointment', 'appointment_canceling': 'Appontiment Canceling', 'are_you_sure_?': 'Are You Sure?', 'appointment_canceled_successfully': @@ -195,6 +196,7 @@ class PagesTranslations implements Translations { 'Enter your email to reset your password please \n We will send verification code to your Email.', }, 'ar': { + 'cancel_appointment': 'إلغاء الموعد', 'appointment_canceling': 'إلغاء الموعد', 'are_you_sure_?': 'هل أنت متأكد؟', 'appointment_canceled_successfully': 'تم إلغاء الموعد بنجاح', diff --git a/lib/features/card/presentation_layer/widgets/appointment_details.dart b/lib/features/card/presentation_layer/widgets/appointment_details.dart index 922aa8a..24c2b8a 100644 --- a/lib/features/card/presentation_layer/widgets/appointment_details.dart +++ b/lib/features/card/presentation_layer/widgets/appointment_details.dart @@ -99,7 +99,7 @@ class AppointmentDetails extends StatelessWidget { Obx(() { return ButtonWidget( isLoading: homeController.appointmentCancelingState.loading, - width: 250, + width: 125, onTap: () async { bool cancel = false; await showDialog( @@ -121,7 +121,7 @@ class AppointmentDetails extends StatelessWidget { child: Column( children: [ const SizedBox( - height: 56, + height: 72, ), RegularTextWidget( 'are_you_sure_?'.tr, @@ -129,7 +129,7 @@ class AppointmentDetails extends StatelessWidget { textAlign: TextAlign.center, ), const SizedBox( - height: 24, + height: 64, ), SizedBox( width: 300, @@ -169,7 +169,8 @@ class AppointmentDetails extends StatelessWidget { }); } }, - title: 'cancel'.tr, + hideTextOnLoading: true, + title: 'cancel_appointment'.tr, color: AppColors.redColor, ); }),