JuiButton.ghostSecondary constructor
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,
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,
),
),
),
],
),
),
);