RoundedButton constructor

RoundedButton({
  1. Key? key,
  2. required String text,
  3. required VoidCallback? onPressed,
  4. Color textColor = Colors.white,
  5. double fontSize = 16.0,
  6. double borderRadius = 30.0,
  7. double height = 60.0,
  8. Color? backgroundColor,
  9. String? leadingIcon,
  10. Color? circularProgressBarColor,
  11. bool isLoading = false,
})

Implementation

RoundedButton({
  super.key,
  required String text,
  required super.onPressed,
  Color textColor = Colors.white,
  double fontSize = 16.0,
  double borderRadius = 30.0,
  double height = 60.0,
  Color? backgroundColor,
  String? leadingIcon,
  Color? circularProgressBarColor,
  bool isLoading = false,
}) : super(
       style: ElevatedButton.styleFrom(
         minimumSize: Size(double.maxFinite, height),
         backgroundColor: backgroundColor ?? AppColors.elfGreen,
         // Button background color
         shape: RoundedRectangleBorder(
           borderRadius: BorderRadius.circular(
             borderRadius,
           ), // Rounded corners
         ),
       ),
       child: Row(
         mainAxisAlignment: MainAxisAlignment.center,
         children: [
           if (leadingIcon != null)
             Image.asset(leadingIcon, width: 20, height: 20),
           if (leadingIcon != null) const SizedBox(width: 4),
           isLoading
               ? SizedBox(
                 height: 20,
                 width: 20,
                 child: CircularProgressIndicator(
                   color: circularProgressBarColor ?? AppColors.white,
                 ),
               )
               : InterMediumText(text, color: textColor, fontSize: fontSize),
         ],
       ),
     );