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

Unified Diff: sky/framework/components/drawer.dart

Issue 993033003: Move example fn widgets into sky/framework/components (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/framework/components/checkbox.dart ('k') | sky/framework/components/drawer_header.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/components/drawer.dart
diff --git a/sky/examples/fn/widgets/drawer.dart b/sky/framework/components/drawer.dart
similarity index 80%
rename from sky/examples/fn/widgets/drawer.dart
rename to sky/framework/components/drawer.dart
index 8f36d182455a0a51457e73afaca04a52e32f7897..28be65702116a9a036239b5e8ab2a8b9176bd7f3 100644
--- a/sky/examples/fn/widgets/drawer.dart
+++ b/sky/framework/components/drawer.dart
@@ -1,4 +1,15 @@
-part of widgets;
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import '../animation/curves.dart';
+import '../animation/generator.dart';
+import '../fn.dart';
+import '../theme/colors.dart';
+import '../theme/shadows.dart';
+import 'dart:async';
+import 'dart:math' as math;
+import 'dart:sky' as sky;
const double _kWidth = 256.0;
const double _kMinFlingVelocity = 0.4;
@@ -7,7 +18,6 @@ const double _kMaxSettleDurationMS = 600.0;
const Cubic _kAnimationCurve = easeOut;
class DrawerAnimation extends Animation {
-
Stream<double> get onPositionChanged => onValueChanged;
bool get _isMostlyClosed => value <= -_kWidth / 2;
@@ -67,8 +77,7 @@ class DrawerAnimation extends Animation {
}
class Drawer extends Component {
-
- static Style _style = new Style('''
+ static final Style _style = new Style('''
position: absolute;
z-index: 2;
top: 0;
@@ -78,7 +87,7 @@ class Drawer extends Component {
box-shadpw: ${Shadow[3]};'''
);
- static Style _maskStyle = new Style('''
+ static final Style _maskStyle = new Style('''
background-color: black;
will-change: opacity;
position: absolute;
@@ -88,7 +97,7 @@ class Drawer extends Component {
right: 0;'''
);
- static Style _contentStyle = new Style('''
+ static final Style _contentStyle = new Style('''
background-color: ${Grey[50]};
will-change: transform;
position: absolute;
@@ -106,7 +115,12 @@ class Drawer extends Component {
Object key,
this.animation,
this.children
- }) : super(key: key);
+ }) : super(key: key) {
+ events.listen('pointerdown', animation.handlePointerDown);
+ events.listen('pointermove', animation.handlePointerMove);
+ events.listen('pointerup', animation.handlePointerUp);
+ events.listen('pointercancel', animation.handlePointerCancel);
+ }
double _position = -_kWidth;
@@ -150,10 +164,6 @@ class Drawer extends Component {
style: _style,
inlineStyle: inlineStyle,
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/framework/components/checkbox.dart ('k') | sky/framework/components/drawer_header.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698