GFButton constructor

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

Create buttons of all types. check out GFIconButton for icon buttons, and GFBadge for badges

Implementation

const GFButton({
  Key? key,
  required this.onPressed,
  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 = GFButtonType.solid,
  this.shape = GFButtonShape.standard,
  this.color = GFColors.PRIMARY,
  this.textColor,
  this.position = GFPosition.start,
  this.size = GFSize.MEDIUM,
  this.borderSide,
  this.text,
  this.icon,
  this.blockButton,
  this.fullWidthButton,
  this.colorScheme,
  this.enableFeedback,
  this.onLongPress,
  this.disabledColor,
  this.disabledTextColor,
})  : 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);