alert function

Future<void> alert(
  1. BuildContext context, {
  2. Widget? title,
  3. Widget? content,
  4. Widget? textOK,
})

The title argument is used to title of alert dialog. The content argument is used to content of alert dialog. The textOK argument is used to text for 'OK' Button of alert dialog.

Implementation

Future<void> alert(
  BuildContext context, {
  Widget? title,
  Widget? content,
  Widget? textOK,
}) =>
    showDialog(
      context: context,
      builder: (_) => AlertDialog(
        title: title,
        content: SingleChildScrollView(child: content),
        actions: <Widget>[
          TextButton(
            onPressed: () => Navigator.of(context).pop(),
            child:
                textOK ?? Text(MaterialLocalizations.of(context).okButtonLabel),
          ),
        ],
      ),
    );