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

Side by Side Diff: sky/examples/stocks-fn/stockrow.dart

Issue 1011023003: Make stocks-fn match the style for the Sky SDK (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: more Created 5 years, 9 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 | « sky/examples/stocks-fn/stocklist.dart ('k') | sky/examples/stocks-fn/stocks.sky » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 part of stocksapp;
2
3 class StockRow extends Component {
4
5 Stock stock;
6
7 static Style _style = new Style('''
8 transform: translateX(0);
9 display: flex;
10 align-items: center;
11 border-bottom: 1px solid #F4F4F4;
12 padding-top: 16px;
13 padding-left: 16px;
14 padding-right: 16px;
15 padding-bottom: 20px;'''
16 );
17
18 static Style _tickerStyle = new Style('''
19 flex: 1;'''
20 );
21
22 static Style _lastSaleStyle = new Style('''
23 text-align: right;
24 padding-right: 16px;'''
25 );
26
27 static Style _changeStyle = new Style('''
28 ${typography.black.caption};
29 text-align: right;'''
30 );
31
32 StockRow({Stock stock}) : super(key: stock.symbol) {
33 this.stock = stock;
34 }
35
36 Node build() {
37 String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}";
38
39 String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%";
40 if (stock.percentChange > 0)
41 changeInPrice = "+" + changeInPrice;
42
43 List<Node> children = [
44 new StockArrow(
45 percentChange: stock.percentChange
46 ),
47 new Container(
48 key: 'Ticker',
49 style: _tickerStyle,
50 children: [new Text(stock.symbol)]
51 ),
52 new Container(
53 key: 'LastSale',
54 style: _lastSaleStyle,
55 children: [new Text(lastSale)]
56 ),
57 new Container(
58 key: 'Change',
59 style: _changeStyle,
60 children: [new Text(changeInPrice)]
61 )
62 ];
63
64 return new Material(
65 style: _style,
66 children: children
67 );
68 }
69 }
OLDNEW
« no previous file with comments | « sky/examples/stocks-fn/stocklist.dart ('k') | sky/examples/stocks-fn/stocks.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698