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

Future ApprovalDialogConfirmation(
    {required BuildContext context,
    required String typename,
    required String textInformation,
    required String staffName,
    required Function() confirmFunc}) {
  return showDialog(
    context: context,
    builder: (BuildContext context) => Container(
      decoration: BoxDecoration(
          gradient: LinearGradient(
              begin: Alignment.centerRight,
              end: Alignment.centerLeft,
              colors: [
            Color(0xff161C24).withOpacity(0.91),
            Color(0xff161C24).withOpacity(0.3)
          ])),
      child: AlertDialog(
        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
        backgroundColor: Colors.white,
        surfaceTintColor: Colors.white,
        shadowColor: Colors.white,
        title: Text(
          'Konfirmasi',
          style: Constant.titleH1_700_18(context: context),
        ),
        content: Text.rich(TextSpan(
            text: "Apakah anda yakin untuk ",
            style: Constant.body_16(context: context)
                .copyWith(fontWeight: FontWeight.w400),
            children: [
              TextSpan(
                  text: textInformation,
                  style: Constant.body_16(context: context)),
              TextSpan(
                  text: "${typename} ",
                  style: Constant.body_16(context: context)
                      .copyWith(fontWeight: FontWeight.w400)),
              TextSpan(
                  text: "${staffName} ?",
                  style: Constant.body_16(context: context))
            ])),
        actions: <Widget>[
          Column(
            children: [
              Container(
                width: MediaQuery.of(context).size.width,
                child: CustomButtonOrange(
                  btnText: "Yakin",
                  onPressed: confirmFunc,
                ),
              ),
              SizedBox(
                height: 3,
              ),
              Container(
                width: MediaQuery.of(context).size.width,
                child: CustomButtonWhite(
                  btnText: "Batal",
                  onPressed: () {
                    Navigator.pop(context);
                  },
                ),
              ),
            ],
          ),
        ],
      ),
    ),
  );
}
