Chromium Code Reviews| Index: samples/swarm/swarm_ui_lib/view/MeasureText.dart |
| diff --git a/samples/swarm/swarm_ui_lib/view/MeasureText.dart b/samples/swarm/swarm_ui_lib/view/MeasureText.dart |
| index d3c40077e01133a8f018f9a18789b77054a4a0b1..eecf5093f7581fbfb00f8e21d56da5314b40bfff 100644 |
| --- a/samples/swarm/swarm_ui_lib/view/MeasureText.dart |
| +++ b/samples/swarm/swarm_ui_lib/view/MeasureText.dart |
| @@ -45,7 +45,7 @@ class MeasureText { |
| } |
| String quickTruncate(String text, num lineWidth, int maxLines) { |
| - int targetLength = (lineWidth * maxLines / _typicalCharLength).toInt(); |
| + int targetLength = (lineWidth * maxLines / _typicalCharLength).truncate(); |
|
Lasse Reichstein Nielsen
2013/01/04 10:29:42
~/
floitsch
2013/03/11 13:39:15
Done in a different CL.
|
| // Advance to next word break point. |
| while(targetLength < text.length && !isWhitespace(text[targetLength])) { |
| targetLength++; |
| @@ -74,7 +74,7 @@ class MeasureText { |
| // the number of lines and not the actual linebreaks is required. |
| if (sb == null) { |
| _context.font = font; |
| - int textWidth = _context.measureText(text).width.toInt(); |
| + int textWidth = _context.measureText(text).width.truncate(); |
| // By the pigeon hole principle, the resulting text will require at least |
| // maxLines if the raw text is longer than the amount of text that will |
| // fit on maxLines - 1. We add the length of a whitespace |