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 Color buttonColor;
  final Color textColor;

  const AppFilledButton({
    @required this.onPressed,
    @required this.label,
    this.maxWidth = false,
    this.loading = 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)),
      child: label.heading6(context).custom(color: textColor ?? AppColor.background(context)),
    ).onPress(onPressed);
  }
}
