OLD | NEW |
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/ink_well.dart'; | 5 import 'package:sky/framework/components/ink_well.dart'; |
6 import 'package:sky/framework/fn.dart'; | 6 import 'package:sky/framework/fn.dart'; |
7 import 'package:sky/framework/theme/typography.dart' as typography; | 7 import 'package:sky/framework/theme/typography.dart' as typography; |
8 import 'stock_arrow.dart'; | 8 import 'stock_arrow.dart'; |
9 import 'stock_data.dart'; | 9 import 'stock_data.dart'; |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 ${typography.black.caption}; | 32 ${typography.black.caption}; |
33 text-align: right;''' | 33 text-align: right;''' |
34 ); | 34 ); |
35 | 35 |
36 Stock stock; | 36 Stock stock; |
37 | 37 |
38 StockRow({Stock stock}) : super(key: stock.symbol) { | 38 StockRow({Stock stock}) : super(key: stock.symbol) { |
39 this.stock = stock; | 39 this.stock = stock; |
40 } | 40 } |
41 | 41 |
42 Node build() { | 42 UINode build() { |
43 String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}"; | 43 String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}"; |
44 | 44 |
45 String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%"; | 45 String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%"; |
46 if (stock.percentChange > 0) | 46 if (stock.percentChange > 0) |
47 changeInPrice = "+" + changeInPrice; | 47 changeInPrice = "+" + changeInPrice; |
48 | 48 |
49 List<Node> children = [ | 49 List<UINode> children = [ |
50 new StockArrow( | 50 new StockArrow( |
51 percentChange: stock.percentChange | 51 percentChange: stock.percentChange |
52 ), | 52 ), |
53 new Container( | 53 new Container( |
54 key: 'Ticker', | 54 key: 'Ticker', |
55 style: _tickerStyle, | 55 style: _tickerStyle, |
56 children: [new Text(stock.symbol)] | 56 children: [new Text(stock.symbol)] |
57 ), | 57 ), |
58 new Container( | 58 new Container( |
59 key: 'LastSale', | 59 key: 'LastSale', |
60 style: _lastSaleStyle, | 60 style: _lastSaleStyle, |
61 children: [new Text(lastSale)] | 61 children: [new Text(lastSale)] |
62 ), | 62 ), |
63 new Container( | 63 new Container( |
64 key: 'Change', | 64 key: 'Change', |
65 style: _changeStyle, | 65 style: _changeStyle, |
66 children: [new Text(changeInPrice)] | 66 children: [new Text(changeInPrice)] |
67 ) | 67 ) |
68 ]; | 68 ]; |
69 | 69 |
70 return new StyleNode(new InkWell(children: children), _style); | 70 return new StyleNode(new InkWell(children: children), _style); |
71 } | 71 } |
72 } | 72 } |
OLD | NEW |