DTButton constructor

const DTButton({
  1. Key? key,
  2. required VoidCallback? onPressed,
  3. bool loading = false,
  4. ValueChanged<bool>? onHighlightChanged,
  5. TextStyle? textStyle,
  6. BoxShadow? boxShadow,
  7. bool? buttonBoxShadow,
  8. Color? focusColor,
  9. Color? hoverColor,
  10. Color? highlightColor,
  11. Color? splashColor,
  12. double elevation = 0.0,
  13. double focusElevation = 4.0,
  14. double hoverElevation = 4.0,
  15. double highlightElevation = 1.0,
  16. double disabledElevation = 0.0,
  17. EdgeInsetsGeometry padding = const EdgeInsets.symmetric(horizontal: 8),
  18. BoxConstraints? constraints,
  19. ShapeBorder? borderShape,
  20. Duration animationDuration = kThemeChangeDuration,
  21. Clip clipBehavior = Clip.none,
  22. FocusNode? focusNode,
  23. bool autofocus = false,
  24. MaterialTapTargetSize? materialTapTargetSize,
  25. Widget? child,
  26. DTButtonType type = DTButtonType.solid,
  27. DTButtonShape shape = DTButtonShape.standard,
  28. Color color = DTColors.PRIMARY,
  29. Color? textColor,
  30. DTIconPosition position = DTIconPosition.start,
  31. double size = DTSize.MEDIUM,
  32. BorderSide? borderSide,
  33. String? text,
  34. Widget? icon,
  35. bool? blockButton,
  36. bool? fullWidthButton,
  37. ColorScheme? colorScheme,
  38. bool? enableFeedback,
  39. VoidCallback? onLongPress,
  40. Color? disabledColor,
  41. Color? disabledTextColor,
  42. double? minWidth,
})

Implementation

const DTButton({
  Key? key,
  required this.onPressed,
  this.loading = false,
  this.onHighlightChanged,
  this.textStyle,
  this.boxShadow,
  this.buttonBoxShadow,
  this.focusColor,
  this.hoverColor,
  this.highlightColor,
  this.splashColor,
  this.elevation = 0.0,
  this.focusElevation = 4.0,
  this.hoverElevation = 4.0,
  this.highlightElevation = 1.0,
  this.disabledElevation = 0.0,
  this.padding = const EdgeInsets.symmetric(horizontal: 8),
  this.constraints,
  this.borderShape,
  this.animationDuration = kThemeChangeDuration,
  this.clipBehavior = Clip.none,
  this.focusNode,
  this.autofocus = false,
  MaterialTapTargetSize? materialTapTargetSize,
  this.child,
  this.type = DTButtonType.solid,
  this.shape = DTButtonShape.standard,
  this.color = DTColors.PRIMARY,
  this.textColor,
  this.position = DTIconPosition.start,
  this.size = DTSize.MEDIUM,
  this.borderSide,
  this.text,
  this.icon,
  this.blockButton,
  this.fullWidthButton,
  this.colorScheme,
  this.enableFeedback,
  this.onLongPress,
  this.disabledColor,
  this.disabledTextColor,
  this.minWidth
})  : materialTapTargetSize =
    materialTapTargetSize ?? MaterialTapTargetSize.padded,
// assert(elevation != null && elevation >= 0.0),
      assert(focusElevation >= 0.0),
      assert(hoverElevation >= 0.0),
      assert(highlightElevation >= 0.0),
      assert(disabledElevation >= 0.0),
      super(key: key);