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

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

Issue 992033002: Change the name of Component.render to Component.build in Effen (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: README 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/fn/widgets/toolbar.dart ('k') | sky/examples/stocks-fn/stocklist.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 part of stocksapp; 1 part of stocksapp;
2 2
3 class StockArrow extends Component { 3 class StockArrow extends Component {
4 4
5 double percentChange; 5 double percentChange;
6 6
7 static Style _style = new Style(''' 7 static Style _style = new Style('''
8 width: 40px; 8 width: 40px;
9 height: 40px; 9 height: 40px;
10 display: flex; 10 display: flex;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 double maxPercent = 10.0; 60 double maxPercent = 10.0;
61 return max(0, ((percentChange.abs() / maxPercent) * _kGreenColors.length).fl oor()); 61 return max(0, ((percentChange.abs() / maxPercent) * _kGreenColors.length).fl oor());
62 } 62 }
63 63
64 String _colorForPercentChange(double percentChange) { 64 String _colorForPercentChange(double percentChange) {
65 if (percentChange > 0) 65 if (percentChange > 0)
66 return _kGreenColors[_colorIndexForPercentChange(percentChange)]; 66 return _kGreenColors[_colorIndexForPercentChange(percentChange)];
67 return _kRedColors[_colorIndexForPercentChange(percentChange)]; 67 return _kRedColors[_colorIndexForPercentChange(percentChange)];
68 } 68 }
69 69
70 Node render() { 70 Node build() {
71 String border = _colorForPercentChange(percentChange).toString(); 71 String border = _colorForPercentChange(percentChange).toString();
72 bool up = percentChange > 0; 72 bool up = percentChange > 0;
73 String type = up ? 'bottom' : 'top'; 73 String type = up ? 'bottom' : 'top';
74 74
75 return new Container( 75 return new Container(
76 inlineStyle: 'border-color: $border', 76 inlineStyle: 'border-color: $border',
77 style: _style, 77 style: _style,
78 children: [ 78 children: [
79 new Container( 79 new Container(
80 inlineStyle: 'border-$type-color: $border', 80 inlineStyle: 'border-$type-color: $border',
81 style: up ? _upStyle : _downStyle 81 style: up ? _upStyle : _downStyle
82 ) 82 )
83 ] 83 ]
84 ); 84 );
85 } 85 }
86 } 86 }
OLDNEW
« no previous file with comments | « sky/examples/fn/widgets/toolbar.dart ('k') | sky/examples/stocks-fn/stocklist.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698