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

Unified Diff: sky/sdk/lib/framework/components2/ink_splash.dart

Issue 1172173002: Clean up a bunch of our Dart code. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: upstream merge Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/sdk/lib/framework/components2/icon_button.dart ('k') | sky/sdk/lib/framework/components2/ink_well.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/framework/components2/ink_splash.dart
diff --git a/sky/sdk/lib/framework/components2/ink_splash.dart b/sky/sdk/lib/framework/components2/ink_splash.dart
index ff0c36b2413f2045e2258b2f4b0de6ba9d975dde..d18f44b9f127009f722d12852248be2aa5c5365b 100644
--- a/sky/sdk/lib/framework/components2/ink_splash.dart
+++ b/sky/sdk/lib/framework/components2/ink_splash.dart
@@ -20,6 +20,36 @@ double _getSplashTargetSize(Rect rect, double x, double y) {
}
class SplashController {
+
+ SplashController(Rect rect, double x, double y,
+ { this.pointer, Function onDone })
+ : _offsetX = x - rect.x,
+ _offsetY = y - rect.y,
+ _targetSize = _getSplashTargetSize(rect, x, y) {
+
+ _styleStream = _size.onValueChanged.map((p) {
+ if (p == _targetSize) {
+ onDone();
+ }
+ double size;
+ if (_growing) {
+ size = p;
+ _lastSize = p;
+ } else {
+ size = _lastSize;
+ }
+ return '''
+ top: ${_offsetY - size/2}px;
+ left: ${_offsetX - size/2}px;
+ width: ${size}px;
+ height: ${size}px;
+ border-radius: ${size}px;
+ opacity: ${1.0 - (p / _targetSize)};''';
+ });
+
+ start();
+ }
+
final int pointer;
Stream<String> get onStyleChanged => _styleStream;
@@ -55,37 +85,14 @@ class SplashController {
_size.stop();
}
- SplashController(Rect rect, double x, double y,
- { this.pointer, Function onDone })
- : _offsetX = x - rect.x,
- _offsetY = y - rect.y,
- _targetSize = _getSplashTargetSize(rect, x, y) {
-
- _styleStream = _size.onValueChanged.map((p) {
- if (p == _targetSize) {
- onDone();
- }
- double size;
- if (_growing) {
- size = p;
- _lastSize = p;
- } else {
- size = _lastSize;
- }
- return '''
- top: ${_offsetY - size/2}px;
- left: ${_offsetX - size/2}px;
- width: ${size}px;
- height: ${size}px;
- border-radius: ${size}px;
- opacity: ${1.0 - (p / _targetSize)};''';
- });
-
- start();
- }
}
class InkSplash extends Component {
+
+ InkSplash(Stream<String> onStyleChanged)
+ : onStyleChanged = onStyleChanged,
+ super(stateful: true, key: onStyleChanged.hashCode);
+
static final Style _clipperStyle = new Style('''
position: absolute;
pointer-events: none;
@@ -105,10 +112,6 @@ class InkSplash extends Component {
double _offsetY;
String _inlineStyle;
- InkSplash(Stream<String> onStyleChanged)
- : onStyleChanged = onStyleChanged,
- super(stateful: true, key: onStyleChanged.hashCode);
-
bool _listening = false;
void _ensureListening() {
@@ -137,4 +140,5 @@ class InkSplash extends Component {
]
);
}
+
}
« no previous file with comments | « sky/sdk/lib/framework/components2/icon_button.dart ('k') | sky/sdk/lib/framework/components2/ink_well.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698