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 'dart:sky'; | 5 import 'dart:sky'; |
6 | 6 |
7 import 'package:mojom/intents/intents.mojom.dart'; | 7 import 'package:mojom/intents/intents.mojom.dart'; |
8 import 'package:sky/framework/shell.dart' as shell; | 8 import 'package:sky/framework/shell.dart' as shell; |
9 import 'package:sky/theme/colors.dart' as colors; | 9 import 'package:sky/theme/colors.dart' as colors; |
10 import 'package:sky/theme/edges.dart'; | 10 import 'package:sky/theme/edges.dart'; |
(...skipping 19 matching lines...) Expand all Loading... |
30 class SkyDemo extends Component { | 30 class SkyDemo extends Component { |
31 String text; | 31 String text; |
32 String href; | 32 String href; |
33 | 33 |
34 SkyDemo(String text, this.href) : this.text = text, super(key: text); | 34 SkyDemo(String text, this.href) : this.text = text, super(key: text); |
35 | 35 |
36 void _handlePress() { | 36 void _handlePress() { |
37 launch(href); | 37 launch(href); |
38 } | 38 } |
39 | 39 |
40 UINode build() { | 40 Widget build() { |
41 return new ConstrainedBox( | 41 return new ConstrainedBox( |
42 // TOOD(ianh): Fix so we don't need INFINITY here. | 42 // TOOD(ianh): Fix so we don't need INFINITY here. |
43 constraints: new BoxConstraints.tightFor(width: double.INFINITY), | 43 constraints: new BoxConstraints.tightFor(width: double.INFINITY), |
44 child: new RaisedButton( | 44 child: new RaisedButton( |
45 child: new Text(text), | 45 child: new Text(text), |
46 onPressed: _handlePress | 46 onPressed: _handlePress |
47 ) | 47 ) |
48 ); | 48 ); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 class SkyHome extends App { | 52 class SkyHome extends App { |
53 UINode build() { | 53 Widget build() { |
54 List<UINode> children = [ | 54 List<Widget> children = [ |
55 new SkyDemo('Stocks App', 'examples/stocks2/lib/stock_app.dart'), | 55 new SkyDemo('Stocks App', 'examples/stocks2/lib/stock_app.dart'), |
56 new SkyDemo('Astroids Game', 'examples/game/main.dart'), | 56 new SkyDemo('Asteroids Game', 'examples/game/main.dart'), |
57 new SkyDemo('Interactive Flex', 'examples/rendering/interactive_flex.dart'
), | 57 new SkyDemo('Interactive Flex', 'examples/rendering/interactive_flex.dart'
), |
58 new SkyDemo('Sector Layout', 'examples/widgets/sector.dart'), | 58 new SkyDemo('Sector Layout', 'examples/widgets/sector.dart'), |
59 new SkyDemo('Touch Demo', 'examples/rendering/touch_demo.dart'), | 59 new SkyDemo('Touch Demo', 'examples/rendering/touch_demo.dart'), |
| 60 new SkyDemo('Minedigger Game', 'examples/mine_digger/mine_digger.dart'), |
60 | 61 |
61 // TODO(eseidel): We could use to separate these groups? | 62 // TODO(eseidel): We could use to separate these groups? |
62 new SkyDemo('Old Stocks App', 'examples/stocks/main.sky'), | 63 new SkyDemo('Old Stocks App', 'examples/stocks/main.sky'), |
63 new SkyDemo('Old Touch Demo', 'examples/raw/touch-demo.sky'), | 64 new SkyDemo('Old Touch Demo', 'examples/raw/touch-demo.sky'), |
64 new SkyDemo('Old Spinning Square', 'examples/raw/spinning-square.sky'), | 65 new SkyDemo('Old Spinning Square', 'examples/raw/spinning-square.sky'), |
65 | 66 |
66 new SkyDemo('Licences (Old)', 'LICENSES.sky'), | 67 new SkyDemo('Licences (Old)', 'LICENSES.sky'), |
67 ]; | 68 ]; |
68 | 69 |
69 return new Scaffold( | 70 return new Scaffold( |
70 toolbar: new ToolBar( | 71 toolbar: new ToolBar( |
71 center: new Text('Sky Demos', style: typography.white.title), | 72 center: new Text('Sky Demos', style: typography.white.title), |
72 backgroundColor: colors.Blue[500]), | 73 backgroundColor: colors.Blue[500]), |
73 body: new Material( | 74 body: new Material( |
74 edge: MaterialEdge.canvas, | 75 edge: MaterialEdge.canvas, |
75 child: new Flex( | 76 child: new Flex( |
76 children, | 77 children, |
77 direction: FlexDirection.vertical, | 78 direction: FlexDirection.vertical, |
78 justifyContent: FlexJustifyContent.spaceAround | 79 justifyContent: FlexJustifyContent.spaceAround |
79 ) | 80 ) |
80 ) | 81 ) |
81 ); | 82 ); |
82 } | 83 } |
83 } | 84 } |
84 | 85 |
85 void main() { | 86 void main() { |
86 runApp(new SkyHome()); | 87 runApp(new SkyHome()); |
87 } | 88 } |
OLD | NEW |