LoaderButton constructor

LoaderButton({
  1. Key? key,
  2. required String text,
  3. required bool isLoading,
  4. VoidCallback? onTap,
  5. Color? backgroundColor,
  6. Color? textColor,
  7. double? width,
  8. double? height,
  9. double? fontSize,
  10. double? borderRadius,
  11. double? elevation,
  12. EdgeInsetsGeometry? margin,
  13. EdgeInsetsGeometry? padding,
})

Implementation

LoaderButton({
  super.key,
  required String text,
  required bool isLoading,
  VoidCallback? onTap,
  Color? backgroundColor,
  Color? textColor,
  double? width,
  double? height,
  double? fontSize,
  double? borderRadius,
  double? elevation,
  EdgeInsetsGeometry? margin,
  EdgeInsetsGeometry? padding,
}) : super(
  text: text,
  onTap: onTap,
  backgroundColor: backgroundColor,
  textColor: textColor,
  width: width,
  height: height,
  fontSize: fontSize,
  borderRadius: borderRadius,
  elevation: elevation,
  margin: margin,
  padding: padding,
  isLoading: isLoading, // 🔑 use base class loader toggle
  // show loader **beside** text
  leading: isLoading
      ? SizedBox(
    height: 18,
    width: 18,
    child: CircularProgressIndicator(
      color: textColor ?? ColorResource.whiteColor,
      strokeWidth: 2,
    ),
  )
      : null,
);