import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class AlertDialogBox { final BuildContext context; final title; final confirmMessage; final okText; final Function okFunction; AlertDialogBox( {@required this.context, this.title, @required this.confirmMessage, @required this.okText, @required this.okFunction}); showAlertDialog(BuildContext context) { Widget continueButton = FlatButton(child: Text(this.okText), onPressed: (){ this.okFunction(); }); // set up the AlertDialog AlertDialog alert = AlertDialog( title: Text(title ?? TranslationBase.of(context).confirm), content: Text(this.confirmMessage), actions: [ continueButton, ], ); // show the dialog showDialog( barrierDismissible: false, context: this.context, builder: (BuildContext context) { return alert; }, ); } static closeAlertDialog(BuildContext context) { Navigator.of(context).pop(); } }