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

Unified Diff: sky/examples/fn/widgets/drawer.dart

Issue 975863003: Don't hardcode the list of events types in fn (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: More careful event syncing Created 5 years, 10 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/examples/fn/widgets/checkbox.dart ('k') | sky/examples/fn/widgets/fixedheightscrollable.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/fn/widgets/drawer.dart
diff --git a/sky/examples/fn/widgets/drawer.dart b/sky/examples/fn/widgets/drawer.dart
index 229022011e18d2b967dbd16601853739d51380b6..26edbb2f07d6b6ade11d5f86552f51ab5d3f07f2 100644
--- a/sky/examples/fn/widgets/drawer.dart
+++ b/sky/examples/fn/widgets/drawer.dart
@@ -127,24 +127,12 @@ class Drawer extends Component {
bottom: 0;'''
);
- Stream<double> onPositionChanged;
- sky.EventListener handleMaskFling;
- sky.EventListener handleMaskTap;
- sky.EventListener handlePointerCancel;
- sky.EventListener handlePointerDown;
- sky.EventListener handlePointerMove;
- sky.EventListener handlePointerUp;
+ DrawerAnimation animation;
List<Node> children;
Drawer({
Object key,
- this.onPositionChanged,
- this.handleMaskFling,
- this.handleMaskTap,
- this.handlePointerCancel,
- this.handlePointerDown,
- this.handlePointerMove,
- this.handlePointerUp,
+ this.animation,
this.children
}) : super(key: key);
@@ -157,7 +145,7 @@ class Drawer extends Component {
return;
_listening = true;
- onPositionChanged.listen((position) {
+ animation.onPositionChanged.listen((position) {
setState(() {
_position = position;
});
@@ -172,29 +160,28 @@ class Drawer extends Component {
String maskInlineStyle = 'opacity: ${(_position / _kWidth + 1) * 0.25}';
String contentInlineStyle = 'transform: translateX(${_position}px)';
+ Container mask = new Container(
+ key: 'Mask',
+ style: _maskStyle,
+ inlineStyle: maskInlineStyle
+ )..events.listen('gesturetap', animation.handleMaskTap)
+ ..events.listen('gestureflingstart', animation.handleFlingStart);
+
+ Container content = new Container(
+ key: 'Content',
+ style: _contentStyle,
+ inlineStyle: contentInlineStyle,
+ children: children
+ );
+
return new Container(
style: _style,
inlineStyle: inlineStyle,
- onPointerDown: handlePointerDown,
- onPointerMove: handlePointerMove,
- onPointerUp: handlePointerUp,
- onPointerCancel: handlePointerCancel,
-
- children: [
- new Container(
- key: 'Mask',
- style: _maskStyle,
- inlineStyle: maskInlineStyle,
- onGestureTap: handleMaskTap,
- onFlingStart: handleMaskFling
- ),
- new Container(
- key: 'Content',
- style: _contentStyle,
- inlineStyle: contentInlineStyle,
- children: children
- )
- ]
- );
+ children: [ mask, content ]
+ )..events.listen('pointerdown', animation.handlePointerDown)
+ ..events.listen('pointermove', animation.handlePointerMove)
+ ..events.listen('pointerup', animation.handlePointerUp)
+ ..events.listen('pointercancel', animation.handlePointerCancel);
+
}
}
« no previous file with comments | « sky/examples/fn/widgets/checkbox.dart ('k') | sky/examples/fn/widgets/fixedheightscrollable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698