showCustomDialog function

void showCustomDialog(
  1. BuildContext context,
  2. String title,
  3. String message,
  4. Function okPressed,
)

Implementation

void showCustomDialog(BuildContext context, String title, String message,
    Function okPressed) async {
  showDialog(
    context: context,
    barrierDismissible: false,
    builder: (BuildContext context) {
      // return object of type Dialog

      return AlertDialog(
        shape: const RoundedRectangleBorder(
            borderRadius: BorderRadius.all(Radius.circular(10.0))),
        title: Text(
            title
        ),
        content:  Text(
            message

        ),
        actions: <Widget>[
          ElevatedButton(
            child:
            const Text("OK"),
            onPressed: okPressed(),
          ),
        ],
      );
    },
  );
}