| OLD | NEW |
| (Empty) |
| 1 import 'dart:sky'; | |
| 2 import 'package:sky/framework/fn.dart'; | |
| 3 import 'package:sky/framework/components/button.dart'; | |
| 4 import 'package:sky/framework/components/scaffold.dart'; | |
| 5 import 'package:sky/framework/components/tool_bar.dart'; | |
| 6 import 'package:sky/framework/theme/colors.dart'; | |
| 7 import 'package:sky/framework/theme/typography.dart' as typography; | |
| 8 | |
| 9 class SkyLink extends Component { | |
| 10 String text; | |
| 11 String href; | |
| 12 | |
| 13 SkyLink(String text, this.href) : this.text = text, super(key: text); | |
| 14 | |
| 15 UINode build() { | |
| 16 return new EventListenerNode( | |
| 17 new Button(key: text, content: new Text(text), level: 1), | |
| 18 onPointerUp: (_) => window.location.href = href | |
| 19 ); | |
| 20 } | |
| 21 } | |
| 22 | |
| 23 class SkyHome extends App { | |
| 24 static final Style _actionBarStyle = new Style(''' | |
| 25 background-color: ${Green[500]};'''); | |
| 26 | |
| 27 static final Style _titleStyle = new Style(''' | |
| 28 ${typography.white.title};'''); | |
| 29 | |
| 30 UINode build() { | |
| 31 List<UINode> children = [ | |
| 32 new SkyLink('Stocks2 App', 'examples/stocks2/lib/stock_app.dart'), | |
| 33 new SkyLink('Box2D Game', 'examples/game/main.dart'), | |
| 34 new SkyLink('Interactive Flex', 'examples/rendering/interactive_flex.dart'
), | |
| 35 new SkyLink('Sector Layout', 'examples/rendering/sector_layout.dart'), | |
| 36 new SkyLink('Touch Demo', 'examples/rendering/touch_demo.dart'), | |
| 37 | |
| 38 // TODO(eseidel): We could use to separate these groups? | |
| 39 new SkyLink('Stocks App (Old)', 'examples/stocks/main.sky'), | |
| 40 new SkyLink('Touch Demo (Old)', 'examples/raw/touch-demo.sky'), | |
| 41 new SkyLink('Spinning Square (Old)', 'examples/raw/spinning-square.sky'), | |
| 42 | |
| 43 new SkyLink('Licences (Old)', 'LICENSES.sky'), | |
| 44 ]; | |
| 45 | |
| 46 return new Scaffold( | |
| 47 // FIXME: ActionBar should have a better default style than transparent. | |
| 48 header: new StyleNode( | |
| 49 // FIXME: left should be optional, but currently crashes when null. | |
| 50 new ToolBar(left: new Text(''), | |
| 51 center: new Container(children: [new Text('Sky Demos')], style: _title
Style)), | |
| 52 _actionBarStyle), | |
| 53 content: new Container(children: children) | |
| 54 ); | |
| 55 } | |
| 56 } | |
| OLD | NEW |