YButton function

Widget YButton({
  1. required Widget child,
  2. double? width,
  3. double? height,
  4. Color? color,
  5. Decoration? decoration,
  6. EdgeInsetsGeometry? padding,
  7. EdgeInsetsGeometry? margin,
  8. required dynamic onTap(),
  9. bool enable = true,
  10. bool isInk = false,
  11. int? tapTime,
  12. BorderRadius borderRadius = BorderRadius.zero,
})

按钮

Implementation

Widget YButton({required Widget child, double? width, double? height, Color? color, Decoration? decoration, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, required Function() onTap, bool enable = true, bool isInk = false, int? tapTime, BorderRadius borderRadius = BorderRadius.zero}) {
  return Container(
    width: width,
    height: height,
    margin: margin,
    child: ClipRRect(
      borderRadius: borderRadius,
      child: Container(
        color: decoration == null ? color : null,
        decoration: decoration,
        child: isInk
            ? YInkButton(
                Padding(padding: padding ?? EdgeInsets.zero, child: child),
                onTap: onTap,
                enable: enable,
                tapTime: tapTime,
              )
            : _YFlatButton(
                Padding(padding: padding ?? EdgeInsets.zero, child: child),
                onClick: onTap,
                enable: enable,
                tapTime: tapTime,
              ),
      ),
    ),
  );
}