import 'package:flutter/material.dart';
class UIButton extends StatelessWidget {
final Widget child;
final VoidCallback onPressed;
final Key key;
final VoidCallback onLongPress;
final Clip clipBehavior;
final Color foregroundColor;
final Color backgroundColor;
final Color shadowColor;
final Color overlayColor;
final double elevation;
final EdgeInsetsGeometry padding;
final Size minimumSize;
final BorderSide side;
final bool enableInkEffect;
final BorderRadius borderRadius;
UIButton({
this.key,
@required this.child,
@required this.onPressed,
this.onLongPress,
this.foregroundColor,
this.backgroundColor,
this.clipBehavior,
this.shadowColor,
this.elevation = 0,
this.padding,
this.minimumSize,
this.side,
this.enableInkEffect,
this.overlayColor,
this.borderRadius
});
@override
Widget build(BuildContext context) {
ButtonStyle style = ButtonStyle(
foregroundColor: MaterialStateProperty.all(foregroundColor),
backgroundColor: MaterialStateProperty.all(backgroundColor),
elevation: MaterialStateProperty.all(elevation),
shadowColor: MaterialStateProperty.all(shadowColor),
padding: MaterialStateProperty.all(padding),
minimumSize: MaterialStateProperty.all(minimumSize ?? Size(0, 0)),
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: borderRadius ?? BorderRadius.circular(8.0),
side: side
),),
enableFeedback: false,
splashFactory: enableInkEffect == false ? NoSplash.splashFactory : null,
overlayColor: MaterialStateProperty.all(overlayColor),
);
return TextButton(
key: key,
onPressed: onPressed,
onLongPress: onLongPress,
clipBehavior: clipBehavior ?? Clip.none,
child: child,
style: style,
);
}
}