You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
diplomatic-quarter/lib/widgets/dialogs/alert_dialog.dart

50 lines
1.1 KiB
Dart

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 =
TextButton(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();
}
}