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

Side by Side Diff: sky/examples/stocks2/lib/stock_row.dart

Issue 1165223005: Vertically center stock demo row contents, better up/down arrows (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: TBD => TODO Created 5 years, 6 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/stocks2/lib/stock_arrow.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/flex.dart';
8 import 'package:sky/framework/rendering/box.dart'; 9 import 'package:sky/framework/rendering/box.dart';
9 import 'package:sky/framework/theme/typography.dart' as typography; 10 import 'package:sky/framework/theme/typography.dart' as typography;
10 import 'stock_arrow.dart'; 11 import 'stock_arrow.dart';
11 import 'stock_data.dart'; 12 import 'stock_data.dart';
12 13
13 class StockRow extends Component { 14 class StockRow extends Component {
14 static const double kHeight = 100.0; 15 static const double kHeight = 70.0;
15 16
16 Stock stock; 17 Stock stock;
17 18
18 StockRow({ Stock stock }) : super(key: stock.symbol) { 19 StockRow({ Stock stock }) : super(key: stock.symbol) {
19 this.stock = stock; 20 this.stock = stock;
20 } 21 }
21 22
22 UINode build() { 23 UINode build() {
23 String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}"; 24 String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}";
24 25
25 String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%"; 26 String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%";
26 if (stock.percentChange > 0) 27 if (stock.percentChange > 0) changeInPrice = "+" + changeInPrice;
27 changeInPrice = "+" + changeInPrice;
28 28
29 List<UINode> children = [ 29 List<UINode> children = [
30 new StockArrow(
31 percentChange: stock.percentChange
32 ),
33 new FlexExpandingChild(new Text(stock.symbol)),
34 new Container( 30 new Container(
35 width: 75.0, 31 child: new StockArrow(percentChange: stock.percentChange),
36 padding: const EdgeDims.only(right: 16.0), 32 margin: const EdgeDims.only(right: 5.0)),
37 // text-align: right 33 new FlexExpandingChild(new Text(stock.symbol), flex: 2, key: "symbol"),
38 child: new Text(lastSale) 34 // TODO(hansmuller): text-align: right
39 ), 35 new FlexExpandingChild(new Text(lastSale), key: "lastSale"),
40 // text-align: right, ${typography.black.caption}; 36 // TODO(hansmuller): text-align: right, ${typography.black.caption};
41 new SizedBox( 37 new FlexExpandingChild(new Text(changeInPrice), key: "changeInPrice")
42 width: 75.0,
43 child: new Text(changeInPrice)
44 ),
45 ]; 38 ];
46 39
47 return new Container( 40 return new Container(
48 padding: const EdgeDims(16.0, 16.0, 20.0, 16.0), 41 padding: const EdgeDims(16.0, 16.0, 20.0, 16.0),
49 height: kHeight, 42 height: kHeight, // TODO(hansmuller): This shouldn't be needed
50 decoration: const BoxDecoration( 43 decoration: const BoxDecoration(
51 backgroundColor: const sky.Color(0xFFFFFFFF), 44 backgroundColor: const sky.Color(0xFFFFFFFF),
52 border: const Border( 45 border: const Border(
53 bottom: const BorderSide( 46 bottom: const BorderSide(
54 color: const sky.Color(0xFFF4F4F4), 47 color: const sky.Color(0xFFF4F4F4),
55 width: 1.0))), 48 width: 1.0))),
56 child: new FlexContainer(children: children)); 49 child: new FlexContainer(children: children));
57 } 50 }
58 } 51 }
OLDNEW
« no previous file with comments | « sky/examples/stocks2/lib/stock_arrow.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698