JuiButton.ghostSecondary constructor

JuiButton.ghostSecondary({
  1. Key? key,
  2. required String label,
  3. required VoidCallback? onPressed,
  4. VoidCallback? onLongPress,
  5. ButtonStyle? style,
  6. FocusNode? focusNode,
  7. bool autofocus = false,
  8. Clip clipBehavior = Clip.none,
  9. double width = double.infinity,
  10. double height = 48.0,
  11. Color? textColor = JuiColors.white,
  12. Color? backgroundColor = Colors.transparent,
  13. bool showBorder = true,
  14. bool? disabled,
  15. bool? loading,
})

Implementation

JuiButton.ghostSecondary({
  Key? key,
  required String label,
  required VoidCallback? onPressed,
  VoidCallback? onLongPress,
  ButtonStyle? style,
  FocusNode? focusNode,
  bool autofocus = false,
  Clip clipBehavior = Clip.none,
  double width = double.infinity,
  double height = 48.0,
  Color? textColor = JuiColors.white,
  Color? backgroundColor = Colors.transparent,
  bool showBorder = true,
  bool? disabled,
  bool? loading,
}) : super(
        key: key,
        onPressed: (disabled == true || loading == true) ? null : onPressed,
        onLongPress: (disabled == true || loading == true) ? null : onLongPress,
        style: ButtonStyle(
          foregroundColor: MaterialStateProperty.all<Color?>(
            (disabled == true || loading == true) ? JuiColors.gray.shade300 : textColor,
          ),
          backgroundColor: MaterialStateProperty.all<Color?>(backgroundColor),
          fixedSize: MaterialStateProperty.all<Size?>(Size(width, height)),
          elevation: MaterialStateProperty.all<double>(0),
          shape: MaterialStateProperty.all<OutlinedBorder?>(
            RoundedRectangleBorder(
              side: BorderSide(
                color: showBorder
                    ? ((disabled == true || loading == true)
                        ? JuiColors.white.withOpacity(0.5)
                        : JuiColors.white)
                    : Colors.transparent,
                width: 1.0,
              ),
              borderRadius: BorderRadius.circular(height / 2),
            ),
          ),
        ),
        focusNode: focusNode,
        autofocus: autofocus,
        clipBehavior: clipBehavior,
        child: Padding(
          padding: const EdgeInsets.symmetric(vertical: 12.0),
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              if (loading == true)
                SizedBox(
                  width: JuiBreakpoints.b16,
                  height: JuiBreakpoints.b16,
                  child: CircularProgressIndicator(
                    strokeWidth: 2.0,
                    color: JuiColors.white.withOpacity(0.5),
                  ),
                ),
              if (loading == true) const SizedBox(width: JuiBreakpoints.b16),
              Text(
                label,
                overflow: TextOverflow.clip,
                style: const TextStyle().regularSemiBold(
                  color: (disabled == true || loading == true)
                      ? JuiColors.white.withOpacity(0.5)
                      : textColor,
                ),
              ),
              if (loading == true)
                Expanded(
                  child: Container(
                    width: JuiBreakpoints.b32,
                    constraints: const BoxConstraints(
                      maxWidth: JuiBreakpoints.b32,
                      minWidth: 0,
                    ),
                  ),
                ),
            ],
          ),
        ),
      );