asButton function
Widget
asButton(
- BuildContext context, {
- required Function onPressed,
- required Widget child,
- EdgeInsets? margin,
- EdgeInsets? padding,
- double? height,
- double? width,
- Alignment? alignment,
- Color? backgroundColor,
- BorderRadius? borderRadius,
- double? elevation,
Implementation
Widget asButton(
BuildContext context, {
required Function onPressed,
required Widget child,
EdgeInsets? margin,
EdgeInsets? padding,
double? height,
double? width,
Alignment? alignment,
Color? backgroundColor,
BorderRadius? borderRadius,
double? elevation,
}) {
elevation ??= 0.5;
return Container(
height: height,
width: width,
margin: margin,
padding: padding,
alignment: alignment,
child: ElevatedButton(
onPressed: () {
onPressed();
},
child: child,
style: ButtonStyle(
elevation: MaterialStateProperty.all(elevation),
backgroundColor: MaterialStateProperty.all(
backgroundColor ?? const Color.fromRGBO(212, 84, 11, 1.0)
),
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: borderRadius ?? BorderRadius.circular(8)))),
),
);
}