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

Side by Side Diff: sky/sdk/example/stocks/lib/stock_home.dart

Issue 1209423006: Fix back button behavior when returning from settings screen (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'package:sky/editing/input.dart'; 5 import 'package:sky/editing/input.dart';
6 import 'package:sky/widgets/basic.dart'; 6 import 'package:sky/widgets/basic.dart';
7 import 'package:sky/widgets/drawer.dart'; 7 import 'package:sky/widgets/drawer.dart';
8 import 'package:sky/widgets/drawer_header.dart'; 8 import 'package:sky/widgets/drawer_header.dart';
9 import 'package:sky/widgets/floating_action_button.dart'; 9 import 'package:sky/widgets/floating_action_button.dart';
10 import 'package:sky/widgets/icon.dart'; 10 import 'package:sky/widgets/icon.dart';
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 new MenuItem( 142 new MenuItem(
143 icon: 'action/thumb_down', 143 icon: 'action/thumb_down',
144 onPressed: () => _handleStockModeChange(StockMode.pessimistic), 144 onPressed: () => _handleStockModeChange(StockMode.pessimistic),
145 children: [ 145 children: [
146 new Flexible(child: new Text('Pessimistic')), 146 new Flexible(child: new Text('Pessimistic')),
147 new Radio(value: StockMode.pessimistic, groupValue: stockMode, onCha nged: _handleStockModeChange) 147 new Radio(value: StockMode.pessimistic, groupValue: stockMode, onCha nged: _handleStockModeChange)
148 ]), 148 ]),
149 new MenuDivider(), 149 new MenuDivider(),
150 new MenuItem( 150 new MenuItem(
151 icon: 'action/settings', 151 icon: 'action/settings',
152 onPressed: () => navigator.pushNamed('/settings'), 152 onPressed: _handleShowSettings,
153 children: [new Text('Settings')]), 153 children: [new Text('Settings')]),
154 new MenuItem( 154 new MenuItem(
155 icon: 'action/help', 155 icon: 'action/help',
156 children: [new Text('Help & Feedback')]) 156 children: [new Text('Help & Feedback')])
157 ] 157 ]
158 ); 158 );
159 } 159 }
160 160
161 void _handleShowSettings() {
162 assert(navigator.currentRoute.name == '/drawer');
163 navigator.pop();
164 assert(navigator.currentRoute.name == '/');
165 navigator.pushNamed('/settings');
166 }
167
161 void _handleOpenDrawer() { 168 void _handleOpenDrawer() {
162 _drawerController.open(); 169 _drawerController.open();
163 navigator.pushState("/drawer", (_) { 170 navigator.pushState("/drawer", (_) {
164 _drawerController.close(); 171 _drawerController.close();
165 }); 172 });
166 } 173 }
167 174
168 Widget buildToolBar() { 175 Widget buildToolBar() {
169 return new ToolBar( 176 return new ToolBar(
170 left: new IconButton( 177 left: new IconButton(
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 body: buildTabNavigator(), 292 body: buildTabNavigator(),
286 snackBar: buildSnackBar(), 293 snackBar: buildSnackBar(),
287 floatingActionButton: buildFloatingActionButton(), 294 floatingActionButton: buildFloatingActionButton(),
288 drawer: _drawerShowing ? buildDrawer() : null 295 drawer: _drawerShowing ? buildDrawer() : null
289 ), 296 ),
290 ]; 297 ];
291 addMenuToOverlays(overlays); 298 addMenuToOverlays(overlays);
292 return new Stack(overlays); 299 return new Stack(overlays);
293 } 300 }
294 } 301 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698