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

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

Issue 1134163003: [Effen] Use the checkbox widget in the stocks app. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fix tests Created 5 years, 7 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 '../layout.dart';
6 import 'dart:collection'; 7 import 'dart:collection';
7 import 'dart:sky' as sky; 8 import 'dart:sky' as sky;
8 import 'ink_splash.dart'; 9 import 'ink_splash.dart';
9 import 'scrollable.dart'; 10 import 'scrollable.dart';
10 11
11 class InkWell extends Component implements ScrollClient { 12 class InkWell extends Component implements ScrollClient {
12 static final Style _containmentStyleHack = new Style(''' 13 static final Style _containmentStyleHack = new Style('''
14 align-items: center;
13 transform: translateX(0);'''); 15 transform: translateX(0);''');
14 16
15 LinkedHashSet<SplashController> _splashes; 17 LinkedHashSet<SplashController> _splashes;
16 18
17 String inlineStyle; 19 String inlineStyle;
18 List<UINode> children; 20 List<UINode> children;
19 21
20 InkWell({ Object key, this.inlineStyle, this.children }) 22 InkWell({ Object key, this.inlineStyle, this.children })
21 : super(key: key) { 23 : super(key: key) {
22 onDidUnmount(() { 24 onDidUnmount(() {
23 _cancelSplashes(null); 25 _cancelSplashes(null);
24 }); 26 });
25 } 27 }
26 28
27 UINode build() { 29 UINode build() {
28 List<UINode> childrenIncludingSplashes = []; 30 List<UINode> childrenIncludingSplashes = [];
29 31
30 if (_splashes != null) { 32 if (_splashes != null) {
31 childrenIncludingSplashes.addAll( 33 childrenIncludingSplashes.addAll(
32 _splashes.map((s) => new InkSplash(s.onStyleChanged))); 34 _splashes.map((s) => new InkSplash(s.onStyleChanged)));
33 } 35 }
34 36
35 if (children != null) 37 if (children != null)
36 childrenIncludingSplashes.addAll(children); 38 childrenIncludingSplashes.addAll(children);
37 39
38 return new EventListenerNode( 40 return new EventListenerNode(
39 new Container( 41 new FlexContainer(
42 direction: FlexDirection.Row,
40 style: _containmentStyleHack, 43 style: _containmentStyleHack,
41 inlineStyle: inlineStyle, 44 inlineStyle: inlineStyle,
42 children: childrenIncludingSplashes), 45 children: childrenIncludingSplashes),
43 onGestureTapDown: _startSplash, 46 onGestureTapDown: _startSplash,
44 onGestureTap: _confirmSplash 47 onGestureTap: _confirmSplash
45 ); 48 );
46 } 49 }
47 50
48 void _startSplash(sky.GestureEvent event) { 51 void _startSplash(sky.GestureEvent event) {
49 setState(() { 52 setState(() {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 void _splashDone(SplashController splash) { 110 void _splashDone(SplashController splash) {
108 if (_splashes == null) 111 if (_splashes == null)
109 return; 112 return;
110 setState(() { 113 setState(() {
111 _splashes.remove(splash); 114 _splashes.remove(splash);
112 if (_splashes.length == 0) 115 if (_splashes.length == 0)
113 _splashes = null; 116 _splashes = null;
114 }); 117 });
115 } 118 }
116 } 119 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698