OLD | NEW |
1 part of stocksapp; | 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 'dart:math'; |
| 6 import 'package:sky/framework/fn.dart'; |
2 | 7 |
3 class StockArrow extends Component { | 8 class StockArrow extends Component { |
4 | 9 static final Style _style = new Style(''' |
5 double percentChange; | |
6 | |
7 static Style _style = new Style(''' | |
8 width: 40px; | 10 width: 40px; |
9 height: 40px; | 11 height: 40px; |
10 display: flex; | 12 display: flex; |
11 align-items: center; | 13 align-items: center; |
12 justify-content: center; | 14 justify-content: center; |
13 border-radius: 40px; | 15 border-radius: 40px; |
14 margin-right: 16px; | 16 margin-right: 16px; |
15 border: 1px solid transparent;''' | 17 border: 1px solid transparent;''' |
16 ); | 18 ); |
17 | 19 |
18 static Style _upStyle = new Style(''' | 20 static final Style _upStyle = new Style(''' |
19 width: 0; | 21 width: 0; |
20 height: 0; | 22 height: 0; |
21 border-left: 9px solid transparent; | 23 border-left: 9px solid transparent; |
22 border-right: 9px solid transparent; | 24 border-right: 9px solid transparent; |
23 margin-bottom: 3px; | 25 margin-bottom: 3px; |
24 border-bottom: 9px solid white;''' | 26 border-bottom: 9px solid white;''' |
25 ); | 27 ); |
26 | 28 |
27 static Style _downStyle = new Style(''' | 29 static final Style _downStyle = new Style(''' |
28 width: 0; | 30 width: 0; |
29 height: 0; | 31 height: 0; |
30 border-left: 9px solid transparent; | 32 border-left: 9px solid transparent; |
31 border-right: 9px solid transparent; | 33 border-right: 9px solid transparent; |
32 margin-top: 3px; | 34 margin-top: 3px; |
33 border-top: 9px solid white''' | 35 border-top: 9px solid white''' |
34 ); | 36 ); |
35 | 37 |
| 38 double percentChange; |
| 39 |
36 StockArrow({ Object key, this.percentChange }) : super(key: key); | 40 StockArrow({ Object key, this.percentChange }) : super(key: key); |
37 | 41 |
| 42 // TODO(abarth): These should use sky/framework/theme/colors.dart. |
38 final List<String> _kRedColors = [ | 43 final List<String> _kRedColors = [ |
39 '#E57373', | 44 '#E57373', |
40 '#EF5350', | 45 '#EF5350', |
41 '#F44336', | 46 '#F44336', |
42 '#E53935', | 47 '#E53935', |
43 '#D32F2F', | 48 '#D32F2F', |
44 '#C62828', | 49 '#C62828', |
45 '#B71C1C', | 50 '#B71C1C', |
46 ]; | 51 ]; |
47 | 52 |
| 53 // TODO(abarth): These should use sky/framework/theme/colors.dart. |
48 final List<String> _kGreenColors = [ | 54 final List<String> _kGreenColors = [ |
49 '#81C784', | 55 '#81C784', |
50 '#66BB6A', | 56 '#66BB6A', |
51 '#4CAF50', | 57 '#4CAF50', |
52 '#43A047', | 58 '#43A047', |
53 '#388E3C', | 59 '#388E3C', |
54 '#2E7D32', | 60 '#2E7D32', |
55 '#1B5E20', | 61 '#1B5E20', |
56 ]; | 62 ]; |
57 | 63 |
(...skipping 19 matching lines...) Expand all Loading... |
77 style: _style, | 83 style: _style, |
78 children: [ | 84 children: [ |
79 new Container( | 85 new Container( |
80 inlineStyle: 'border-$type-color: $border', | 86 inlineStyle: 'border-$type-color: $border', |
81 style: up ? _upStyle : _downStyle | 87 style: up ? _upStyle : _downStyle |
82 ) | 88 ) |
83 ] | 89 ] |
84 ); | 90 ); |
85 } | 91 } |
86 } | 92 } |
OLD | NEW |