| Index: sky/examples/stocks-fn/stocklist.dart
|
| diff --git a/sky/examples/stocks-fn/stocklist.dart b/sky/examples/stocks-fn/stocklist.dart
|
| index 9f0de09196a05d1211b05ba1f6c196ec4eab6be5..50c64f360018c59f337b4ea1efcf7f953c76b03b 100644
|
| --- a/sky/examples/stocks-fn/stocklist.dart
|
| +++ b/sky/examples/stocks-fn/stocklist.dart
|
| @@ -1,20 +1,22 @@
|
| part of stocksapp;
|
|
|
| class Stocklist extends FixedHeightScrollable {
|
| -
|
| + String query;
|
| List<Stock> stocks;
|
|
|
| Stocklist({
|
| Object key,
|
| - this.stocks
|
| + this.stocks,
|
| + this.query
|
| }) : super(key: key, minOffset: 0.0);
|
|
|
| List<Node> buildItems(int start, int count) {
|
| - var items = [];
|
| - for (var i = 0; i < count; i++) {
|
| - items.add(new StockRow(stock: stocks[start + i]));
|
| - }
|
| -
|
| - return items;
|
| + return stocks
|
| + .skip(start)
|
| + .where((stock) => query == null || stock.symbol.contains(
|
| + new RegExp(query, caseSensitive: false)))
|
| + .take(count)
|
| + .map((stock) => new StockRow(stock: stock))
|
| + .toList(growable: false);
|
| }
|
| }
|
|
|