diff --git a/examples/stocks2/lib/stock_app.dart b/examples/stocks2/lib/stock_app.dart index 8dd1fda6b9..fd2b2f1990 100644 --- a/examples/stocks2/lib/stock_app.dart +++ b/examples/stocks2/lib/stock_app.dart @@ -46,6 +46,8 @@ class StocksApp extends App { _drawerController = new DrawerController(_handleDrawerStatusChanged); } + void syncFields(StocksApp source) { } + bool _isSearching = false; String _searchQuery; diff --git a/examples/stocks2/lib/stock_arrow.dart b/examples/stocks2/lib/stock_arrow.dart index a13cbe4199..3f2bab6ff2 100644 --- a/examples/stocks2/lib/stock_arrow.dart +++ b/examples/stocks2/lib/stock_arrow.dart @@ -12,10 +12,11 @@ import 'dart:math' as math; import 'dart:sky' as sky; class StockArrow extends Component { - double percentChange; StockArrow({ Object key, this.percentChange }) : super(key: key); + final double percentChange; + int _colorIndexForPercentChange(double percentChange) { double maxPercent = 10.0; double normalizedPercentChange = math.min(percentChange.abs(), maxPercent) / maxPercent; @@ -71,4 +72,5 @@ class StockArrow extends Component { height: size, margin: const EdgeDims.symmetric(horizontal: 5.0)); } + } diff --git a/examples/stocks2/lib/stock_list.dart b/examples/stocks2/lib/stock_list.dart index 58fa601ba9..7ff6fe8cb7 100644 --- a/examples/stocks2/lib/stock_list.dart +++ b/examples/stocks2/lib/stock_list.dart @@ -8,8 +8,6 @@ import 'stock_data.dart'; import 'stock_row.dart'; class Stocklist extends FixedHeightScrollable { - String query; - List stocks; Stocklist({ Object key, @@ -17,6 +15,15 @@ class Stocklist extends FixedHeightScrollable { this.query }) : super(itemHeight: StockRow.kHeight, key: key); + String query; + List stocks; + + void syncFields(Stocklist source) { + query = source.query; + stocks = source.stocks; + super.syncFields(source); + } + List buildItems(int start, int count) { var filteredStocks = stocks.where((stock) { return query == null || diff --git a/examples/stocks2/lib/stock_menu.dart b/examples/stocks2/lib/stock_menu.dart index 29b0dc2238..1ac20ccc20 100644 --- a/examples/stocks2/lib/stock_menu.dart +++ b/examples/stocks2/lib/stock_menu.dart @@ -8,10 +8,15 @@ import 'package:sky/framework/components2/checkbox.dart'; import 'package:sky/framework/theme/view_configuration.dart'; class StockMenu extends Component { - PopupMenuController controller; - StockMenu({Object key, this.controller, this.autorefresh: false, this.onAutorefreshChanged}) : super(key: key); + StockMenu({ + Object key, + this.controller, + this.autorefresh: false, + this.onAutorefreshChanged + }) : super(key: key); + final PopupMenuController controller; final bool autorefresh; final ValueChanged onAutorefreshChanged; diff --git a/examples/stocks2/lib/stock_row.dart b/examples/stocks2/lib/stock_row.dart index 4aea39c11b..6df131c520 100644 --- a/examples/stocks2/lib/stock_row.dart +++ b/examples/stocks2/lib/stock_row.dart @@ -12,14 +12,13 @@ import 'stock_arrow.dart'; import 'stock_data.dart'; class StockRow extends Component { + + StockRow({ Stock stock }) : this.stock = stock, super(key: stock.symbol); + + final Stock stock; + static const double kHeight = 70.0; - Stock stock; - - StockRow({ Stock stock }) : super(key: stock.symbol) { - this.stock = stock; - } - UINode build() { String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}";