JuiButton.ghostSecondaryLigth constructor

JuiButton.ghostSecondaryLigth({
  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 = 35.0,
  11. Color? textColor = JuiColors.primarySwatch,
  12. Color? backgroundColor = Colors.transparent,
  13. Color colorBorder = JuiColors.tertiaryColor,
  14. bool showBorder = true,
  15. bool? disabled,
  16. bool? loading,
})

Implementation

JuiButton.ghostSecondaryLigth({
  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 = 35.0,
  Color? textColor = JuiColors.primarySwatch,
  Color? backgroundColor = Colors.transparent,
  Color colorBorder = JuiColors.tertiaryColor,
  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 : 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)
                        ? colorBorder.withOpacity(0.5)
                        : colorBorder)
                    : Colors.transparent,
                width: 1.0,
              ),
              borderRadius: BorderRadius.circular(height / 3),
            ),
          ),
        ),
        focusNode: focusNode,
        autofocus: autofocus,
        clipBehavior: clipBehavior,
        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: Colors.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)
                    ? Colors.white.withOpacity(0.5)
                    : textColor,
              ),
            ),
            if (loading == true)
              Expanded(
                child: Container(
                  width: JuiBreakpoints.b32,
                  constraints: const BoxConstraints(
                    maxWidth: JuiBreakpoints.b32,
                    minWidth: 0,
                  ),
                ),
              ),
          ],
        ),
      );