Commit 977ece7e authored by Adam Barth's avatar Adam Barth

Begin work on the PopupMenu entrance animation

This CL also refactors how animations work, particularly for the Drawer. I've
renamed DrawerAnimation to DrawerController and switched it from being an
Animation to having an Animation. I've also renamed Animation to AnimatedValue
to capture the idea that the class actually presents the value being animated.
Finally, I've factored AnimatedValueListener out of Drawer so that it can be
used by PopupMenuItem as well.

Finally, I've added a scheduleBuild convienence function to Component instead
of having to call setState(() {}), which has come up a couple times.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1016093002
parent 9d14551f
......@@ -18,7 +18,7 @@ import 'stock_menu.dart';
class StocksApp extends App {
DrawerAnimation _drawerAnimation = new DrawerAnimation();
DrawerController _DrawerController = new DrawerController();
static Style _style = new Style('''
display: flex;
......@@ -68,7 +68,7 @@ class StocksApp extends App {
Node build() {
var drawer = new Drawer(
animation: _drawerAnimation,
controller: _DrawerController,
level: 3,
children: [
new DrawerHeader(
......@@ -112,7 +112,7 @@ class StocksApp extends App {
new Icon(key: 'menu', style: _iconStyle,
size: 24,
type: 'navigation/menu_white')
..events.listen('gesturetap', _drawerAnimation.toggle),
..events.listen('gesturetap', _DrawerController.toggle),
new Container(
style: _titleStyle,
children: [title]
......@@ -143,8 +143,13 @@ class StocksApp extends App {
drawer
];
if (_isShowingMenu)
children.add(new StockMenu());
if (_isShowingMenu) {
children.add(new StockMenu()..events.listen('gesturetap', (_) {
setState(() {
_isShowingMenu = false;
});
}));
}
return new Container(key: 'StocksApp', children: children);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment