Examples
Usage is almost the same as set in the Dart's Window class and completely the same as described in the WHATWG HTML Standard. For each dialog there is just one file to import only the dialog you really need. There is also one file to import all four dialogs at once if you want to use them all.
import "package:dialog/~file~";
dialogs/alert.dart
Replaces default alert dialog.
querySelector("#alertButton").onClick.listen((_) {
alert("Alerted?!");
});
Alert me!
dialogs/confirm.dart
Replaces default confirm dialog.
querySelector("#confirmButton").onClick.listen((_) async {
var myConfirm = await confirm("Confirmed?!");
alert(myConfirm.toString());
});
Confirm me!
dialogs/prompt.dart
Adds missing prompt dialog.
querySelector("#promptButton").onClick.listen((_) async {
var myPrompt = await prompt("Prompted?!", "Yes!");
alert(myPrompt.toString());
});
Prompt me!
dialogs/modal.dart
Adds fully customizable modal dialog.
querySelector("#modalButton").onClick.listen((_) async {
var myModal = await modal(
"Surprise", [Text("Boo!")], "Eek!", "Huh?", "Haha!", "Come on!", true);
alert(myModal.toString());
});
Surprise me!
dialog.dart
Do you need to use them all at once? Try to import dialog.dart file only!