Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: lib/src/effects/modal_manager.dart

Issue 14295009: Fix widget.dart to work with the latest web_ui library. Specifically, query selectors need to use "… (Closed) Base URL: https://github.com/kevmoo/widget.dart.git@master
Patch Set: Updated to the next version of the SDK Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 part of effects; 1 part of effects;
2 2
3 /** 3 /**
4 * [ModalManager] is inspired by the [modal helper](http://twitter.github.com/bo otstrap/javascript.html#modals) in Bootstrap. 4 * [ModalManager] is inspired by the [modal helper](http://twitter.github.com/bo otstrap/javascript.html#modals) in Bootstrap.
5 * 5 *
6 * It has two static methods `show` and `hide` that both take the same parameter s as corresponding methods in [ShowHide]. 6 * It has two static methods `show` and `hide` that both take the same parameter s as corresponding methods in [ShowHide].
7 * 7 *
8 * [ModalManager] controls the display of the provided element while also creati ng a dark backdrop on the page. 8 * [ModalManager] controls the display of the provided element while also creati ng a dark backdrop on the page.
9 * Any element used should have a fixed position, a z-index greater than 1040, a nd an initial display of none. 9 * Any element used should have a fixed position, a z-index greater than 1040, a nd an initial display of none.
10 */ 10 */
(...skipping 22 matching lines...) Expand all
33 33
34 final backDropElement = _getBackdrop(element.document, false); 34 final backDropElement = _getBackdrop(element.document, false);
35 35
36 final futures = [ShowHide.hide(element, effect: effect, duration: duration, effectTiming: effectTiming)]; 36 final futures = [ShowHide.hide(element, effect: effect, duration: duration, effectTiming: effectTiming)];
37 37
38 if(backDropElement != null) { 38 if(backDropElement != null) {
39 futures.add(ShowHide.hide(backDropElement, effect: new FadeEffect())); 39 futures.add(ShowHide.hide(backDropElement, effect: new FadeEffect()));
40 } 40 }
41 41
42 return Future.wait(futures) 42 return Future.wait(futures)
43 .catchError((AsyncError err) { 43 .catchError((err) {
44 print(err); 44 print(err);
45 }, test: (v) => false) 45 }, test: (v) => false)
46 ..whenComplete(() => _clearOutBackdrop(element.document)); 46 ..whenComplete(() => _clearOutBackdrop(element.document));
47 } 47 }
48 48
49 static void _clearOutBackdrop(HtmlDocument doc) { 49 static void _clearOutBackdrop(HtmlDocument doc) {
50 final backdrop = _getBackdrop(doc, false); 50 final backdrop = _getBackdrop(doc, false);
51 if(backdrop != null) { 51 if(backdrop != null) {
52 backdrop.remove(); 52 backdrop.remove();
53 } 53 }
54 } 54 }
55 55
56 static Element _getBackdrop(HtmlDocument parentDocument, bool addIfMissing) { 56 static Element _getBackdrop(HtmlDocument parentDocument, bool addIfMissing) {
57 assert(parentDocument != null); 57 assert(parentDocument != null);
58 58
59 59
60 Element element = parentDocument.body.query('.$_backdropClass'); 60 Element element = parentDocument.body.query('.$_backdropClass');
61 if(element == null && addIfMissing) { 61 if(element == null && addIfMissing) {
62 element = new DivElement() 62 element = new DivElement()
63 ..classes.add(_backdropClass) 63 ..classes.add(_backdropClass)
64 ..attributes['style'] = _backdropStyle; 64 ..attributes['style'] = _backdropStyle;
65 parentDocument.body.children.add(element); 65 parentDocument.body.children.add(element);
66 } 66 }
67 67
68 return element; 68 return element;
69 } 69 }
70 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698