cShowAlwaysOnTopAlert function

void cShowAlwaysOnTopAlert({
  1. required BuildContext context,
  2. required String message,
  3. String? title,
  4. String? okText,
  5. dynamic ok()?,
  6. String? cancelText,
  7. dynamic cancel()?,
  8. double width = 400,
})

Implementation

void cShowAlwaysOnTopAlert({
  required BuildContext context,
  required String message,
  String? title,
  String? okText,
  Function()? ok,
  String? cancelText,
  Function()? cancel,
  double width = 400,
}) {
  if (cAlertOverlayEntry != null) {
    // If an alert is already being shown, remove it first
    cAlertOverlayEntry!.remove();
  }

  cAlertOverlayEntry = OverlayEntry(
    builder: (context) => TopAlert(
      message: message,
      title: title,
      ok: ok,
      okText: okText,
      cancelText: cancelText,
      cancel: cancel,
      width: width,
    ),
  );

  // Insert the overlay entry into the overlay
  Overlay.of(context).insert(cAlertOverlayEntry!);
}