import 'package:e_commerce_training/res/R.dart';
import 'package:e_commerce_training/res/R.dart';
import 'package:e_commerce_training/res/R.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter/material.dart';

class ButtonWidget extends StatelessWidget {
  final Color? backgroundColor;
  final Color? textColor;
  final Color? borderColor;
  final String title;
  final VoidCallback onPressed;
  final double? radius;
  final bool modeFlatButton;

  ButtonWidget({
    this.backgroundColor,
    this.textColor,
    this.borderColor,
    required this.title,
    required this.onPressed,
    this.radius,
    this.modeFlatButton: false,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onPressed,
      child: Container(
//        color: backgroundColor,
        alignment: Alignment.center,
        padding: EdgeInsets.all(10),
        decoration: BoxDecoration(
            color: backgroundColor ?? R.color.accentColor,
//            gradient: LinearGradient(
//              colors: [Theme.of(context).R.color.primaryColor, Colors.lightBlue],
//            ),
            border: Border.all(
                color: borderColor ?? backgroundColor ?? R.color.accentColor,
                width: 1),
            borderRadius: BorderRadius.circular(5)),
        child: Text(
          title,
          style: TextStyle(
              color: textColor ?? R.color.white,
              fontSize: 22.sp,
              fontWeight: FontWeight.w500),
        ),
      ),
    );
  }
}