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
This commit is contained in:
parent
9d14551fb7
commit
977ece7e55
@ -18,7 +18,7 @@ import 'stock_menu.dart';
|
|||||||
|
|
||||||
class StocksApp extends App {
|
class StocksApp extends App {
|
||||||
|
|
||||||
DrawerAnimation _drawerAnimation = new DrawerAnimation();
|
DrawerController _DrawerController = new DrawerController();
|
||||||
|
|
||||||
static Style _style = new Style('''
|
static Style _style = new Style('''
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -68,7 +68,7 @@ class StocksApp extends App {
|
|||||||
|
|
||||||
Node build() {
|
Node build() {
|
||||||
var drawer = new Drawer(
|
var drawer = new Drawer(
|
||||||
animation: _drawerAnimation,
|
controller: _DrawerController,
|
||||||
level: 3,
|
level: 3,
|
||||||
children: [
|
children: [
|
||||||
new DrawerHeader(
|
new DrawerHeader(
|
||||||
@ -112,7 +112,7 @@ class StocksApp extends App {
|
|||||||
new Icon(key: 'menu', style: _iconStyle,
|
new Icon(key: 'menu', style: _iconStyle,
|
||||||
size: 24,
|
size: 24,
|
||||||
type: 'navigation/menu_white')
|
type: 'navigation/menu_white')
|
||||||
..events.listen('gesturetap', _drawerAnimation.toggle),
|
..events.listen('gesturetap', _DrawerController.toggle),
|
||||||
new Container(
|
new Container(
|
||||||
style: _titleStyle,
|
style: _titleStyle,
|
||||||
children: [title]
|
children: [title]
|
||||||
@ -143,8 +143,13 @@ class StocksApp extends App {
|
|||||||
drawer
|
drawer
|
||||||
];
|
];
|
||||||
|
|
||||||
if (_isShowingMenu)
|
if (_isShowingMenu) {
|
||||||
children.add(new StockMenu());
|
children.add(new StockMenu()..events.listen('gesturetap', (_) {
|
||||||
|
setState(() {
|
||||||
|
_isShowingMenu = false;
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
return new Container(key: 'StocksApp', children: children);
|
return new Container(key: 'StocksApp', children: children);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user