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 'dart:sky' as sky; | 5 import 'dart:sky' as sky; |
6 import 'package:sky/framework/components2/ink_well.dart'; | 6 import 'package:sky/framework/components2/ink_well.dart'; |
7 import 'package:sky/framework/fn2.dart'; | 7 import 'package:sky/framework/fn2.dart'; |
8 import 'package:sky/framework/rendering/box.dart'; | 8 import 'package:sky/framework/rendering/box.dart'; |
9 import 'package:sky/framework/theme/typography.dart' as typography; | 9 import 'package:sky/framework/theme/typography.dart' as typography; |
10 // import 'stock_arrow.dart'; | 10 import 'stock_arrow.dart'; |
11 import 'stock_data.dart'; | 11 import 'stock_data.dart'; |
12 | 12 |
13 class StockRow extends Component { | 13 class StockRow extends Component { |
14 static const double kHeight = 100.0; | 14 static const double kHeight = 100.0; |
15 | 15 |
16 Stock stock; | 16 Stock stock; |
17 | 17 |
18 StockRow({ Stock stock }) : super(key: stock.symbol) { | 18 StockRow({ Stock stock }) : super(key: stock.symbol) { |
19 this.stock = stock; | 19 this.stock = stock; |
20 } | 20 } |
21 | 21 |
22 UINode build() { | 22 UINode build() { |
23 String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}"; | 23 String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}"; |
24 | 24 |
25 String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%"; | 25 String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%"; |
26 if (stock.percentChange > 0) | 26 if (stock.percentChange > 0) |
27 changeInPrice = "+" + changeInPrice; | 27 changeInPrice = "+" + changeInPrice; |
28 | 28 |
29 List<UINode> children = [ | 29 List<UINode> children = [ |
30 // new StockArrow( | 30 new StockArrow( |
31 // percentChange: stock.percentChange | 31 percentChange: stock.percentChange |
32 // ), | 32 ), |
33 new FlexExpandingChild(new Text(stock.symbol)), | 33 new FlexExpandingChild(new Text(stock.symbol)), |
34 new Container( | 34 new Container( |
35 width: 75.0, | 35 width: 75.0, |
36 padding: const EdgeDims.only(right: 16.0), | 36 padding: const EdgeDims.only(right: 16.0), |
37 // text-align: right | 37 // text-align: right |
38 child: new Text(lastSale) | 38 child: new Text(lastSale) |
39 ), | 39 ), |
40 // text-align: right, ${typography.black.caption}; | 40 // text-align: right, ${typography.black.caption}; |
41 new SizedBox( | 41 new SizedBox( |
42 width: 75.0, | 42 width: 75.0, |
43 child: new Text(changeInPrice) | 43 child: new Text(changeInPrice) |
44 ), | 44 ), |
45 ]; | 45 ]; |
46 | 46 |
47 return new Container( | 47 return new Container( |
48 padding: const EdgeDims(16.0, 16.0, 20.0, 16.0), | 48 padding: const EdgeDims(16.0, 16.0, 20.0, 16.0), |
49 height: kHeight, | 49 height: kHeight, |
50 decoration: const BoxDecoration( | 50 decoration: const BoxDecoration( |
51 backgroundColor: const sky.Color(0xFFFFFFFF), | 51 backgroundColor: const sky.Color(0xFFFFFFFF), |
52 border: const Border( | 52 border: const Border( |
53 bottom: const BorderSide( | 53 bottom: const BorderSide( |
54 color: const sky.Color(0xFFF4F4F4), | 54 color: const sky.Color(0xFFF4F4F4), |
55 width: 1.0))), | 55 width: 1.0))), |
56 child: new FlexContainer(children: children)); | 56 child: new FlexContainer(children: children)); |
57 } | 57 } |
58 } | 58 } |
OLD | NEW |