Hixie a50b065197 Fix the crash when going to settings after showing the popup menu.
If your constraints are tight when you get laid out, you don't get a
relayout subtree root.

If you don't have a relayout subtree root, and you get marked dirty,
you go through layoutWithoutResize() rather than layout(), so we don't
get a parentUsesSize.

If you're not dirty and your constraints didn't change, layout() skips
your layout.

So then if your initial layout had parentUsesSize:true, and then you
got marked dirty directly, you would set your size with
parentCanUseSize=false, and then later if your parent tried to lay you
out then read your size, it would crash because your size wasn't set
up to allow you to get your size.

The fix is to actually remember the last setting of parentUsesSize,
even in the case of the constraints being tight and you later being
marked as needing layout directly.
2015-07-22 10:10:58 -07:00
..
2015-07-22 11:52:34 -04:00
2015-07-21 14:56:54 -07:00
2015-07-21 17:29:58 -07:00
2015-07-21 22:49:00 -07:00

Getting started with Sky

Sky apps are written in Dart. To get started, we need to set up Dart SDK:

Once you have installed Dart SDK, create a new directory and add a pubspec.yaml:

name: your_app_name
dependencies:
  sky: any

Next, create a lib directory (which is where your Dart code will go) and use the pub tool to fetch the Sky package and its dependencies:

  • mkdir lib
  • pub get && pub run sky:init

Sky assumes the entry point for your application is a main function in lib/main.dart:

import 'package:sky/widgets/basic.dart';

class HelloWorldApp extends App {
  Widget build() {
    return new Center(child: new Text('Hello, world!'));
  }
}

void main() {
  runApp(new HelloWorldApp());
}

Execution starts in main, which in this example runs a new instance of the HelloWorldApp. The HelloWorldApp builds a Text widget containing the traditional Hello, world! string and centers it on the screen using a Center widget. To learn more about the widget system, please see the widgets tutorial.

Setting up your Android device

Currently Sky requires an Android device running the Lollipop (or newer) version of the Android operating system.

  • Install the adb tool from the Android SDK:

  • Mac: brew install android-platform-tools

  • Linux: sudo apt-get install android-tools-adb

  • Enable developer mode on your device by visiting Settings > About phone and tapping the Build number field five times.

  • Enable Android debugging in Settings > Developer options.

  • Using a USB cable, plug your phone into your computer. If prompted on your device, authorize your computer to access your device.

Running a Sky application

The sky pub package includes a sky_tool script to assist in running Sky applications inside the SkyDemo.apk harness. The sky_tool script expects to be run from the root directory of your application's package (i.e., the same directory that contains the pubspec.yaml file). To run your app, follow these instructions:

  • ./packages/sky/sky_tool start to start the dev server and upload your app to the device. (NOTE: add a --install flag to install SkyDemo.apk if it is not already installed on the device.)

  • Use adb logcat to view any errors or Dart print() output from the app. adb logcat -s sky can be used to filter only adb messages from SkyDemo.apk.

Debugging

Sky uses Observatory for debugging and profiling. While running your Sky app using sky_tool, you can access Observatory by navigating your web browser to http://localhost:8181/.

Building a standalone APK

Although it is possible to build a standalone APK containing your application, doing so right now is difficult. If you're feeling brave, you can see how we build the Stocks.apk in example/stocks. Eventually we plan to make this much easier and support platforms other than Android, but that work still in progress.