showWarningAlert function

void showWarningAlert(
  1. String errorMessage,
  2. Function onConfirmed
)

Implementation

void showWarningAlert(String errorMessage, Function onConfirmed) {
  showDialog(
    context: currentContext!,
    builder: (BuildContext context) {
      return Alerts(
        title: 'Warning',
        icon: Icons.warning,
        iconColor: Colors.orange,
        actions: [
          Align(
              alignment: Alignment.centerLeft,
              child: Text(errorMessage, style: const TextStyle(fontSize: 18))),
          Padding(
            padding: const EdgeInsets.only(bottom: 12),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.end,
              children: [
                TextButton(
                    onPressed: () => Navigator.of(context).pop(),
                    child: const Text('No')),
                TextButton(
                    onPressed: () => onConfirmed(), child: const Text('Yes'))
              ],
            ),
          ),
        ],
      );
    },
  );
}