diff --git a/examples/stocks-fn/stocksapp.dart b/examples/stocks-fn/lib/stock_app.dart similarity index 91% rename from examples/stocks-fn/stocksapp.dart rename to examples/stocks-fn/lib/stock_app.dart index 83e3c978d3..6ea4841b26 100644 --- a/examples/stocks-fn/stocksapp.dart +++ b/examples/stocks-fn/lib/stock_app.dart @@ -1,24 +1,19 @@ -library stocksapp; +// 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 '../data/stocks.dart'; -import 'dart:math'; -import 'package:sky/framework/animation/scroll_behavior.dart'; import 'package:sky/framework/components/action_bar.dart'; import 'package:sky/framework/components/drawer.dart'; import 'package:sky/framework/components/drawer_header.dart'; -import 'package:sky/framework/components/fixed_height_scrollable.dart'; import 'package:sky/framework/components/floating_action_button.dart'; import 'package:sky/framework/components/icon.dart'; import 'package:sky/framework/components/input.dart'; -import 'package:sky/framework/components/material.dart'; import 'package:sky/framework/components/menu_divider.dart'; import 'package:sky/framework/components/menu_item.dart'; import 'package:sky/framework/fn.dart'; import 'package:sky/framework/theme/typography.dart' as typography; - -part 'stockarrow.dart'; -part 'stocklist.dart'; -part 'stockrow.dart'; +import 'stock_data.dart'; +import 'stock_list.dart'; class StocksApp extends App { diff --git a/examples/stocks-fn/stockarrow.dart b/examples/stocks-fn/lib/stock_arrow.dart similarity index 78% rename from examples/stocks-fn/stockarrow.dart rename to examples/stocks-fn/lib/stock_arrow.dart index 82e52815d2..9524ffe37c 100644 --- a/examples/stocks-fn/stockarrow.dart +++ b/examples/stocks-fn/lib/stock_arrow.dart @@ -1,10 +1,12 @@ -part of stocksapp; +// 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 'dart:math'; +import 'package:sky/framework/fn.dart'; class StockArrow extends Component { - - double percentChange; - - static Style _style = new Style(''' + static final Style _style = new Style(''' width: 40px; height: 40px; display: flex; @@ -15,7 +17,7 @@ class StockArrow extends Component { border: 1px solid transparent;''' ); - static Style _upStyle = new Style(''' + static final Style _upStyle = new Style(''' width: 0; height: 0; border-left: 9px solid transparent; @@ -24,7 +26,7 @@ class StockArrow extends Component { border-bottom: 9px solid white;''' ); - static Style _downStyle = new Style(''' + static final Style _downStyle = new Style(''' width: 0; height: 0; border-left: 9px solid transparent; @@ -33,8 +35,11 @@ class StockArrow extends Component { border-top: 9px solid white''' ); + double percentChange; + StockArrow({ Object key, this.percentChange }) : super(key: key); + // TODO(abarth): These should use sky/framework/theme/colors.dart. final List _kRedColors = [ '#E57373', '#EF5350', @@ -45,6 +50,7 @@ class StockArrow extends Component { '#B71C1C', ]; + // TODO(abarth): These should use sky/framework/theme/colors.dart. final List _kGreenColors = [ '#81C784', '#66BB6A', diff --git a/examples/data/stocks.dart b/examples/stocks-fn/lib/stock_data.dart similarity index 100% rename from examples/data/stocks.dart rename to examples/stocks-fn/lib/stock_data.dart diff --git a/examples/stocks-fn/stocklist.dart b/examples/stocks-fn/lib/stock_list.dart similarity index 57% rename from examples/stocks-fn/stocklist.dart rename to examples/stocks-fn/lib/stock_list.dart index f7330d130b..04738ba4d4 100644 --- a/examples/stocks-fn/stocklist.dart +++ b/examples/stocks-fn/lib/stock_list.dart @@ -1,4 +1,12 @@ -part of stocksapp; +// 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/animation/scroll_behavior.dart'; +import 'package:sky/framework/components/fixed_height_scrollable.dart'; +import 'package:sky/framework/fn.dart'; +import 'stock_data.dart'; +import 'stock_row.dart'; class Stocklist extends FixedHeightScrollable { String query; diff --git a/examples/stocks-fn/stockrow.dart b/examples/stocks-fn/lib/stock_row.dart similarity index 69% rename from examples/stocks-fn/stockrow.dart rename to examples/stocks-fn/lib/stock_row.dart index 4d7d688256..6f75dee5db 100644 --- a/examples/stocks-fn/stockrow.dart +++ b/examples/stocks-fn/lib/stock_row.dart @@ -1,10 +1,15 @@ -part of stocksapp; +// 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/components/material.dart'; +import 'package:sky/framework/fn.dart'; +import 'package:sky/framework/theme/typography.dart' as typography; +import 'stock_arrow.dart'; +import 'stock_data.dart'; class StockRow extends Component { - - Stock stock; - - static Style _style = new Style(''' + static final Style _style = new Style(''' transform: translateX(0); display: flex; align-items: center; @@ -15,20 +20,22 @@ class StockRow extends Component { padding-bottom: 20px;''' ); - static Style _tickerStyle = new Style(''' + static final Style _tickerStyle = new Style(''' flex: 1;''' ); - static Style _lastSaleStyle = new Style(''' + static final Style _lastSaleStyle = new Style(''' text-align: right; padding-right: 16px;''' ); - static Style _changeStyle = new Style(''' + static final Style _changeStyle = new Style(''' ${typography.black.caption}; text-align: right;''' ); + Stock stock; + StockRow({Stock stock}) : super(key: stock.symbol) { this.stock = stock; } diff --git a/examples/stocks-fn/main.sky b/examples/stocks-fn/main.sky new file mode 100644 index 0000000000..16c1688884 --- /dev/null +++ b/examples/stocks-fn/main.sky @@ -0,0 +1,16 @@ +#!mojo mojo:sky_viewer + + + + + diff --git a/examples/stocks-fn/pubspec.yaml b/examples/stocks-fn/pubspec.yaml new file mode 100644 index 0000000000..81725bd7d0 --- /dev/null +++ b/examples/stocks-fn/pubspec.yaml @@ -0,0 +1,7 @@ +name: stocks +author: Chromium Authors +description: A demo application using Sky that shows stock data +homepage: https://github.com/domokit/mojo/tree/master/sky/examples/stocks-fn +version: 0.0.1 +dependencies: + sky: '>=0.0.1 <1.0.0' diff --git a/examples/stocks-fn/stocks.sky b/examples/stocks-fn/stocks.sky deleted file mode 100644 index 50f9a4e376..0000000000 --- a/examples/stocks-fn/stocks.sky +++ /dev/null @@ -1,10 +0,0 @@ -#!mojo mojo:sky_viewer - - - - diff --git a/examples/stocks/stocks.sky b/examples/stocks/stocks.sky index 6b97386f21..50d8fdd0c9 100644 --- a/examples/stocks/stocks.sky +++ b/examples/stocks/stocks.sky @@ -70,7 +70,7 @@