showSuccessDialogue method Null safety

Future<void> showSuccessDialogue(
  1. BuildContext context,
  2. String title,
  3. String message
)

Shows a success dialogue containing a positive title and message.

The only action is to close the dialogue by pressing 'OK'.

Implementation

static Future<void> showSuccessDialogue(
    BuildContext context, String title, String message) async {
  await showDialog(
    context: context,
    builder: (BuildContext context) => AlertDialog(
      title: Text(title),
      content: Text(message),
      actions: <Widget>[
        TextButton(
          onPressed: () => Navigator.pop(context),
          child: const Text('OK'),
          style: ButtonStyle(
            foregroundColor: MaterialStateProperty.all(Colors.green),
          ),
        ),
      ],
    ),
  );
}