This commit is contained in:
MhdZiadHirati 2023-10-25 12:41:12 +03:00
parent aa3fd49d81
commit 441516a472
3 changed files with 71 additions and 41 deletions

View File

@ -17,8 +17,9 @@ class ButtonWidget extends StatelessWidget {
final double? buttonHeight; final double? buttonHeight;
final bool hideTextOnLoading; final bool hideTextOnLoading;
final double? fontSize; final double? fontSize;
const ButtonWidget( final bool columnShapeOnLoading;
{super.key, const ButtonWidget({
super.key,
required this.onTap, required this.onTap,
required this.title, required this.title,
this.color, this.color,
@ -30,7 +31,9 @@ class ButtonWidget extends StatelessWidget {
this.buttonHeight, this.buttonHeight,
this.fontSize, this.fontSize,
this.textColor, this.textColor,
this.isLoading = false}); this.isLoading = false,
this.columnShapeOnLoading = false,
});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -52,7 +55,31 @@ class ButtonWidget extends StatelessWidget {
]) ])
: isLoading! : isLoading!
//wrap (Loader with visibility instead of repeating it) //wrap (Loader with visibility instead of repeating it)
? Row( ? (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, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Visibility( Visibility(

View File

@ -4,6 +4,7 @@ class PagesTranslations implements Translations {
@override @override
Map<String, Map<String, String>> get keys => { Map<String, Map<String, String>> get keys => {
'en': { 'en': {
'cancel_appointment': 'Cancel Appointment',
'appointment_canceling': 'Appontiment Canceling', 'appointment_canceling': 'Appontiment Canceling',
'are_you_sure_?': 'Are You Sure?', 'are_you_sure_?': 'Are You Sure?',
'appointment_canceled_successfully': '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.', 'Enter your email to reset your password please \n We will send verification code to your Email.',
}, },
'ar': { 'ar': {
'cancel_appointment': 'إلغاء الموعد',
'appointment_canceling': 'إلغاء الموعد', 'appointment_canceling': 'إلغاء الموعد',
'are_you_sure_?': 'هل أنت متأكد؟', 'are_you_sure_?': 'هل أنت متأكد؟',
'appointment_canceled_successfully': 'تم إلغاء الموعد بنجاح', 'appointment_canceled_successfully': 'تم إلغاء الموعد بنجاح',

View File

@ -99,7 +99,7 @@ class AppointmentDetails extends StatelessWidget {
Obx(() { Obx(() {
return ButtonWidget( return ButtonWidget(
isLoading: homeController.appointmentCancelingState.loading, isLoading: homeController.appointmentCancelingState.loading,
width: 250, width: 125,
onTap: () async { onTap: () async {
bool cancel = false; bool cancel = false;
await showDialog( await showDialog(
@ -121,7 +121,7 @@ class AppointmentDetails extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
const SizedBox( const SizedBox(
height: 56, height: 72,
), ),
RegularTextWidget( RegularTextWidget(
'are_you_sure_?'.tr, 'are_you_sure_?'.tr,
@ -129,7 +129,7 @@ class AppointmentDetails extends StatelessWidget {
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
const SizedBox( const SizedBox(
height: 24, height: 64,
), ),
SizedBox( SizedBox(
width: 300, width: 300,
@ -169,7 +169,8 @@ class AppointmentDetails extends StatelessWidget {
}); });
} }
}, },
title: 'cancel'.tr, hideTextOnLoading: true,
title: 'cancel_appointment'.tr,
color: AppColors.redColor, color: AppColors.redColor,
); );
}), }),