import 'package:flutter/material.dart';
import 'package:hmg_flutter_template/classes/colors.dart';

class SimpleButton extends StatelessWidget {
  final String text;
  final VoidCallback? onPress;
  final Color textColor;
  final Color? color;
  final double? fontSize;
  final List<Color>? colors;

  SimpleButton(this.text, this.onPress, {this.color, this.textColor = Colors.white, this.fontSize, this.colors});

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: onPress,
      child: Container(
        alignment: Alignment.center,
        padding: const EdgeInsets.only(left: 12, right: 12, top: 4, bottom: 4),
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(6.0),
          gradient: onPress == null
              ? const LinearGradient(colors: [Color(0xffEAEAEA), Color(0xffEAEAEA)])
              : LinearGradient(
                  transform: const GradientRotation(.83),
                  begin: Alignment.topRight,
                  end: Alignment.bottomLeft,
                  colors: colors ??
                      [
                        MyColors.gradiantEndColor,
                        MyColors.gradiantStartColor,
                      ]),
        ),
        child: Text(
          text,
          style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48),
        ),
      ),
    );
  }
}
