77 lines
2.0 KiB
Dart
77 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
|
|
|
|
class CustomAppButton extends StatelessWidget {
|
|
final String buttonText;
|
|
final VoidCallback? onTap;
|
|
final Color? buttonColor;
|
|
final Color? textColor;
|
|
final Color? borderColor;
|
|
final bool isLoading;
|
|
|
|
const CustomAppButton({
|
|
super.key,
|
|
this.buttonColor,
|
|
this.textColor,
|
|
required this.buttonText,
|
|
this.onTap,
|
|
this.isLoading = false,
|
|
this.borderColor,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: () {
|
|
if(isLoading) {
|
|
return;
|
|
}
|
|
FocusScope.of(context).unfocus();
|
|
if(onTap!=null) {
|
|
onTap!();
|
|
}
|
|
},
|
|
child: Container(
|
|
height: 48.h,
|
|
decoration: BoxDecoration(
|
|
color: buttonColor ?? CustomAppColors.kSecondaryColor,
|
|
borderRadius: BorderRadius.circular(3.r),
|
|
border: Border.all(
|
|
color: borderColor ?? CustomAppColors.kSecondaryColor,
|
|
),
|
|
),
|
|
// padding: EdgeInsets.symmetric(vertical: 15.h,),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
CustomTextWidget(
|
|
text: buttonText,
|
|
fontWeight: FontWeight.w600,
|
|
isExpanded: false,
|
|
fontSize: 16.sp,
|
|
fontColor: textColor ?? CustomAppColors.kPrimaryColor,
|
|
),
|
|
|
|
Visibility(
|
|
visible: isLoading,
|
|
child: Padding(
|
|
padding: EdgeInsets.only(left: 8.0.w),
|
|
child: SizedBox(
|
|
height: 15.h,
|
|
width: 15.w,
|
|
child: CircularProgressIndicator(
|
|
color: textColor ?? CustomAppColors.kPrimaryColor,
|
|
strokeWidth: 3.0.w,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|