import 'package:flutter/material.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/new_views/app_style/app_color.dart'; class AppFilledButton extends StatelessWidget { final VoidCallback? onPressed; final String label; final bool maxWidth, loading; final bool showIcon; final Widget? icon; final Color? buttonColor; final Color? textColor; final bool showBorder; const AppFilledButton( {this.onPressed, required this.label, this.maxWidth = false, this.showIcon = false, this.icon, this.loading = false, this.showBorder = false, this.buttonColor, this.textColor, Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( height: 56.toScreenHeight, width: maxWidth ? double.infinity : null, alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: buttonColor ?? AppColor.blueStatus(context), border: showBorder ? Border.all(color: textColor ?? AppColor.background(context)) : null, ), child: loading ? SizedBox( width: 24, height: 24, 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: textColor ?? AppColor.background(context)), ).onPress(onPressed); } }