提交 7c4662ce 编写于 作者: A Adam Barth

Re-wire up the back button

I broke this when I merged my AppContainer patch with Collin's back button
patch. This change restores the functionality I broke.

TBR=jackson@chromium.org

Review URL: https://codereview.chromium.org/1182463007.
上级 d6cbdb40
......@@ -73,6 +73,10 @@ class Navigator extends Component {
NavigationState state;
void syncFields(Navigator source) {
state = source.state;
}
void pushNamed(String name) {
setState(() {
state.pushNamed(name);
......
......@@ -813,6 +813,21 @@ class WidgetSkyBinding extends SkyBinding {
}
abstract class App extends Component {
void _handleEvent(sky.Event event) {
if (event.type == 'back')
onBack();
}
void didMount() {
super.didMount();
WidgetAppView.appView.addEventListener(_handleEvent);
}
void didUnmount() {
super.didUnmount();
WidgetAppView.appView.removeEventListener(_handleEvent);
}
// Override this to handle back button behavior in your app
void onBack() { }
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册