Giter Club home page Giter Club logo

dialog-dart's Introduction

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!

Status

maintained

Author

Pavel Dvořák (@dvorapa)

You might want to buy me a hot chocolate ☕.

Contributing

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

License

The BSD 2-Clause License

dialog-dart's People

Contributors

dvorapa avatar br3n9 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.