26 lines
669 B
Dart
26 lines
669 B
Dart
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
void showDialogSingleButton(
|
||
|
BuildContext context, String title, String message, String buttonLabel) {
|
||
|
// flutter defined function
|
||
|
showDialog(
|
||
|
context: context,
|
||
|
builder: (BuildContext context) {
|
||
|
// return object of type Dialog
|
||
|
return AlertDialog(
|
||
|
title: new Text(title),
|
||
|
content: new Text(message),
|
||
|
actions: <Widget>[
|
||
|
// usually buttons at the bottom of the dialog
|
||
|
new FlatButton(
|
||
|
child: new Text(buttonLabel),
|
||
|
onPressed: () {
|
||
|
Navigator.of(context).pop();
|
||
|
},
|
||
|
),
|
||
|
],
|
||
|
);
|
||
|
},
|
||
|
);
|
||
|
}
|