modal static method

void modal({
  1. required String title,
  2. required Widget content,
  3. List<Widget>? actions,
  4. VoidCallback? onSubmit,
})

Implementation

static void modal({
  required final String title,
  required final Widget content,
  final List<Widget>? actions,
  final VoidCallback? onSubmit,
}) {
  Get.dialog(
    AlertDialog(
      title: Text(title),
      content: content,
      actions: [
        ...actions ?? [],
        if (onSubmit != null)
          TextButton(
            onPressed: onSubmit,
            child: const Text("Save"),
          ),
        TextButton(
          child: const Text("Close"),
          onPressed: () => Get.back(),
        ),
      ],
    ),
  );
}