Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/widgets/basic.dart'; | 6 import 'package:sky/widgets/basic.dart'; |
| 7 import 'package:sky/widgets/navigator.dart'; | 7 import 'package:sky/widgets/navigator.dart'; |
| 8 import 'package:sky/widgets/theme.dart'; | 8 import 'package:sky/widgets/theme.dart'; |
| 9 import 'package:sky/widgets/widget.dart'; | 9 import 'package:sky/widgets/widget.dart'; |
| 10 | 10 |
| 11 import 'measurement.dart'; | 11 import 'measurement.dart'; |
| 12 import 'home.dart'; | 12 import 'home.dart'; |
| 13 import 'settings.dart'; | 13 import 'settings.dart'; |
| 14 import 'fitness_types.dart'; | 14 import 'fitness_types.dart'; |
| 15 | 15 |
| 16 class FitnessApp extends App { | 16 class FitnessApp extends App { |
| 17 | 17 |
| 18 NavigationState _navigationState; | 18 NavigationState _navigationState; |
| 19 FitnessApp() { | 19 FitnessApp(); |
|
abarth-chromium
2015/07/10 23:26:00
You can remove this function given that it has now
| |
| 20 | |
| 21 void initState() { | |
| 20 _navigationState = new NavigationState([ | 22 _navigationState = new NavigationState([ |
| 21 new Route( | 23 new Route( |
| 22 name: '/', | 24 name: '/', |
| 23 builder: (navigator, route) => new HomeFragment(navigator, _userData) | 25 builder: (navigator, route) => new HomeFragment(navigator, _userData) |
| 24 ), | 26 ), |
| 25 new Route( | 27 new Route( |
| 26 name: '/settings', | 28 name: '/settings', |
| 27 builder: (navigator, route) => new SettingsFragment(navigator, backupSet ting, settingsUpdater) | 29 builder: (navigator, route) => new SettingsFragment(navigator, backupSet ting, settingsUpdater) |
| 28 ), | 30 ), |
| 29 ]); | 31 ]); |
| 32 super.initState(); | |
| 30 } | 33 } |
| 31 | 34 |
| 32 void onBack() { | 35 void onBack() { |
| 33 if (_navigationState.hasPrevious()) { | 36 if (_navigationState.hasPrevious()) { |
| 34 setState(() { | 37 setState(() { |
| 35 _navigationState.pop(); | 38 _navigationState.pop(); |
| 36 }); | 39 }); |
| 37 } else { | 40 } else { |
| 38 super.onBack(); | 41 super.onBack(); |
| 39 } | 42 } |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 60 accentColor: colors.PinkAccent[200] | 63 accentColor: colors.PinkAccent[200] |
| 61 ), | 64 ), |
| 62 child: new Navigator(_navigationState) | 65 child: new Navigator(_navigationState) |
| 63 ); | 66 ); |
| 64 } | 67 } |
| 65 } | 68 } |
| 66 | 69 |
| 67 void main() { | 70 void main() { |
| 68 runApp(new FitnessApp()); | 71 runApp(new FitnessApp()); |
| 69 } | 72 } |
| OLD | NEW |