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

Side by Side Diff: sky/examples/stocks2/lib/stock_app.dart

Issue 1156543004: [Effen] Fork stocks and fn.dart so we have something to work on during the porting process (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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 | « sky/examples/stocks2/data/stock_data_9.json ('k') | sky/examples/stocks2/lib/stock_arrow.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // import 'package:sky/framework/components/tool_bar.dart';
6 // import 'package:sky/framework/components/drawer.dart';
7 // import 'package:sky/framework/components/drawer_header.dart';
8 // import 'package:sky/framework/components/floating_action_button.dart';
9 // import 'package:sky/framework/components/icon.dart';
10 // import 'package:sky/framework/components/icon_button.dart';
11 // import 'package:sky/framework/components/input.dart';
12 // import 'package:sky/framework/components/menu_divider.dart';
13 // import 'package:sky/framework/components/menu_item.dart';
14 // import 'package:sky/framework/components/modal_overlay.dart';
15 // import 'package:sky/framework/components/popup_menu.dart';
16 // import 'package:sky/framework/components/radio.dart';
17 // import 'package:sky/framework/components/scaffold.dart';
18 import 'package:sky/framework/fn2.dart';
19 import 'package:sky/framework/theme/typography.dart' as typography;
20 import 'package:sky/framework/theme/colors.dart';
21 import 'stock_data.dart';
22 // import 'stock_list.dart';
23 // import 'stock_menu.dart';
24
25 import 'dart:async';
26 import 'package:sky/framework/layout2.dart';
27
28 enum StockMode { Optimistic, Pessimistic }
29
30 class StocksApp extends App {
31
32 // static final Style _toolBarStyle = new Style('''
33 // background-color: ${Purple[500]};''');
34
35 // static final Style _searchBarStyle = new Style('''
36 // background-color: ${Grey[50]};''');
37
38 // static final Style _titleStyle = new Style('''
39 // ${typography.white.title};''');
40
41 List<Stock> _stocks = [];
42
43 StocksApp() : super() {
44 // if (debug)
45 // new Timer(new Duration(seconds: 1), dumpState);
46 new StockDataFetcher((StockData data) {
47 setState(() {
48 data.appendTo(_stocks);
49 });
50 });
51 // _drawerController = new DrawerController(_handleDrawerStatusChanged);
52 }
53
54 bool _isSearching = false;
55 String _searchQuery;
56
57 void _handleSearchBegin(_) {
58 setState(() {
59 _isSearching = true;
60 });
61 }
62
63 void _handleSearchEnd(_) {
64 setState(() {
65 _isSearching = false;
66 _searchQuery = null;
67 });
68 }
69
70 void _handleSearchQueryChanged(String query) {
71 setState(() {
72 _searchQuery = query;
73 });
74 }
75
76 // DrawerController _drawerController;
77 bool _drawerShowing = false;
78
79 void _handleDrawerStatusChanged(bool showing) {
80 setState(() {
81 _drawerShowing = showing;
82 });
83 }
84
85 // PopupMenuController _menuController;
86
87 void _handleMenuShow(_) {
88 setState(() {
89 // _menuController = new PopupMenuController();
90 // _menuController.open();
91 });
92 }
93
94 void _handleMenuHide(_) {
95 setState(() {
96 // _menuController.close().then((_) {
97 // setState(() {
98 // _menuController = null;
99 // });
100 // });
101 });
102 }
103
104 bool _autorefresh = false;
105 void _handleAutorefreshChanged(bool value) {
106 setState(() {
107 _autorefresh = value;
108 });
109 }
110
111 StockMode _stockMode = StockMode.Optimistic;
112 void _handleStockModeChange(StockMode value) {
113 setState(() {
114 _stockMode = value;
115 });
116 }
117
118 // static FlexBoxParentData _flex1 = new FlexBoxParentData()..flex = 1;
119
120 // Drawer buildDrawer() {
121 // return new Drawer(
122 // controller: _drawerController,
123 // level: 3,
124 // children: [
125 // new DrawerHeader(children: [new Text('Stocks')]),
126 // new MenuItem(
127 // key: 'Stock list',
128 // icon: 'action/assessment',
129 // children: [new Text('Stock List')]),
130 // new MenuItem(
131 // key: 'Account Balance',
132 // icon: 'action/account_balance',
133 // children: [new Text('Account Balance')]),
134 // new MenuDivider(key: 'div1'),
135 // new MenuItem(
136 // key: 'Optimistic Menu Item',
137 // icon: 'action/thumb_up',
138 // onGestureTap: (event) => _handleStockModeChange(StockMode.Optimisti c),
139 // children: [
140 // new ParentDataNode(new Text('Optimistic'), _flex1),
141 // new Radio(key: 'optimistic-radio', value: StockMode.Optimistic, g roupValue: _stockMode, onChanged: _handleStockModeChange)
142 // ]),
143 // new MenuItem(
144 // key: 'Pessimistic Menu Item',
145 // icon: 'action/thumb_down',
146 // onGestureTap: (event) => _handleStockModeChange(StockMode.Pessimist ic),
147 // children: [
148 // new ParentDataNode(new Text('Pessimistic'), _flex1),
149 // new Radio(key: 'pessimistic-radio', value: StockMode.Pessimistic, groupValue: _stockMode, onChanged: _handleStockModeChange)
150 // ]),
151 // new MenuDivider(key: 'div2'),
152 // new MenuItem(
153 // key: 'Settings',
154 // icon: 'action/settings',
155 // children: [new Text('Settings')]),
156 // new MenuItem(
157 // key: 'Help & Feedback',
158 // icon: 'action/help',
159 // children: [new Text('Help & Feedback')])
160 // ]
161 // );
162 // }
163
164 // UINode buildToolBar() {
165 // return new StyleNode(
166 // new ToolBar(
167 // left: new IconButton(
168 // icon: 'navigation/menu_white',
169 // onGestureTap: _drawerController.toggle),
170 // center: new Container(
171 // style: _titleStyle,
172 // children: [new Text('Stocks')]),
173 // right: [
174 // new IconButton(
175 // icon: 'action/search_white',
176 // onGestureTap: _handleSearchBegin),
177 // new IconButton(
178 // icon: 'navigation/more_vert_white',
179 // onGestureTap: _handleMenuShow)
180 // ]),
181 // _toolBarStyle);
182 // }
183
184 // // TODO(abarth): Should we factor this into a SearchBar in the framework?
185 // UINode buildSearchBar() {
186 // return new StyleNode(
187 // new ToolBar(
188 // left: new IconButton(
189 // icon: 'navigation/arrow_back_grey600',
190 // onGestureTap: _handleSearchEnd),
191 // center: new Input(
192 // focused: true,
193 // placeholder: 'Search stocks',
194 // onChanged: _handleSearchQueryChanged)),
195 // _searchBarStyle);
196 // }
197
198 // void addMenuToOverlays(List<UINode> overlays) {
199 // if (_menuController == null)
200 // return;
201 // overlays.add(new ModalOverlay(
202 // children: [new StockMenu(
203 // controller: _menuController,
204 // autorefresh: _autorefresh,
205 // onAutorefreshChanged: _handleAutorefreshChanged
206 // )],
207 // onDismiss: _handleMenuHide));
208 // }
209
210 UINode build() {
211 // List<UINode> overlays = [];
212 // addMenuToOverlays(overlays);
213
214 // return new Scaffold(
215 // header: _isSearching ? buildSearchBar() : buildToolBar(),
216 // content: new Stocklist(stocks: _stocks, query: _searchQuery),
217 // fab: new FloatingActionButton(
218 // content: new Icon(type: 'content/add_white', size: 24), level: 3),
219 // drawer: _drawerShowing ? buildDrawer() : null,
220 // overlays: overlays
221 // );
222 }
223 }
224
225 void main() {
226 new StocksApp();
227 }
OLDNEW
« no previous file with comments | « sky/examples/stocks2/data/stock_data_9.json ('k') | sky/examples/stocks2/lib/stock_arrow.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698