import 'package:wanisclient/config/custom_text.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../config/language/language_enum.dart'; import '../providers/language_provider.dart'; import '../utils/colors.dart'; // Import the provider package class CustomButton extends StatelessWidget { CustomButton({ super.key, required this.title, this.onClick, required this.backgroundColor , this.height, this.width, this.padding, this.fontSize, this.borderRadius = 25, this.txtColor = Colors.white, this.loadercolor = AppNewColors.secondaryColor, this.borderColor = AppNewColors.primaryColor, this.isloading = false, }); final String title; final VoidCallback? onClick; Color backgroundColor; final double? height; final double? width; final EdgeInsetsGeometry? padding; final double? fontSize; final double? borderRadius; bool? isloading; Color loadercolor; Color txtColor; Color borderColor; @override Widget build(BuildContext context) { LanguageProvider? languageProvider; try { languageProvider = Provider.of(context); } catch (e) { debugPrint("LanguageProvider not found"); } bool isArabic = languageProvider?.currentLangCode == Language.ar; return Padding( padding: padding ?? EdgeInsets.zero, child: SizedBox( width: width, height: height ?? 54, child: Container( //color: backgroundColor, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ backgroundColor.withOpacity(.2), backgroundColor, ], stops: [0, 0,], ), borderRadius: BorderRadius.circular(borderRadius ?? 50), ), child: InkWell( onTap: onClick, borderRadius: BorderRadius.circular(borderRadius ?? 50), child: Container( decoration: BoxDecoration( border: Border.all(color: borderColor), borderRadius: BorderRadius.circular(borderRadius ?? 50), ), alignment: Alignment.center, child: isloading != null && isloading == true ? SizedBox( width: 30, height: 30, child: CircularProgressIndicator( color: loadercolor, strokeWidth: 3, ), ) : Txt( text: title, textAlign: TextAlign.center, style: TextStyle( fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Baloo_Bhaijaan_2' : 'Inter', fontSize: fontSize ?? 15, height: 1.60, color: txtColor), ), ), ), ), ), ); } }