| 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 // static final Style _style = new Style(''' | |
| 16 // align-items: center; | |
| 17 // border-bottom: 1px solid #F4F4F4; | |
| 18 // padding-top: 16px; | |
| 19 // padding-left: 16px; | |
| 20 // padding-right: 16px; | |
| 21 // padding-bottom: 20px;''' | |
| 22 // ); | |
| 23 | |
| 24 // static final FlexBoxParentData _tickerFlex = new FlexBoxParentData()..flex
= 1; | |
| 25 | |
| 26 // static final Style _lastSaleStyle = new Style(''' | |
| 27 // text-align: right; | |
| 28 // padding-right: 16px;''' | |
| 29 // ); | |
| 30 | |
| 31 // static final Style _changeStyle = new Style(''' | |
| 32 // ${typography.black.caption}; | |
| 33 // text-align: right;''' | |
| 34 // ); | |
| 35 | 15 |
| 36 Stock stock; | 16 Stock stock; |
| 37 | 17 |
| 38 StockRow({ Stock stock }) : super(key: stock.symbol) { | 18 StockRow({ Stock stock }) : super(key: stock.symbol) { |
| 39 this.stock = stock; | 19 this.stock = stock; |
| 40 } | 20 } |
| 41 | 21 |
| 42 UINode build() { | 22 UINode build() { |
| 43 // String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}"; | 23 String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}"; |
| 44 | 24 |
| 45 // String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%"; | 25 String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%"; |
| 46 // if (stock.percentChange > 0) | 26 if (stock.percentChange > 0) |
| 47 // changeInPrice = "+" + changeInPrice; | 27 changeInPrice = "+" + changeInPrice; |
| 48 | 28 |
| 49 // List<UINode> children = [ | 29 List<UINode> children = [ |
| 50 // new StockArrow( | 30 // new StockArrow( |
| 51 // percentChange: stock.percentChange | 31 // percentChange: stock.percentChange |
| 52 // ), | 32 // ), |
| 53 // new ParentDataNode( | 33 new FlexExpandingChild(new Text(stock.symbol)), |
| 54 // new Container( | 34 new Container( |
| 55 // key: 'Ticker', | 35 desiredSize: const sky.Size.fromWidth(75.0), |
| 56 // children: [new Text(stock.symbol)] | 36 padding: const EdgeDims.only(right: 16.0), |
| 57 // ), | 37 // text-align: right |
| 58 // _tickerFlex | 38 child: new Text(lastSale) |
| 59 // ), | 39 ), |
| 60 // new Container( | 40 // text-align: right, ${typography.black.caption}; |
| 61 // key: 'LastSale', | 41 new SizedBox( |
| 62 // style: _lastSaleStyle, | 42 desiredSize: const sky.Size.fromWidth(75.0), |
| 63 // children: [new Text(lastSale)] | 43 child: new Text(changeInPrice) |
| 64 // ), | 44 ), |
| 65 // new Container( | 45 ]; |
| 66 // key: 'Change', | |
| 67 // style: _changeStyle, | |
| 68 // children: [new Text(changeInPrice)] | |
| 69 // ) | |
| 70 // ]; | |
| 71 | 46 |
| 72 // return new StyleNode(new InkWell(children: children), _style); | |
| 73 return new Container( | 47 return new Container( |
| 48 padding: const EdgeDims(16.0, 16.0, 20.0, 16.0), |
| 74 desiredSize: const sky.Size.fromHeight(kHeight), | 49 desiredSize: const sky.Size.fromHeight(kHeight), |
| 75 decoration: const BoxDecoration( | 50 decoration: const BoxDecoration( |
| 76 backgroundColor: const sky.Color(0xFFFFFFFF), | 51 backgroundColor: const sky.Color(0xFFFFFFFF), |
| 77 border: const Border( | 52 border: const Border( |
| 78 bottom: const BorderSide( | 53 bottom: const BorderSide( |
| 79 color: const sky.Color(0xFFF4F4F4), | 54 color: const sky.Color(0xFFF4F4F4), |
| 80 width: 1.0)))); | 55 width: 1.0))), |
| 56 child: new FlexContainer(children: children)); |
| 81 } | 57 } |
| 82 } | 58 } |
| OLD | NEW |