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

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

Issue 1213603006: Initial fitness app (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: abarth cr feedback 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 | « sky/sdk/example/fitness/lib/home.dart ('k') | sky/sdk/example/fitness/lib/measurement.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 import 'package:sky/theme/colors.dart' as colors;
6 import 'package:sky/widgets/basic.dart';
7 import 'package:sky/widgets/navigator.dart';
8 import 'package:sky/widgets/theme.dart';
9 import 'package:sky/widgets/widget.dart';
10
11 import 'measurement.dart';
12 import 'home.dart';
13 import 'settings.dart';
14 import 'fitness_types.dart';
15
16 class FitnessApp extends App {
17
18 NavigationState _navigationState;
19 FitnessApp() {
20 _navigationState = new NavigationState([
21 new Route(
22 name: '/',
23 builder: (navigator, route) => new HomeFragment(navigator, _userData)
24 ),
25 new Route(
26 name: '/settings',
27 builder: (navigator, route) => new SettingsFragment(navigator, backupSet ting, settingsUpdater)
28 ),
29 ]);
30 }
31
32 void onBack() {
33 if (_navigationState.hasPrevious()) {
34 setState(() {
35 _navigationState.pop();
36 });
37 } else {
38 super.onBack();
39 }
40 }
41
42 BackupMode backupSetting = BackupMode.disabled;
43
44 void settingsUpdater({ BackupMode backup }) {
45 setState(() {
46 if (backup != null)
47 backupSetting = backup;
48 });
49 }
50
51 final List<Measurement> _userData = [
52 new Measurement(when: new DateTime.now(), weight: 400.0)
53 ];
54
55 Widget build() {
56 return new Theme(
57 data: new ThemeData(
58 brightness: ThemeBrightness.light,
59 primarySwatch: colors.Indigo,
60 accentColor: colors.PinkAccent[200]
61 ),
62 child: new Navigator(_navigationState)
63 );
64 }
65 }
66
67 void main() {
68 runApp(new FitnessApp());
69 }
OLDNEW
« no previous file with comments | « sky/sdk/example/fitness/lib/home.dart ('k') | sky/sdk/example/fitness/lib/measurement.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698