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

Unified Diff: sky/examples/stocks-fn/lib/stock_app.dart

Issue 1038533002: Load data for StocksApp incrementally (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: remove spurious diff Created 5 years, 9 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
« no previous file with comments | « sky/examples/stocks-fn/data/stock_data_9.json ('k') | sky/examples/stocks-fn/lib/stock_data.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/stocks-fn/lib/stock_app.dart
diff --git a/sky/examples/stocks-fn/lib/stock_app.dart b/sky/examples/stocks-fn/lib/stock_app.dart
index 50085d63a87edb7b43e1ffd400a46f75ab06848a..6c6888c98502c18ccca9ea6dabdd6a2aa478a8fb 100644
--- a/sky/examples/stocks-fn/lib/stock_app.dart
+++ b/sky/examples/stocks-fn/lib/stock_app.dart
@@ -34,18 +34,16 @@ class StocksApp extends App {
${typography.white.title};'''
);
- List<Stock> _sortedStocks = [];
+ StockDataFetcher _stockDataFetcher;
+ List<Stock> _stocks = [];
bool _isSearching = false;
bool _isShowingMenu = false;
String _searchQuery;
StocksApp() : super() {
- fetchStockOracle().then((oracle) {
+ _stockDataFetcher = new StockDataFetcher((StockData data) {
setState(() {
- _sortedStocks = oracle.stocks;
- trace('StocksApp::sortStocks', () {
- _sortedStocks.sort((a, b) => a.symbol.compareTo(b.symbol));
- });
+ data.appendTo(_stocks);
});
});
}
@@ -155,7 +153,7 @@ class StocksApp extends App {
return new Scaffold(
actionBar: actionBar,
- content: new Stocklist(stocks: _sortedStocks, query: _searchQuery),
+ content: new Stocklist(stocks: _stocks, query: _searchQuery),
fab: new FloatingActionButton(
content: new Icon(type: 'content/add_white', size: 24), level: 3),
drawer: drawer,
« no previous file with comments | « sky/examples/stocks-fn/data/stock_data_9.json ('k') | sky/examples/stocks-fn/lib/stock_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698