-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve #10; downgrade Bootstrap to v3.3.2
- Loading branch information
Showing
9 changed files
with
150 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,41 @@ | ||
library dialog.confirm; | ||
|
||
import "dart:async"; | ||
import "dart:html"; | ||
import "../src/dialog_class.dart"; | ||
|
||
bool confirm([String message = ""]) { | ||
Future<bool> confirm([String message = ""]) async { | ||
Completer c = new Completer(); | ||
Dialog confirmDialog = new Dialog([new Text(message)], "Confirm", true); | ||
|
||
confirmDialog | ||
..showDialog() | ||
..okButton.focus() | ||
..modalBackdrop.onClick.first | ||
.then((_) => false) | ||
.then((_) => confirmDialog.closeDialog()) | ||
..xButton.onClick.first | ||
.then((_) => false) | ||
.then((_) => confirmDialog.closeDialog()) | ||
..cancelButton.onClick.first | ||
.then((_) => false) | ||
.then((_) => confirmDialog.closeDialog()) | ||
..okButton.onClick.first | ||
.then((_) => true) | ||
.then((_) => confirmDialog.closeDialog()); | ||
..modalBackdrop.onClick.first.then((_) { | ||
c.complete(false); | ||
confirmDialog.closeDialog(); | ||
}) | ||
..xButton.onClick.first.then((_) { | ||
c.complete(false); | ||
confirmDialog.closeDialog(); | ||
}) | ||
..cancelButton.onClick.first.then((_) { | ||
c.complete(false); | ||
confirmDialog.closeDialog(); | ||
}) | ||
..okButton.onClick.first.then((_) { | ||
c.complete(true); | ||
confirmDialog.closeDialog(); | ||
}); | ||
|
||
querySelectorAll("button").forEach((ButtonElement buttons) { | ||
buttons.onKeyDown.listen((e) { | ||
if (e is KeyboardEvent && e.keyCode == KeyCode.ESC) { | ||
c.complete(false); | ||
confirmDialog.closeDialog(); | ||
} | ||
}); | ||
}); | ||
|
||
return c.future; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name: dialog | ||
version: 0.4.0-dev | ||
version: 0.4.0 | ||
description: Modern alert, confirm and prompt dialog implementation | ||
author: Pavel Dvořák | ||
author: Pavel Dvořák <[email protected]> | ||
homepage: https://github.com/dvorapa/dialog-dart | ||
environment: | ||
sdk: ">=1.10.0 <2.0.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters