From 76a5e6184e066d4fe2dc82258285f1e8470765b2 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Thu, 26 Mar 2015 17:17:34 -0700 Subject: [PATCH] Improve Sky READMEs TBR=ojan@chromium.org Review URL: https://codereview.chromium.org/1037163002 --- engine/src/flutter/README.md | 89 +------------------ engine/src/flutter/examples/README.md | 13 +++ .../examples/hello_world/hello_world.dart | 11 +++ .../src/flutter/examples/hello_world/main.sky | 7 ++ 4 files changed, 34 insertions(+), 86 deletions(-) create mode 100644 engine/src/flutter/examples/README.md create mode 100644 engine/src/flutter/examples/hello_world/hello_world.dart create mode 100644 engine/src/flutter/examples/hello_world/main.sky diff --git a/engine/src/flutter/README.md b/engine/src/flutter/README.md index 763d5ec51f..78c1da6fb0 100644 --- a/engine/src/flutter/README.md +++ b/engine/src/flutter/README.md @@ -1,90 +1,7 @@ Sky === -Sky is an experimental, high-performance UI framework for mobile apps. Sky helps -you create apps with beautiful user interfaces and high-quality interactive -design that run smoothly at 120 Hz. +For information about using Sky, please see the +[Sky SDK](https://github.com/domokit/sky_sdk/). -Sky consists of two components: - -1. *The Sky engine.* The [engine](engine) is the core of the system system. - Written in C++, the engine provides the muscle of the Sky system. The engine - provides several primitives, including a soft real-time scheduler and a - hierarchial, retained-mode graphics system, that let you build high-quality - apps. - -2. *The Sky framework.* The [framework](framework) makes it easy to build apps - using Sky by providing familiar user interface widgets, such as buttons, - infinite lists, and animations, on top of the engine using Dart. These - extensible components follow a functional programming style inspired by - React. - -Sky is still experimental. We're experimenting with different ideas and -exploring various approaches, many of which won't work and will need to be -discarded, but, if we're lucky, some of which might turn out to be useful. - -Examples --------- - -The simplest Sky app is, appropriately, HelloWorldApp: - -```dart -import 'package:sky/framework/fn.dart'; - -class HelloWorldApp extends App { - Node build() { - return new Text('Hello, world!'); - } -} - -void main() { - new HelloWorldApp(); -} -``` - -Execution starts in `main`, which creates the `HelloWorldApp`. The framework -then marks `HelloWorldApp` as dirty, which schedules it to build during the next -animation frame. Each animation frame, the framework calls `build` on all the -dirty components and diffs the virtual `Node` hierarchy returned this frame with -the hierarchy returned last frame. Any differences are then applied as mutations -to the physical heiarchy retained by the engine. - -For a more featureful example, please see the -[example stocks app](examples/stocks/lib/stocks_app.dart). - -Services --------- - -Sky apps can access services from the host operating system using Mojo. For -example, you can access the network using the `network_service.mojom` interface. -Although you can use these low-level interfaces directly, you might prefer to -access these services via libraries in the framework. For example, the -`fetch.dart` library wraps the underlying `network_service.mojom` in an -ergonomic interface: - -```dart -import 'package:sky/framework/net/fetch.dart'; - -void foo() { - fetch('example.txt').then((Response response) { - print(response.bodyAsString()); - }); -} -``` - -Supported platforms -------------------- - -Currently, Sky supports the Android and Mojo operating systems. - -Specifications --------------- - -We're documenting Sky with a [set of technical specifications](specs) that -define precisely the behavior of the engine. Currently both the implementation -and the specification are in flux, but hopefully they'll converge over time. - -Contributing ------------- - -Instructions for building and testing Sky are contained in [HACKING.md](HACKING.md). +For information about contributing to Sky, please see [HACKING.md](HACKING.md). diff --git a/engine/src/flutter/examples/README.md b/engine/src/flutter/examples/README.md new file mode 100644 index 0000000000..6305be9681 --- /dev/null +++ b/engine/src/flutter/examples/README.md @@ -0,0 +1,13 @@ +Sky Examples +============ + +This directory contains several examples of using Sky. + +1. *Hello, world.* The [hello world app](hello_world) is a basic app that shows + the text "hello, world." + +2. *Stocks.* The [stocks app](stocks) is an example of a typical mobile app + built using Sky. The app shows a list of all the stocks in the NASDAQ. + +3. *Widgets.* The [widgets app](widgets) contains a number of Sky widgets so + you can experiment with them in a simple container. diff --git a/engine/src/flutter/examples/hello_world/hello_world.dart b/engine/src/flutter/examples/hello_world/hello_world.dart new file mode 100644 index 0000000000..0ad7536b59 --- /dev/null +++ b/engine/src/flutter/examples/hello_world/hello_world.dart @@ -0,0 +1,11 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:sky/framework/fn.dart'; + +class HelloWorldApp extends App { + Node build() { + return new Text('Hello, world!'); + } +} diff --git a/engine/src/flutter/examples/hello_world/main.sky b/engine/src/flutter/examples/hello_world/main.sky new file mode 100644 index 0000000000..a32206943c --- /dev/null +++ b/engine/src/flutter/examples/hello_world/main.sky @@ -0,0 +1,7 @@ +