import 'package:flutter/material.dart';
class CustomButton extends StatelessWidget {
  final VoidCallback onPressed;
  final String buttonText;
  final Color buttonColor;
  final EdgeInsets buttonPadding;
  final EdgeInsets iconPadding;
  final Widget? icon;
  final TextStyle? textStyle;
  final double radius;
  final BorderSide? sideBorder;
  const CustomButton({
    Key? key,
    required this.onPressed,
    required this.buttonText,
    required this.buttonColor,
    this.radius = 50,
    this.buttonPadding = const EdgeInsets.symmetric(horizontal: 0, vertical: 0),
    this.iconPadding = const EdgeInsets.only(right: 0),
    this.icon,
    this.textStyle,
    this.sideBorder,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ElevatedButton(
      onPressed: onPressed,
      style: ElevatedButton.styleFrom(
        padding: buttonPadding,
        backgroundColor: buttonColor,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(radius),
          side: sideBorder ?? BorderSide.none,
        ),
        elevation: 0.0,
        alignment: Alignment.center,
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          if (icon != null) ...[
            Padding(
              padding: iconPadding,
              child: icon,
            ),
          ],
          Text(
            buttonText,
            style: textStyle ??
                Theme.of(context).textTheme.labelLarge?.copyWith(
                      color: Colors.white,
                    ),
          ),
        ],
      ),
    );
  }
}
