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/mojo/shell.dart' as shell; | 8 import 'package:sky/mojo/shell.dart' as shell; |
9 import 'package:sky/painting/box_painter.dart'; | 9 import 'package:sky/painting/box_painter.dart'; |
10 import 'package:sky/theme/colors.dart' as colors; | 10 import 'package:sky/theme/colors.dart' as colors; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 String bundle; | 47 String bundle; |
48 String description; | 48 String description; |
49 typography.TextTheme textTheme; | 49 typography.TextTheme textTheme; |
50 BoxDecoration decoration; | 50 BoxDecoration decoration; |
51 SkyDemo({ this.name, this.href, this.bundle, this.description, this.textTheme,
this.decoration }); | 51 SkyDemo({ this.name, this.href, this.bundle, this.description, this.textTheme,
this.decoration }); |
52 } | 52 } |
53 | 53 |
54 List<Widget> demos = [ | 54 List<Widget> demos = [ |
55 new SkyDemo( | 55 new SkyDemo( |
56 name: 'Stocks', | 56 name: 'Stocks', |
57 href: 'example/stocks/lib/main.dart', | 57 href: '../../stocks/lib/main.dart', |
58 bundle: 'stocks.skyx', | 58 bundle: 'stocks.skyx', |
59 description: 'Multi-screen app with scrolling list', | 59 description: 'Multi-screen app with scrolling list', |
60 textTheme: typography.black, | 60 textTheme: typography.black, |
61 decoration: new BoxDecoration( | 61 decoration: new BoxDecoration( |
62 backgroundImage: new BackgroundImage( | 62 backgroundImage: new BackgroundImage( |
63 src: 'example/stocks/thumbnail.png', | 63 src: '../assets/stocks_thumbnail.png', |
64 fit: BackgroundFit.cover | 64 fit: BackgroundFit.cover |
65 ) | 65 ) |
66 ) | 66 ) |
67 ), | 67 ), |
68 new SkyDemo( | 68 new SkyDemo( |
69 name: 'Asteroids', | 69 name: 'Asteroids', |
70 href: 'example/game/main.dart', | 70 href: '../../game/main.dart', |
71 description: '2D game using sprite sheets to achieve high performance', | 71 description: '2D game using sprite sheets to achieve high performance', |
72 textTheme: typography.white, | 72 textTheme: typography.white, |
73 decoration: new BoxDecoration( | 73 decoration: new BoxDecoration( |
74 backgroundImage: new BackgroundImage( | 74 backgroundImage: new BackgroundImage( |
75 src: 'example/game/res/thumbnail.png', | 75 src: '../assets/game_thumbnail.png', |
76 fit: BackgroundFit.cover | 76 fit: BackgroundFit.cover |
77 ) | 77 ) |
78 ) | 78 ) |
79 ), | 79 ), |
80 new SkyDemo( | 80 new SkyDemo( |
81 name: 'Interactive Flex', | 81 name: 'Interactive Flex', |
82 href: 'example/rendering/interactive_flex.dart', | 82 href: '../../rendering/interactive_flex.dart', |
83 bundle: 'interactive_flex.skyx', | 83 bundle: 'interactive_flex.skyx', |
84 description: 'Swipe to adjust the layout of the app', | 84 description: 'Swipe to adjust the layout of the app', |
85 textTheme: typography.white, | 85 textTheme: typography.white, |
86 decoration: new BoxDecoration( | 86 decoration: new BoxDecoration( |
87 backgroundColor: const Color(0xFF0081C6) | 87 backgroundColor: const Color(0xFF0081C6) |
88 ) | 88 ) |
89 ), | 89 ), |
90 new SkyDemo( | 90 new SkyDemo( |
91 name: 'Sector', | 91 name: 'Sector', |
92 href: 'example/widgets/sector.dart', | 92 href: '../../widgets/sector.dart', |
93 bundle: 'sector.skyx', | 93 bundle: 'sector.skyx', |
94 description: 'Demo of alternative layouts', | 94 description: 'Demo of alternative layouts', |
95 textTheme: typography.black, | 95 textTheme: typography.black, |
96 decoration: new BoxDecoration( | 96 decoration: new BoxDecoration( |
97 backgroundColor: colors.Black, | 97 backgroundColor: colors.Black, |
98 backgroundImage: new BackgroundImage( | 98 backgroundImage: new BackgroundImage( |
99 src: 'example/widgets/sector_thumbnail.png', | 99 src: '../assets/sector_thumbnail.png', |
100 fit: BackgroundFit.cover | 100 fit: BackgroundFit.cover |
101 ) | 101 ) |
102 ) | 102 ) |
103 ), | 103 ), |
104 // new SkyDemo( | 104 // new SkyDemo( |
105 // 'Touch Demo', 'examples/rendering/touch_demo.dart', 'Simple example showi
ng handling of touch events at a low level'), | 105 // 'Touch Demo', '../../rendering/touch_demo.dart', 'Simple example showing
handling of touch events at a low level'), |
106 new SkyDemo( | 106 new SkyDemo( |
107 name: 'Minedigger Game', | 107 name: 'Minedigger Game', |
108 href: 'example/mine_digger/lib/main.dart', | 108 href: '../../mine_digger/lib/main.dart', |
109 bundle: 'mine_digger.skyx', | 109 bundle: 'mine_digger.skyx', |
110 description: 'Clone of the classic Minesweeper game', | 110 description: 'Clone of the classic Minesweeper game', |
111 textTheme: typography.white | 111 textTheme: typography.white |
112 ), | 112 ), |
113 | 113 |
114 // TODO(eseidel): We could use to separate these groups? | |
115 // new SkyDemo('Old Stocks App', 'examples/stocks/main.sky'), | |
116 // new SkyDemo('Old Touch Demo', 'examples/raw/touch-demo.sky'), | |
117 // new SkyDemo('Old Spinning Square', 'examples/raw/spinning-square.sky'), | |
118 | |
119 // TODO(jackson): This doesn't seem to be working | 114 // TODO(jackson): This doesn't seem to be working |
120 // new SkyDemo('Licenses', 'LICENSES.sky'), | 115 // new SkyDemo('Licenses', 'LICENSES.sky'), |
121 ]; | 116 ]; |
122 | 117 |
123 const double kCardHeight = 120.0; | 118 const double kCardHeight = 120.0; |
124 const EdgeDims kListPadding = const EdgeDims.all(4.0); | 119 const EdgeDims kListPadding = const EdgeDims.all(4.0); |
125 | 120 |
126 class DemoList extends FixedHeightScrollable { | 121 class DemoList extends FixedHeightScrollable { |
127 DemoList({ String key }) : super(key: key, itemHeight: kCardHeight, padding: k
ListPadding) { | 122 DemoList({ String key }) : super(key: key, itemHeight: kCardHeight, padding: k
ListPadding) { |
128 itemCount = demos.length; | 123 itemCount = demos.length; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 child: new DemoList() | 175 child: new DemoList() |
181 ) | 176 ) |
182 ) | 177 ) |
183 ); | 178 ); |
184 } | 179 } |
185 } | 180 } |
186 | 181 |
187 void main() { | 182 void main() { |
188 runApp(new SkyHome()); | 183 runApp(new SkyHome()); |
189 } | 184 } |
OLD | NEW |