Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2103)

Unified Diff: sky/sdk/example/stocks/lib/stock_list.dart

Issue 1223863003: Factor ScrollableList out of StockList (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/sdk/example/stocks/lib/stock_list.dart
diff --git a/sky/sdk/example/stocks/lib/stock_list.dart b/sky/sdk/example/stocks/lib/stock_list.dart
index 6fd63806fb8c4b1640a4ca5f2ca1024f6bba6860..2cfd2ede4cb28732e9cfc839eb63fd8f56590e68 100644
--- a/sky/sdk/example/stocks/lib/stock_list.dart
+++ b/sky/sdk/example/stocks/lib/stock_list.dart
@@ -2,31 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:sky/widgets/fixed_height_scrollable.dart';
+import 'package:sky/widgets/scrollable_list.dart';
import 'package:sky/widgets/basic.dart';
import 'stock_data.dart';
import 'stock_row.dart';
-class Stocklist extends FixedHeightScrollable {
+class Stocklist extends Component {
+ Stocklist({ String key, this.stocks }) : super(key: key);
- Stocklist({ String key, this.stocks })
- : super(itemHeight: StockRow.kHeight, key: key);
+ final List<Stock> stocks;
- List<Stock> stocks;
-
- int get itemCount => stocks.length;
-
- void syncFields(Stocklist source) {
- stocks = source.stocks;
- super.syncFields(source);
- }
-
- List<Widget> buildItems(int start, int count) {
- return stocks
- .skip(start)
- .take(count)
- .map((stock) => new StockRow(stock: stock))
- .toList(growable: false);
+ Widget build() {
+ return new ScrollableList<Stock>(
+ items: stocks,
+ itemHeight: StockRow.kHeight,
+ itemBuilder: (stock) => new StockRow(stock: stock)
+ );
}
}

Powered by Google App Engine
This is Rietveld 408576698