dialog 0.7.0

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.

License #

The BSD 2-Clause License

0.7.0 #

  • New modal dialog

0.6.2 #

  • Bootstrap 4 support

0.6.1 #

  • Apply Bootstrap css only to dialogs

0.6.0 #

  • Dart 2 support

0.5.0 #

  • Resolved issues with Bootstrap
  • Fixed removing dialogs when closed

0.4.1 #

  • Fixed enter key bug in prompt

0.4.0 #

  • Resolved bugged order using dart:async
  • Added onKeyDown listeners for Enter or ESC

0.3.0 #

  • Formatted by dartfmt
  • Added screenshots to the description
  • Added a few additional Bootstrap styles

0.2.0 #

  • Reworked to work (but still buggy)

0.1.0 #

  • New alert dialog
  • New confirm dialog
  • New prompt dialog

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dialog: ^0.7.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dialog/dialog.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
79
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
89
Learn more about scoring.

We analyzed this package on Sep 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21

Platforms

Detected platforms: web

Primary library: package:dialog/dialog.dart with components: html.

Health suggestions

Fix lib/dialogs/confirm.dart. (-0.50 points)

Analysis of lib/dialogs/confirm.dart reported 1 hint:

line 14 col 5: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

Fix lib/dialogs/modal.dart. (-0.50 points)

Analysis of lib/dialogs/modal.dart reported 1 hint:

line 34 col 3: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

Fix lib/dialogs/prompt.dart. (-0.50 points)

Analysis of lib/dialogs/prompt.dart reported 1 hint:

line 24 col 3: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

Maintenance suggestions

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and dialog.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
build_runner ^0.10.0
build_web_compilers ^0.4.0