DefaultTextButtonStyle constructor

DefaultTextButtonStyle({
  1. Color? color,
  2. Color? backgroundColor,
  3. Color? focusedAndSelectedColor,
  4. Color? focusedAndSelectedBackgroundColor,
  5. Color? disabledColor,
  6. Color? disabledBackgroundColor,
  7. Color? borderColor,
  8. double radius = 6.0,
  9. double width = 0,
  10. EdgeInsetsGeometry? padding,
})

Implementation

factory DefaultTextButtonStyle(
    {Color? color,
    Color? backgroundColor,
    Color? focusedAndSelectedColor,
    Color? focusedAndSelectedBackgroundColor,
    Color? disabledColor,
    Color? disabledBackgroundColor,
    Color? borderColor,
    double radius = 6.0,
    double width = 0,
    EdgeInsetsGeometry? padding}) {
  return DefaultTextButtonStyle._(
    TextButton.styleFrom(
      padding: padding,
      primary: color,
      onSurface: color,
      backgroundColor: backgroundColor,
      shape: RoundedRectangleBorder(
        side: width <= 0 || borderColor == Colors.transparent
            ? BorderSide.none
            : BorderSide(color: borderColor ?? Colors.black, width: width),
        borderRadius: radius <= 0
            ? BorderRadius.zero
            : BorderRadius.all(
                Radius.circular(radius),
              ),
      ),
    )
        .addState(
      foregroundColor: focusedAndSelectedColor,
      backgroundColor: focusedAndSelectedBackgroundColor,
    )
        .addState(
      foregroundColor: disabledColor,
      backgroundColor: disabledBackgroundColor,
      state: {
        MaterialState.disabled,
      },
    ),
  );
}