import 'package:absensi_sas/app/constant.dart';
import 'package:flutter/material.dart';

class CustomButtonOrange extends StatelessWidget {
  const CustomButtonOrange({super.key, required this.btnText, this.onPressed});
  final Function()? onPressed;
  final String btnText;

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(boxShadow: [
        BoxShadow(
          color: Constant.textOrange.withOpacity(0.24),
          spreadRadius: 0,
          blurRadius: 16,
          offset: Offset(0, 8), // changes position of shadow
        ),
      ]),
      child: ElevatedButton(
          style: ButtonStyle(
              elevation: MaterialStatePropertyAll(0),
              shape: MaterialStatePropertyAll(RoundedRectangleBorder(
                  side: BorderSide(
                    color: Constant.textOrange,
                  ),
                  borderRadius: BorderRadius.circular(8))),
              backgroundColor: MaterialStateProperty.resolveWith((states) {
                return Constant.textOrange;
              }),
              overlayColor:
                  MaterialStatePropertyAll(Colors.white.withOpacity(0.3)),
              foregroundColor: MaterialStatePropertyAll(Constant.textOrange),
              shadowColor: MaterialStatePropertyAll(Constant.textOrange),
              surfaceTintColor: MaterialStatePropertyAll(Constant.textOrange)),
          onPressed: onPressed,
          child: Text(
            btnText,
            style: Constant.body_14(context: context)
                .copyWith(color: Colors.white, fontWeight: FontWeight.w700),
          )),
    );
  }
}

class CustomButtonWhite extends StatelessWidget {
  const CustomButtonWhite({super.key, required this.btnText, this.onPressed});
  final Function()? onPressed;
  final String btnText;

  @override
  Widget build(BuildContext context) {
    return ElevatedButton(
      onPressed: onPressed,
      child: Text(
        btnText,
        style: Constant.body_14(context: context)
            .copyWith(color: Colors.black, fontWeight: FontWeight.w700),
      ),
      style: ButtonStyle(
          elevation: MaterialStatePropertyAll(0),
          shape: MaterialStatePropertyAll(RoundedRectangleBorder(
              side: BorderSide(
                color: Colors.grey.shade300,
              ),
              borderRadius: BorderRadius.circular(8))),
          backgroundColor: MaterialStateProperty.resolveWith((states) {
            return Colors.white;
          }),
          overlayColor:
              MaterialStatePropertyAll(Constant.textOrange.withOpacity(0.48)),
          foregroundColor: MaterialStatePropertyAll(Colors.white),
          shadowColor: MaterialStatePropertyAll(Colors.white),
          surfaceTintColor: MaterialStatePropertyAll(Colors.white)),
    );
  }
}
