CustomButton constructor

const CustomButton({
  1. Key? key,
  2. Pressed pressed = Pressed.notPressed,
  3. bool vibrate = true,
  4. Color? shadowColor,
  5. CrossAxisAlignment crossAxis = CrossAxisAlignment.start,
  6. Widget? subtitle,
  7. List<Widget>? rowChildren,
  8. MainAxisAlignment mainAxis = MainAxisAlignment.center,
  9. double? width,
  10. double? height,
  11. bool isThreeD = false,
  12. required void onPressed()?,
  13. bool reversePosition = false,
  14. String? title,
  15. Widget? child,
  16. Gradient? gradient,
  17. Color? backgroundColor,
  18. Widget? iconWidget,
  19. ButtonAsset? asset,
  20. List<BoxShadow>? boxShadow,
  21. EdgeInsets? margin,
  22. EdgeInsets? padding,
  23. double? borderRadius,
  24. bool animate = false,
  25. Decoration? decoration,
  26. bool isLoading = false,
})

Implementation

const CustomButton({
  Key? key,
  this.pressed = Pressed.notPressed,
  this.vibrate = true,
  this.shadowColor,
  this.crossAxis = CrossAxisAlignment.start,
  this.subtitle,
  this.rowChildren,
  this.mainAxis = MainAxisAlignment.center,
  this.width,
  this.height,
  this.isThreeD = false,
  required this.onPressed,
  this.reversePosition = false,
  this.title,
  this.child,
  this.gradient,
  this.backgroundColor,
  this.iconWidget,
  this.asset,
  this.boxShadow,
  this.margin,
  this.padding,
  this.borderRadius,
  this.animate = false,
  this.decoration,
  this.isLoading = false, // showing the loading in the button itself
})  : assert(backgroundColor == null || gradient == null),
      assert(iconWidget == null || asset == null),
      assert(decoration == null ||
          (backgroundColor == null && boxShadow == null)),
      assert(child == null || (title == null)),
      assert(rowChildren == null ||
          (title == null &&
              child == null &&
              asset == null &&
              iconWidget == null)),
      assert((!(animate == true && height == null))),
      assert(!((pressed == Pressed.pressed && animate == false))),
      super(key: key);