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

Side by Side Diff: sky/framework/components/ink_well.dart

Issue 1027633003: [Effen] Add AnimatedComponent base class (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: cr changes Created 5 years, 9 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import '../fn.dart'; 5 import '../fn.dart';
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:sky' as sky; 7 import 'dart:sky' as sky;
8 import 'ink_splash.dart'; 8 import 'ink_splash.dart';
9 9
10 class InkWell extends Component { 10 class InkWell extends Component {
11 LinkedHashSet<SplashController> _splashes; 11 LinkedHashSet<SplashController> _splashes;
12 12
13 Style style; 13 Style style;
14 String inlineStyle; 14 String inlineStyle;
15 List<Node> children; 15 List<Node> children;
16 16
17 InkWell({ Object key, this.style, this.inlineStyle, this.children }) 17 InkWell({ Object key, this.style, this.inlineStyle, this.children })
18 : super(key: key); 18 : super(key: key) {
19 onDidUnmount(() {
20 _cancelSplashes(null);
21 });
22 }
19 23
20 Node build() { 24 Node build() {
21 List<Node> childrenIncludingSplashes = []; 25 List<Node> childrenIncludingSplashes = [];
22 26
23 if (_splashes != null) { 27 if (_splashes != null) {
24 childrenIncludingSplashes.addAll( 28 childrenIncludingSplashes.addAll(
25 _splashes.map((s) => new InkSplash(s.onStyleChanged))); 29 _splashes.map((s) => new InkSplash(s.onStyleChanged)));
26 } 30 }
27 31
28 if (children != null) 32 if (children != null)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 void _cancelSplashes(sky.Event event) { 66 void _cancelSplashes(sky.Event event) {
63 if (_splashes == null) 67 if (_splashes == null)
64 return; 68 return;
65 setState(() { 69 setState(() {
66 var splashes = _splashes; 70 var splashes = _splashes;
67 _splashes = null; 71 _splashes = null;
68 splashes.forEach((s) { s.cancel(); }); 72 splashes.forEach((s) { s.cancel(); });
69 }); 73 });
70 } 74 }
71 75
72 void didUnmount() {
73 _cancelSplashes(null);
74 }
75
76 void _splashDone(SplashController splash) { 76 void _splashDone(SplashController splash) {
77 if (_splashes == null) 77 if (_splashes == null)
78 return; 78 return;
79 setState(() { 79 setState(() {
80 _splashes.remove(splash); 80 _splashes.remove(splash);
81 if (_splashes.length == 0) 81 if (_splashes.length == 0)
82 _splashes = null; 82 _splashes = null;
83 }); 83 });
84 } 84 }
85 } 85 }
OLDNEW
« no previous file with comments | « sky/framework/components/fixed_height_scrollable.dart ('k') | sky/framework/components/input.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698