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

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

Issue 1213623008: Back button should be able to close apps (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix tests 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 | sky/sdk/lib/widgets/widget.dart » ('j') | 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/theme/colors.dart' as colors; 5 import 'package:sky/theme/colors.dart' as colors;
6 import 'package:sky/theme/typography.dart' as typography; 6 import 'package:sky/theme/typography.dart' as typography;
7 import 'package:sky/widgets/basic.dart'; 7 import 'package:sky/widgets/basic.dart';
8 import 'package:sky/widgets/default_text_style.dart'; 8 import 'package:sky/widgets/default_text_style.dart';
9 import 'package:sky/widgets/navigator.dart'; 9 import 'package:sky/widgets/navigator.dart';
10 import 'package:sky/widgets/theme.dart'; 10 import 'package:sky/widgets/theme.dart';
(...skipping 14 matching lines...) Expand all
25 builder: (navigator, route) => new StockHome(navigator, _stocks, optimis mSetting, modeUpdater) 25 builder: (navigator, route) => new StockHome(navigator, _stocks, optimis mSetting, modeUpdater)
26 ), 26 ),
27 new Route( 27 new Route(
28 name: '/settings', 28 name: '/settings',
29 builder: (navigator, route) => new StockSettings(navigator, optimismSett ing, backupSetting, settingsUpdater) 29 builder: (navigator, route) => new StockSettings(navigator, optimismSett ing, backupSetting, settingsUpdater)
30 ), 30 ),
31 ]); 31 ]);
32 } 32 }
33 33
34 void onBack() { 34 void onBack() {
35 setState(() { 35 if (_navigationState.hasPrevious()) {
36 _navigationState.pop(); 36 setState(() {
37 }); 37 _navigationState.pop();
38 // TODO(jackson): Need a way to invoke default back behavior here 38 });
39 } else {
40 super.onBack();
41 }
39 } 42 }
40 43
41 StockMode optimismSetting = StockMode.optimistic; 44 StockMode optimismSetting = StockMode.optimistic;
42 BackupMode backupSetting = BackupMode.disabled; 45 BackupMode backupSetting = BackupMode.disabled;
43 void modeUpdater(StockMode optimism) { 46 void modeUpdater(StockMode optimism) {
44 setState(() { 47 setState(() {
45 optimismSetting = optimism; 48 optimismSetting = optimism;
46 }); 49 });
47 } 50 }
48 void settingsUpdater({ StockMode optimism, BackupMode backup }) { 51 void settingsUpdater({ StockMode optimism, BackupMode backup }) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 style: typography.error, // if you see this, you've forgotten to corre ctly configure the text style! 89 style: typography.error, // if you see this, you've forgotten to corre ctly configure the text style!
87 child: new Navigator(_navigationState) 90 child: new Navigator(_navigationState)
88 ) 91 )
89 ); 92 );
90 } 93 }
91 } 94 }
92 95
93 void main() { 96 void main() {
94 runApp(new StocksApp()); 97 runApp(new StocksApp());
95 } 98 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/lib/widgets/widget.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698