import 'package:flutter/material.dart';

import '../../../core.dart';

Future<void> buildWarningDialog({
  required String title,
  required String middleText,
  required Future<void> Function() onConfirm,
  required Future<void> Function() onRefresh,
}) async {
  await Get.defaultDialog(
    title: title,
    middleText: middleText,
    confirm: ElevatedButton(
      style: ElevatedButton.styleFrom(
        backgroundColor: AppColor.error,
        foregroundColor: Colors.white,
      ),
      onPressed: () async {
        await onConfirm();
        onRefresh();
        Get.back();
      },
      child: Text('بله'),
    ),
    cancel: ElevatedButton(
      onPressed: () {
        Get.back();
      },
      child: Text('خیر'),
    ),
  );
}
