customButton method

Widget customButton({
  1. required VoidCallback onPressed,
  2. double padding = 12.0,
  3. double radius = 8.0,
  4. Color color = Colors.blue,
  5. Color textColor = Colors.white,
  6. TextStyle? textStyle,
})

Creates a custom button with specified padding, text style, and onPressed action.

Implementation

Widget customButton({
  required VoidCallback onPressed,
  double padding = 12.0,
  double radius = 8.0,
  Color color = Colors.blue,
  Color textColor = Colors.white,
  TextStyle? textStyle,
}) {
  return ElevatedButton(
    onPressed: onPressed,
    style: ButtonStyle(
      padding: WidgetStateProperty.all(EdgeInsets.all(padding)),
      backgroundColor: WidgetStateProperty.all(color),
      shape: WidgetStateProperty.all(RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(radius),
      )),
    ),
    child: DefaultTextStyle(
      style: textStyle ?? TextStyle(color: textColor),
      child: this,
    ),
  );
}