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

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

Issue 1021723005: Load stocks data off the network (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | sky/examples/stocks-fn/lib/stock_data.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'package:sky/framework/components/action_bar.dart'; 5 import 'package:sky/framework/components/action_bar.dart';
6 import 'package:sky/framework/components/drawer.dart'; 6 import 'package:sky/framework/components/drawer.dart';
7 import 'package:sky/framework/components/drawer_header.dart'; 7 import 'package:sky/framework/components/drawer_header.dart';
8 import 'package:sky/framework/components/floating_action_button.dart'; 8 import 'package:sky/framework/components/floating_action_button.dart';
9 import 'package:sky/framework/components/icon.dart'; 9 import 'package:sky/framework/components/icon.dart';
10 import 'package:sky/framework/components/input.dart'; 10 import 'package:sky/framework/components/input.dart';
(...skipping 15 matching lines...) Expand all
26 static Style _iconStyle = new Style(''' 26 static Style _iconStyle = new Style('''
27 padding: 8px;''' 27 padding: 8px;'''
28 ); 28 );
29 29
30 static Style _titleStyle = new Style(''' 30 static Style _titleStyle = new Style('''
31 padding-left: 24px; 31 padding-left: 24px;
32 flex: 1; 32 flex: 1;
33 ${typography.white.title};''' 33 ${typography.white.title};'''
34 ); 34 );
35 35
36 List<Stock> _sortedStocks; 36 List<Stock> _sortedStocks = [];
37 bool _isSearching = false; 37 bool _isSearching = false;
38 bool _isShowingMenu = false; 38 bool _isShowingMenu = false;
39 String _searchQuery; 39 String _searchQuery;
40 40
41 StocksApp() : super() { 41 StocksApp() : super() {
42 _sortedStocks = oracle.stocks; 42 fetchStockOracle().then((oracle) {
43 _sortedStocks.sort((a, b) => a.symbol.compareTo(b.symbol)); 43 setState(() {
44 _sortedStocks = oracle.stocks;
45 _sortedStocks.sort((a, b) => a.symbol.compareTo(b.symbol));
46 });
47 });
44 } 48 }
45 49
46 void _handleSearchClick(_) { 50 void _handleSearchClick(_) {
47 setState(() { 51 setState(() {
48 _isSearching = !_isSearching; 52 _isSearching = !_isSearching;
49 }); 53 });
50 } 54 }
51 55
52 void _handleMenuClick(_) { 56 void _handleMenuClick(_) {
53 setState(() { 57 setState(() {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 return new Scaffold( 153 return new Scaffold(
150 actionBar: actionBar, 154 actionBar: actionBar,
151 content: new Stocklist(stocks: _sortedStocks, query: _searchQuery), 155 content: new Stocklist(stocks: _sortedStocks, query: _searchQuery),
152 fab: new FloatingActionButton( 156 fab: new FloatingActionButton(
153 content: new Icon(type: 'content/add_white', size: 24), level: 3), 157 content: new Icon(type: 'content/add_white', size: 24), level: 3),
154 drawer: drawer, 158 drawer: drawer,
155 overlays: overlays 159 overlays: overlays
156 ); 160 );
157 } 161 }
158 } 162 }
OLDNEW
« no previous file with comments | « no previous file | sky/examples/stocks-fn/lib/stock_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698