import 'package:flutter/material.dart'; import 'package:initial_folder/providers/theme_provider.dart'; import 'package:provider/provider.dart'; import '../../theme.dart'; import '../../size_config.dart'; class DefaultButton extends StatelessWidget { const DefaultButton({ Key? key, this.text = '', this.weight = semiBold, this.press, this.isCart, }) : super(key: key); final String text; final FontWeight weight; final VoidCallback? press; final bool? isCart; @override Widget build(BuildContext context) { final themeProvider = Provider.of(context); return SizedBox( width: isCart != null ? getProportionateScreenWidth(120) : getProportionateScreenWidth(300), height: isCart != null ? getProportionateScreenWidth(40) : getProportionateScreenWidth(44), child: TextButton( style: TextButton.styleFrom( foregroundColor: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(getProportionateScreenWidth(10))), backgroundColor: themeProvider.themeData == ThemeClass.darkmode ?primaryColor : primaryColorligtmode), onPressed: press, child: Text( text, style: thirdTextStyle.copyWith( fontSize: getProportionateScreenWidth(12), fontWeight: weight, color: baruTextutih, letterSpacing: 0.3), ), ), ); } }