import 'package:flutter/material.dart'; import 'package:qadirneyriz/config/config.dart'; // ignore: must_be_immutable class CustomButton extends StatelessWidget { CustomButton({ super.key, this.onPressed, required this.hieght, this.fontSize = 16, this.width, this.isCircle = false, this.color, this.borderRadius = 20, this.fontWeight, this.gradient, this.textColor = Colors.white, required this.text, }); double? width; double hieght; String text; bool isCircle; final Gradient? gradient; final double borderRadius; double? fontSize; Color? color; Color textColor; FontWeight? fontWeight; void Function()? onPressed; @override Widget build(BuildContext context) { return Container( width: width, height: hieght, decoration: BoxDecoration( gradient: gradient, borderRadius: isCircle ? null // اگر دکمه دایره باشد، از borderRadius استفاده نمی‌شود : BorderRadius.circular(borderRadius), ), child: ElevatedButton( onPressed: onPressed, style: ElevatedButton.styleFrom( backgroundColor: gradient == null ? color ?? config.ui.mainGreen : Colors.transparent, shadowColor: (gradient != null) ? Colors.transparent : null, shape: isCircle == false ? RoundedRectangleBorder( borderRadius: BorderRadius.circular(borderRadius), ) : const CircleBorder(), ), child: Text( text, style: TextStyle( fontSize: fontSize, fontWeight: fontWeight, color: textColor, ), ), ), ); } }