import 'package:flutter/material.dart'; import 'package:test_sa/extensions/context_extension.dart'; import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; import 'package:test_sa/models/new_models/gas_refill_model.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; class AppFilledButton extends StatelessWidget { final VoidCallback? onPressed; final String label; final bool maxWidth, loading; final double? fontSize; final bool showIcon; final Widget? icon; final Color? buttonColor; final Color? textColor; final bool showBorder; final double radius; final int height; final bool disableButton; const AppFilledButton( {this.onPressed, required this.label, this.maxWidth = false, this.showIcon = false, this.icon, this.fontSize, this.loading = false, this.height = 56, this.showBorder = false, this.disableButton = false, this.buttonColor, this.textColor, this.radius = 10, Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( height: height.toScreenHeight, width: maxWidth ? double.infinity : null, alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: disableButton ?context.isDark ?AppColor.neutral20 :AppColor.neutral140 : (buttonColor ?? AppColor.blueStatus(context)), border: showBorder ? Border.all(color: textColor ?? AppColor.background(context)) : null, ), child: loading ? SizedBox( width: 24.toScreenHeight, height: 24.toScreenHeight, child: CircularProgressIndicator( color: textColor ?? AppColor.background(context), strokeWidth: 2, ), ) : showIcon && icon != null ? Row(mainAxisAlignment: MainAxisAlignment.center, children: [ icon!, 8.width, label.heading6(context).custom(color: textColor ?? AppColor.background(context)), ]) : label.heading6(context).custom( color: disableButton ? AppColor.neutral150 : (textColor ?? AppColor.background(context)), align: TextAlign.center, fontSize: fontSize ?? 16.toScreenWidth, ), ).onPress(disableButton ? null : (loading ? null : onPressed)); } }