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

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

Issue 1166153002: Add a basic popup menu implementation to stocks2 (Closed) Base URL: git@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 | « no previous file | sky/examples/stocks2/lib/stock_menu.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/components2/tool_bar.dart'; 5 import 'package:sky/framework/components2/tool_bar.dart';
6 import 'package:sky/framework/components2/drawer.dart'; 6 import 'package:sky/framework/components2/drawer.dart';
7 import 'package:sky/framework/components2/drawer_header.dart'; 7 import 'package:sky/framework/components2/drawer_header.dart';
8 import 'package:sky/framework/components2/floating_action_button.dart'; 8 import 'package:sky/framework/components2/floating_action_button.dart';
9 import 'package:sky/framework/components2/icon.dart'; 9 import 'package:sky/framework/components2/icon.dart';
10 import 'package:sky/framework/components2/icon_button.dart'; 10 import 'package:sky/framework/components2/icon_button.dart';
11 import 'package:sky/framework/components2/menu_divider.dart'; 11 import 'package:sky/framework/components2/menu_divider.dart';
12 import 'package:sky/framework/components2/menu_item.dart'; 12 import 'package:sky/framework/components2/menu_item.dart';
13 import 'package:sky/framework/components2/input.dart'; 13 import 'package:sky/framework/components2/input.dart';
14 // import 'package:sky/framework/components2/modal_overlay.dart'; 14 import 'package:sky/framework/components2/modal_overlay.dart';
15 // import 'package:sky/framework/components2/popup_menu.dart'; 15 import 'package:sky/framework/components2/popup_menu.dart';
16 import 'package:sky/framework/components2/radio.dart'; 16 import 'package:sky/framework/components2/radio.dart';
17 import 'package:sky/framework/components2/scaffold.dart'; 17 import 'package:sky/framework/components2/scaffold.dart';
18 import 'package:sky/framework/fn2.dart'; 18 import 'package:sky/framework/fn2.dart';
19 import 'package:sky/framework/theme2/typography.dart' as typography; 19 import 'package:sky/framework/theme2/typography.dart' as typography;
20 import 'package:sky/framework/theme2/colors.dart' as colors; 20 import 'package:sky/framework/theme2/colors.dart' as colors;
21 import 'stock_data.dart'; 21 import 'stock_data.dart';
22 import 'package:sky/framework/rendering/box.dart'; 22 import 'package:sky/framework/rendering/box.dart';
23 import 'stock_list.dart'; 23 import 'stock_list.dart';
24 // import 'stock_menu.dart'; 24 import 'stock_menu.dart';
25 25
26 import 'dart:async'; 26 import 'dart:async';
27 import 'dart:sky' as sky; 27 import 'dart:sky' as sky;
28 28
29 enum StockMode { optimistic, pessimistic } 29 enum StockMode { optimistic, pessimistic }
30 30
31 class StocksApp extends App { 31 class StocksApp extends App {
32 32
33 // static final Style _titleStyle = new Style(''' 33 // static final Style _titleStyle = new Style('''
34 // ${typography.white.title};'''); 34 // ${typography.white.title};''');
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 DrawerController _drawerController; 71 DrawerController _drawerController;
72 bool _drawerShowing = false; 72 bool _drawerShowing = false;
73 73
74 void _handleDrawerStatusChanged(bool showing) { 74 void _handleDrawerStatusChanged(bool showing) {
75 setState(() { 75 setState(() {
76 _drawerShowing = showing; 76 _drawerShowing = showing;
77 }); 77 });
78 } 78 }
79 79
80 // PopupMenuController _menuController; 80 PopupMenuController _menuController;
81 81
82 void _handleMenuShow(_) { 82 void _handleMenuShow(_) {
83 setState(() { 83 setState(() {
84 // _menuController = new PopupMenuController(); 84 _menuController = new PopupMenuController();
85 // _menuController.open(); 85 _menuController.open();
86 }); 86 });
87 } 87 }
88 88
89 void _handleMenuHide(_) { 89 void _handleMenuHide(_) {
90 setState(() { 90 setState(() {
91 // _menuController.close().then((_) { 91 _menuController.close().then((_) {
92 // setState(() { 92 setState(() {
93 // _menuController = null; 93 _menuController = null;
94 // }); 94 });
95 // }); 95 });
96 }); 96 });
97 } 97 }
98 98
99 bool _autorefresh = false; 99 bool _autorefresh = false;
100 void _handleAutorefreshChanged(bool value) { 100 void _handleAutorefreshChanged(bool value) {
101 setState(() { 101 setState(() {
102 _autorefresh = value; 102 _autorefresh = value;
103 }); 103 });
104 } 104 }
105 105
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 onGestureTap: _handleSearchEnd), 180 onGestureTap: _handleSearchEnd),
181 center: new Input( 181 center: new Input(
182 focused: true, 182 focused: true,
183 placeholder: 'Search stocks', 183 placeholder: 'Search stocks',
184 onChanged: _handleSearchQueryChanged), 184 onChanged: _handleSearchQueryChanged),
185 backgroundColor: colors.Grey[50] 185 backgroundColor: colors.Grey[50]
186 ); 186 );
187 } 187 }
188 188
189 void addMenuToOverlays(List<UINode> overlays) { 189 void addMenuToOverlays(List<UINode> overlays) {
190 // if (_menuController == null) 190 if (_menuController == null)
191 // return; 191 return;
192 // overlays.add(new ModalOverlay( 192 overlays.add(new ModalOverlay(
193 // children: [new StockMenu( 193 children: [new StockMenu(
194 // controller: _menuController, 194 controller: _menuController,
195 // autorefresh: _autorefresh, 195 autorefresh: _autorefresh,
196 // onAutorefreshChanged: _handleAutorefreshChanged 196 onAutorefreshChanged: _handleAutorefreshChanged
197 // )], 197 )],
198 // onDismiss: _handleMenuHide)); 198 onDismiss: _handleMenuHide));
199 } 199 }
200 200
201 UINode build() { 201 UINode build() {
202 List<UINode> overlays = [ 202 List<UINode> overlays = [
203 new Scaffold( 203 new Scaffold(
204 toolbar: _isSearching ? buildSearchBar() : buildToolBar(), 204 toolbar: _isSearching ? buildSearchBar() : buildToolBar(),
205 body: new Stocklist(stocks: _stocks, query: _searchQuery), 205 body: new Stocklist(stocks: _stocks, query: _searchQuery),
206 floatingActionButton: new FloatingActionButton( 206 floatingActionButton: new FloatingActionButton(
207 content: new Icon(type: 'content/add_white', size: 24), 207 content: new Icon(type: 'content/add_white', size: 24),
208 level: 3), 208 level: 3),
209 drawer: _drawerShowing ? buildDrawer() : null 209 drawer: _drawerShowing ? buildDrawer() : null
210 ), 210 ),
211 ]; 211 ];
212 addMenuToOverlays(overlays); 212 addMenuToOverlays(overlays);
213 return new StackContainer(children: overlays); 213 return new StackContainer(children: overlays);
214 } 214 }
215 } 215 }
216 216
217 void main() { 217 void main() {
218 print("starting stocks app!"); 218 print("starting stocks app!");
219 App app = new StocksApp(); 219 App app = new StocksApp();
220 app.appView.onFrame = () { 220 app.appView.onFrame = () {
221 // uncomment this for debugging: 221 // uncomment this for debugging:
222 // app.appView.debugDumpRenderTree(); 222 // app.appView.debugDumpRenderTree();
223 }; 223 };
224 } 224 }
OLDNEW
« no previous file with comments | « no previous file | sky/examples/stocks2/lib/stock_menu.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698