dialog 0.7.2+1

Dart js
Flutter web

Modern modal dialog implementation containing remakes of alert & confirm dialogs supplemented by prompt & custom modal dialogs

Dialog.dart #

Modern modal dialog implementation containing remakes of alert & confirm dialogs supplemented by prompt & custom modal dialogs

Description #

This package replaces default alert & confirm dialogs from Dart's Window class and adds missing prompt & custom modal dialogs. Default system dialogs called by that prompts are superseded by modern modal design.

Usage #

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~";

Libraries to import in ~file~: #

dialogs/alert.dart

Replaces default alert dialog.

querySelector("#alertButton").onClick.listen((_) {
  alert("Alerted?!");
});

Image of alert

dialogs/confirm.dart

Replaces default confirm dialog.

querySelector("#confirmButton").onClick.listen((_) async {
  var myConfirm = await confirm("Confirmed?!");
  alert(myConfirm.toString());
});

Image of confirm

dialogs/prompt.dart

Adds missing prompt dialog.

querySelector("#promptButton").onClick.listen((_) async {
  var myPrompt = await prompt("Prompted?!", "Yes!");
  alert(myPrompt.toString());
});

Image of prompt

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

Image of modal

dialog.dart

Do you need to use them all at once? Try to import dialog.dart file only!

Contributing #

Please fill in an issue or a pull request on project's GitHub page.

You might want to buy me a beer 🍺 or a coffee ☕.

License #

The BSD 2-Clause License

2
likes
70
pub points
75%
popularity

Modern modal dialog implementation containing remakes of alert & confirm dialogs supplemented by prompt & custom modal dialogs

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

dvorapa1995@gmail.com

License

BSD (LICENSE)

More

Packages that depend on dialog