OLD | NEW |
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 '../animation/curves.dart'; | 5 import '../animation/curves.dart'; |
6 import '../animation/generators.dart'; | 6 import '../animation/generators.dart'; |
7 import '../fn.dart'; | 7 import '../fn.dart'; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:sky' as sky; | 9 import 'dart:sky' as sky; |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 left: ${_offsetX - p/2}px; | 38 left: ${_offsetX - p/2}px; |
39 width: ${p}px; | 39 width: ${p}px; |
40 height: ${p}px; | 40 height: ${p}px; |
41 border-radius: ${p}px; | 41 border-radius: ${p}px; |
42 opacity: ${1.0 - (p / _kSplashSize)}; | 42 opacity: ${1.0 - (p / _kSplashSize)}; |
43 '''); | 43 '''); |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 class InkSplash extends Component { | 47 class InkSplash extends Component { |
48 static final Style _style = new Style(''' | 48 static final Style _clipperStyle = new Style(''' |
49 position: absolute; | 49 position: absolute; |
50 pointer-events: none; | 50 pointer-events: none; |
51 overflow: hidden; | 51 overflow: hidden; |
52 top: 0; | 52 top: 0; |
53 left: 0; | 53 left: 0; |
54 bottom: 0; | 54 bottom: 0; |
55 right: 0; | 55 right: 0;'''); |
56 '''); | |
57 | 56 |
58 static final Style _splashStyle = new Style(''' | 57 static final Style _splashStyle = new Style(''' |
59 position: absolute; | 58 position: absolute; |
60 background-color: rgba(0, 0, 0, 0.4); | 59 background-color: rgba(0, 0, 0, 0.4);'''); |
61 border-radius: 0; | |
62 top: 0; | |
63 left: 0; | |
64 height: 0; | |
65 width: 0; | |
66 '''); | |
67 | 60 |
68 Stream<String> onStyleChanged; | 61 Stream<String> onStyleChanged; |
69 | 62 |
70 double _offsetX; | 63 double _offsetX; |
71 double _offsetY; | 64 double _offsetY; |
72 String _inlineStyle; | 65 String _inlineStyle; |
73 | 66 |
74 InkSplash(Stream<String> onStyleChanged) | 67 InkSplash(Stream<String> onStyleChanged) |
75 : onStyleChanged = onStyleChanged, | 68 : onStyleChanged = onStyleChanged, |
76 super(stateful: true, key: onStyleChanged.hashCode); | 69 super(stateful: true, key: onStyleChanged.hashCode); |
(...skipping 10 matching lines...) Expand all Loading... |
87 setState(() { | 80 setState(() { |
88 _inlineStyle = style; | 81 _inlineStyle = style; |
89 }); | 82 }); |
90 }); | 83 }); |
91 } | 84 } |
92 | 85 |
93 Node build() { | 86 Node build() { |
94 _ensureListening(); | 87 _ensureListening(); |
95 | 88 |
96 return new Container( | 89 return new Container( |
97 style: _style, | 90 style: _clipperStyle, |
98 children: [ | 91 children: [ |
99 new Container( | 92 new Container( |
100 inlineStyle: _inlineStyle, | 93 inlineStyle: _inlineStyle, |
101 style: _splashStyle | 94 style: _splashStyle |
102 ) | 95 ) |
103 ] | 96 ] |
104 ); | 97 ); |
105 } | 98 } |
106 } | 99 } |
OLD | NEW |