OLD | NEW |
1 library stocksapp; | 1 library stocksapp; |
2 | 2 |
3 import '../../framework/fn.dart'; | |
4 import '../../framework/animation/scroll_behavior.dart'; | |
5 import '../../framework/components/drawer.dart'; | |
6 import '../../framework/components/drawer_header.dart'; | |
7 import '../../framework/components/fixed_height_scrollable.dart'; | |
8 import '../../framework/components/floating_action_button.dart'; | |
9 import '../../framework/components/icon.dart'; | |
10 import '../../framework/components/input.dart'; | |
11 import '../../framework/components/material.dart'; | |
12 import '../../framework/components/menu_divider.dart'; | |
13 import '../../framework/components/menu_item.dart'; | |
14 import '../../framework/components/action_bar.dart'; | |
15 import '../data/stocks.dart'; | 3 import '../data/stocks.dart'; |
16 import 'dart:math'; | 4 import 'dart:math'; |
| 5 import 'package:sky/framework/animation/scroll_behavior.dart'; |
| 6 import 'package:sky/framework/components/action_bar.dart'; |
| 7 import 'package:sky/framework/components/drawer.dart'; |
| 8 import 'package:sky/framework/components/drawer_header.dart'; |
| 9 import 'package:sky/framework/components/fixed_height_scrollable.dart'; |
| 10 import 'package:sky/framework/components/floating_action_button.dart'; |
| 11 import 'package:sky/framework/components/icon.dart'; |
| 12 import 'package:sky/framework/components/input.dart'; |
| 13 import 'package:sky/framework/components/material.dart'; |
| 14 import 'package:sky/framework/components/menu_divider.dart'; |
| 15 import 'package:sky/framework/components/menu_item.dart'; |
| 16 import 'package:sky/framework/fn.dart'; |
| 17 import 'package:sky/framework/theme/typography.dart' as typography; |
17 | 18 |
18 part 'stockarrow.dart'; | 19 part 'stockarrow.dart'; |
19 part 'stocklist.dart'; | 20 part 'stocklist.dart'; |
20 part 'stockrow.dart'; | 21 part 'stockrow.dart'; |
21 | 22 |
22 class StocksApp extends App { | 23 class StocksApp extends App { |
23 | 24 |
24 DrawerAnimation _drawerAnimation = new DrawerAnimation(); | 25 DrawerAnimation _drawerAnimation = new DrawerAnimation(); |
25 | 26 |
26 static Style _style = new Style(''' | 27 static Style _style = new Style(''' |
27 display: flex; | 28 display: flex; |
28 flex-direction: column; | 29 flex-direction: column; |
29 height: -webkit-fill-available; | 30 height: -webkit-fill-available; |
30 font-family: 'Roboto Regular', 'Helvetica'; | 31 ${typography.typeface}; |
31 font-size: 16px;''' | 32 ${typography.black.body1};''' |
32 ); | 33 ); |
33 | 34 |
34 static Style _iconStyle = new Style(''' | 35 static Style _iconStyle = new Style(''' |
35 padding: 8px;''' | 36 padding: 8px;''' |
36 ); | 37 ); |
37 | 38 |
38 static Style _titleStyle = new Style(''' | 39 static Style _titleStyle = new Style(''' |
39 padding-left: 24px; | 40 padding-left: 24px; |
40 flex: 1;''' | 41 flex: 1; |
| 42 ${typography.white.title};''' |
41 ); | 43 ); |
42 | 44 |
43 List<Stock> _sortedStocks; | 45 List<Stock> _sortedStocks; |
44 bool _isSearching = false; | 46 bool _isSearching = false; |
45 String _searchQuery; | 47 String _searchQuery; |
46 | 48 |
47 StocksApp() : super() { | 49 StocksApp() : super() { |
48 _sortedStocks = oracle.stocks; | 50 _sortedStocks = oracle.stocks; |
49 _sortedStocks.sort((a, b) => a.symbol.compareTo(b.symbol)); | 51 _sortedStocks.sort((a, b) => a.symbol.compareTo(b.symbol)); |
50 } | 52 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 children: [new Text('Help & Feedback')] | 94 children: [new Text('Help & Feedback')] |
93 ) | 95 ) |
94 ] | 96 ] |
95 ); | 97 ); |
96 | 98 |
97 Node title; | 99 Node title; |
98 if (_isSearching) { | 100 if (_isSearching) { |
99 title = new Input(focused: true, placeholder: 'Search stocks', | 101 title = new Input(focused: true, placeholder: 'Search stocks', |
100 onChanged: _handleSearchQueryChanged); | 102 onChanged: _handleSearchQueryChanged); |
101 } else { | 103 } else { |
102 title = new Text('I am a stocks app'); | 104 title = new Text('Stocks'); |
103 } | 105 } |
104 | 106 |
105 var toolbar = new ActionBar( | 107 var toolbar = new ActionBar( |
106 children: [ | 108 children: [ |
107 new Icon(key: 'menu', style: _iconStyle, | 109 new Icon(key: 'menu', style: _iconStyle, |
108 size: 24, | 110 size: 24, |
109 type: 'navigation/menu_white') | 111 type: 'navigation/menu_white') |
110 ..events.listen('click', _drawerAnimation.toggle), | 112 ..events.listen('click', _drawerAnimation.toggle), |
111 new Container( | 113 new Container( |
112 style: _titleStyle, | 114 style: _titleStyle, |
(...skipping 21 matching lines...) Expand all Loading... |
134 key: 'Content', | 136 key: 'Content', |
135 style: _style, | 137 style: _style, |
136 children: [toolbar, list] | 138 children: [toolbar, list] |
137 ), | 139 ), |
138 fab, | 140 fab, |
139 drawer, | 141 drawer, |
140 ] | 142 ] |
141 ); | 143 ); |
142 } | 144 } |
143 } | 145 } |
OLD | NEW |