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

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

Issue 1027633003: [Effen] Add AnimatedComponent base class (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: cr changes 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
Index: sky/framework/components/drawer.dart
diff --git a/sky/framework/components/drawer.dart b/sky/framework/components/drawer.dart
index 35c147bdabaae2e6dc89b413ce9ac689848bd72e..9020c2da702f871a201f7c29c76a6eb71d510772 100644
--- a/sky/framework/components/drawer.dart
+++ b/sky/framework/components/drawer.dart
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import 'animated_component.dart';
import '../animation/animated_value.dart';
import '../animation/curves.dart';
import '../fn.dart';
@@ -74,7 +75,7 @@ class DrawerController {
}
}
-class Drawer extends Component {
+class Drawer extends AnimatedComponent {
static final Style _style = new Style('''
position: absolute;
top: 0;
@@ -107,7 +108,7 @@ class Drawer extends Component {
int level;
DrawerController controller;
- AnimatedValueListener _position;
+ double _position;
Drawer({
Object key,
@@ -115,20 +116,14 @@ class Drawer extends Component {
this.children,
this.level: 0
}) : super(key: key) {
- _position = new AnimatedValueListener(this, controller.position);
- }
-
- void didUnmount() {
- _position.stopListening();
+ animateField(controller.position, #_position);
}
Node build() {
- _position.ensureListening();
-
- bool isClosed = _position.value <= -_kWidth;
+ bool isClosed = _position <= -_kWidth;
String inlineStyle = 'display: ${isClosed ? 'none' : ''}';
- String maskInlineStyle = 'opacity: ${(_position.value / _kWidth + 1) * 0.5}';
- String contentInlineStyle = 'transform: translateX(${_position.value}px)';
+ String maskInlineStyle = 'opacity: ${(_position / _kWidth + 1) * 0.5}';
+ String contentInlineStyle = 'transform: translateX(${_position}px)';
var mask = new EventTarget(
new Container(
« no previous file with comments | « sky/framework/components/animated_component.dart ('k') | sky/framework/components/fixed_height_scrollable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698