1
- Getting Started with Sky
1
+ Getting started with Sky
2
2
========================
3
3
4
4
Sky apps are written in Dart. To get started, we need to set up Dart SDK:
5
5
6
6
- Install the [ Dart SDK] ( https://www.dartlang.org/downloads/ ) .
7
- - Ensure that ` $DART_SDK ` is set to the path of your Dart SDK.
7
+ - Ensure that ` $DART_SDK ` is set to the path of your Dart SDK and that the
8
+ ` dart ` and ` pub ` executables are on your ` $PATH ` .
8
9
9
10
Once we have the Dart SDK, we can creating a new directory and
10
11
adding a [ pubspec.yaml] ( https://www.dartlang.org/tools/pub/pubspec.html ) :
@@ -15,24 +16,22 @@ dependencies:
15
16
sky : any
16
17
` ` `
17
18
18
- Once the pubspec is in place, create a ` lib` directory (where your dart code
19
- will go) ensure that the 'dart' and ' pub' executables are on your $PATH and
20
- run the following :
19
+ Once the ` pubspec.yaml` is in place, create a `lib` directory (where your Dart\
20
+ code will go) and use the ` pub` tool to fetch the Sky package and its
21
+ dependencies :
21
22
22
23
- ` mkdir lib`
23
24
- ` pub get && pub run sky:init`
24
25
25
- Currently the Sky Engine assumes the entry point for your application is a
26
- `main` function in `lib/main.dart` :
26
+ Currently Sky assumes the entry point for your application is a `main` function
27
+ in `lib/main.dart` :
27
28
28
29
` ` ` dart
29
30
import 'package:sky/widgets/basic.dart';
30
31
31
32
class HelloWorldApp extends App {
32
33
Widget build() {
33
- return new Center(
34
- child: new Text('Hello, world!')
35
- );
34
+ return new Center(child: new Text('Hello, world!'));
36
35
}
37
36
}
38
37
@@ -41,11 +40,9 @@ void main() {
41
40
}
42
41
` ` `
43
42
44
- Execution starts in `main`, which instructs the framework to run a new
45
- instance of the `HelloWorldApp`. The framework then calls the `build()`
46
- function on `HelloWorldApp` to create a tree of widgets, some of which might
47
- be other `Components`, which in turn have `build()` functions that generate
48
- more widgets iteratively to create the widget hierarchy. To learn more about
43
+ Execution starts in `main`, which runs a new instance of the `HelloWorldApp`.
44
+ The `HelloWorldApp` builds a `Text` widget containing the famous _Hello, world!_
45
+ string and centers it on the screen using a `Center` widget. To learn more about
49
46
the widget system, please see the [widgets tutorial](lib/widgets/README.md).
50
47
51
48
Setup your Android device
@@ -84,19 +81,19 @@ follow these instructions:
84
81
` adb logcat -s sky` can be used to filter only adb messages from
85
82
` SkyDemo.apk` .
86
83
87
- Building a standalone APK
88
- -------------------------
89
-
90
- Although it is possible to build a standalone APK containing your application,
91
- doing so right now is difficult. If you're feeling brave, you can see how we
92
- build the `Stocks.apk` in [example/stocks](example/stocks). Eventually we plan
93
- to make this much easier and support platforms other than Android, but that work
94
- still in progress.
95
-
96
84
Debugging
97
85
---------
98
86
99
87
Sky uses [Observatory](https://www.dartlang.org/tools/observatory/) for
100
88
debugging and profiling. While running your Sky app using `sky_tool`, you can
101
89
access Observatory by navigating your web browser to
102
90
[http://localhost:8181/](http://localhost:8181/).
91
+
92
+ Building a standalone APK
93
+ -------------------------
94
+
95
+ Although it is possible to build a standalone APK containing your application,
96
+ doing so right now is difficult. If you're feeling brave, you can see how we
97
+ build the `Stocks.apk` in [example/stocks](example/stocks). Eventually we plan
98
+ to make this much easier and support platforms other than Android, but that work
99
+ still in progress.
0 commit comments