OLD | NEW |
---|---|
1 Sky | 1 Sky |
2 === | 2 === |
3 | 3 |
4 Sky is an experimental, high-performance UI framework for mobile apps. Sky helps | 4 Sky is an experimental, high-performance UI framework for mobile apps. Sky helps |
5 you create apps with beautiful user interfaces and high-quality interactive | 5 you create apps with beautiful user interfaces and high-quality interactive |
6 design that run smoothly at 120 Hz. | 6 design that run smoothly at 120 Hz. |
7 | 7 |
8 Sky consists of two components: | 8 Sky consists of two components: |
9 | 9 |
10 1. *The Sky engine.* The engine is the core of the system. Written in C++, the | 10 1. *The Sky engine.* The engine is the core of the system. Written in C++, the |
(...skipping 14 matching lines...) Expand all Loading... | |
25 | 25 |
26 Examples | 26 Examples |
27 -------- | 27 -------- |
28 | 28 |
29 The simplest Sky app is, appropriately, HelloWorldApp: | 29 The simplest Sky app is, appropriately, HelloWorldApp: |
30 | 30 |
31 ```dart | 31 ```dart |
32 import 'package:sky/framework/fn.dart'; | 32 import 'package:sky/framework/fn.dart'; |
33 | 33 |
34 class HelloWorldApp extends App { | 34 class HelloWorldApp extends App { |
35 UINode build() { | 35 Node build() => new Text('Hello, world!'); |
Hixie
2015/04/15 19:10:30
The reason not to do this is that in 99% of cases,
sethladd
2015/04/15 19:20:19
Totally fair.
| |
36 return new Text('Hello, world!'); | |
37 } | |
38 } | 36 } |
39 | 37 |
40 void main() { | 38 void main() { |
41 new HelloWorldApp(); | 39 new HelloWorldApp(); |
42 } | 40 } |
43 ``` | 41 ``` |
44 | 42 |
45 Execution starts in `main`, which creates the `HelloWorldApp`. The framework | 43 Execution starts in `main`, which creates the `HelloWorldApp`. The framework |
46 then marks `HelloWorldApp` as dirty, which schedules it to build during the next | 44 then marks `HelloWorldApp` as dirty, which schedules it to build during the next |
47 animation frame. Each animation frame, the framework calls `build` on all the | 45 animation frame. Each animation frame, the framework calls `build` on all the |
48 dirty components and diffs the virtual `UINode` hierarchy returned this frame wi th | 46 dirty components and diffs the virtual `UINode` hierarchy returned this frame wi th |
49 the hierarchy returned last frame. Any differences are then applied as mutations | 47 the hierarchy returned last frame. Any differences are then applied as mutations |
50 to the physical hierarchy retained by the engine. | 48 to the physical hierarchy retained by the engine. |
51 | 49 |
52 For more examples, please see the [examples directory](examples/). | 50 For more examples, please see the [examples directory](examples/). |
53 | 51 |
54 Services | 52 Services |
55 -------- | 53 -------- |
56 | 54 |
57 Sky apps can access services from the host operating system using Mojo. For | 55 Sky apps can access services from the host operating system using Mojo. For |
58 example, you can access the network using the `network_service.mojom` interface. | 56 example, you can access the network using the `network_service.mojom` interface. |
59 Although you can use these low-level interfaces directly, you might prefer to | 57 Although you can use these low-level interfaces directly, you might prefer to |
60 access these services via libraries in the framework. For example, the | 58 access these services via libraries in the framework. For example, the |
61 `fetch.dart` library wraps the underlying `network_service.mojom` in an | 59 `fetch.dart` library wraps the underlying `network_service.mojom` in an |
62 ergonomic interface: | 60 ergonomic interface: |
63 | 61 |
64 ```dart | 62 ```dart |
65 import 'package:sky/framework/net/fetch.dart'; | 63 import 'package:sky/framework/net/fetch.dart'; |
66 | 64 |
67 void main() { | 65 void main() async { |
Hixie
2015/04/15 19:10:30
does this work? I sent feedback to dart-discuss as
sethladd
2015/04/15 19:20:19
good catch. I should have removed the void annotat
| |
68 fetch('example.txt').then((Response response) { | 66 var response = await fetch('example.txt'); |
69 print(response.bodyAsString()); | 67 print(response.bodyAsString()); |
70 }); | |
71 } | 68 } |
72 ``` | 69 ``` |
73 | 70 |
74 Set up your computer | 71 Set up your computer |
75 -------------------- | 72 -------------------- |
76 | 73 |
77 1. Install the Dart SDK: | 74 1. Install the Dart SDK: |
78 - https://www.dartlang.org/tools/download.html | 75 - https://www.dartlang.org/tools/download.html |
79 | 76 |
80 2. Install the ``adb`` tool from the Android SDK: | 77 2. Install the ``adb`` tool from the Android SDK: |
(...skipping 19 matching lines...) Expand all Loading... | |
100 3. Using a USB cable, plug your phone into your computer. If prompted on your | 97 3. Using a USB cable, plug your phone into your computer. If prompted on your |
101 device, authorize your computer to access your device. | 98 device, authorize your computer to access your device. |
102 | 99 |
103 Running a Sky application | 100 Running a Sky application |
104 ------------------------- | 101 ------------------------- |
105 | 102 |
106 1. ``packages/sky/lib/sky_tool --install examples/stocks/main.sky`` | 103 1. ``packages/sky/lib/sky_tool --install examples/stocks/main.sky`` |
107 The --install flag is only necessary the first time to install SkyDemo.apk. | 104 The --install flag is only necessary the first time to install SkyDemo.apk. |
108 | 105 |
109 2. Use ``adb logcat`` to view any errors or Dart print() output from the app. | 106 2. Use ``adb logcat`` to view any errors or Dart print() output from the app. |
OLD | NEW |