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

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

Issue 1005393006: Clean up examples directory (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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/lib/stock_menu.dart ('k') | sky/examples/stocks-fn/main.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 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 import 'package:sky/framework/components/ink_well.dart';
6 import 'package:sky/framework/fn.dart';
7 import 'package:sky/framework/theme/typography.dart' as typography;
8 import 'stock_arrow.dart';
9 import 'stock_data.dart';
10
11 class StockRow extends Component {
12 static final Style _style = new Style('''
13 display: flex;
14 align-items: center;
15 border-bottom: 1px solid #F4F4F4;
16 padding-top: 16px;
17 padding-left: 16px;
18 padding-right: 16px;
19 padding-bottom: 20px;'''
20 );
21
22 static final Style _tickerStyle = new Style('''
23 flex: 1;'''
24 );
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
36 Stock stock;
37
38 StockRow({Stock stock}) : super(key: stock.symbol) {
39 this.stock = stock;
40 }
41
42 Node build() {
43 String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}";
44
45 String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%";
46 if (stock.percentChange > 0)
47 changeInPrice = "+" + changeInPrice;
48
49 List<Node> children = [
50 new StockArrow(
51 percentChange: stock.percentChange
52 ),
53 new Container(
54 key: 'Ticker',
55 style: _tickerStyle,
56 children: [new Text(stock.symbol)]
57 ),
58 new Container(
59 key: 'LastSale',
60 style: _lastSaleStyle,
61 children: [new Text(lastSale)]
62 ),
63 new Container(
64 key: 'Change',
65 style: _changeStyle,
66 children: [new Text(changeInPrice)]
67 )
68 ];
69
70 return new StyleNode(new InkWell(children: children), _style);
71 }
72 }
OLDNEW
« no previous file with comments | « sky/examples/stocks-fn/lib/stock_menu.dart ('k') | sky/examples/stocks-fn/main.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698