prefer_const_declarations on local variables (#14358)
This commit is contained in:
committed by
GitHub
parent
b0e17949aa
commit
841d5d7bd5
@@ -113,8 +113,8 @@ class _HeadingLayout extends MultiChildLayoutDelegate {
|
||||
final double imageWidth = (landscape ? size.width / 2.0 : size.width) - margin * 2.0;
|
||||
final BoxConstraints imageConstraints = new BoxConstraints(maxHeight: 224.0, maxWidth: imageWidth);
|
||||
final Size imageSize = layoutChild(image, imageConstraints);
|
||||
final double imageY = 0.0;
|
||||
positionChild(image, new Offset(margin, imageY));
|
||||
const double imageY = 0.0;
|
||||
positionChild(image, const Offset(margin, imageY));
|
||||
|
||||
final double productWidth = landscape ? size.width / 2.0 : size.width - margin;
|
||||
final BoxConstraints productConstraints = new BoxConstraints(maxWidth: productWidth);
|
||||
|
||||
@@ -32,7 +32,7 @@ void reportToStringError(String name, String route, int lineNumber, List<String>
|
||||
// If you're on line 12, then it has index 11.
|
||||
// If you want 1 line before and 1 line after, then you want lines with index 10, 11, and 12.
|
||||
// That's (lineNumber-1)-margin .. (lineNumber-1)+margin, or lineNumber-(margin+1) .. lineNumber+(margin-1)
|
||||
final int margin = 5;
|
||||
const int margin = 5;
|
||||
final int firstLine = math.max(0, lineNumber - margin);
|
||||
final int lastLine = math.min(lines.length, lineNumber + margin);
|
||||
print('$name : $route : line $lineNumber of ${lines.length} : $message; nearby lines were:\n ${lines.sublist(firstLine, lastLine).join("\n ")}');
|
||||
|
||||
@@ -23,7 +23,7 @@ class StockArrowPainter extends CustomPainter {
|
||||
final double centerY = padding + r;
|
||||
|
||||
// Draw the arrow.
|
||||
final double w = 8.0;
|
||||
const double w = 8.0;
|
||||
double h = 5.0;
|
||||
double arrowY;
|
||||
if (percentChange < 0.0) {
|
||||
@@ -58,7 +58,7 @@ class StockArrow extends StatelessWidget {
|
||||
final double percentChange;
|
||||
|
||||
int _colorIndexForPercentChange(double percentChange) {
|
||||
final double maxPercent = 10.0;
|
||||
const double maxPercent = 10.0;
|
||||
final double normalizedPercentChange = math.min(percentChange.abs(), maxPercent) / maxPercent;
|
||||
return 100 + (normalizedPercentChange * 8.0).floor() * 100;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class StockData extends ChangeNotifier {
|
||||
_end();
|
||||
return;
|
||||
}
|
||||
final JsonDecoder decoder = const JsonDecoder();
|
||||
const JsonDecoder decoder = const JsonDecoder();
|
||||
add(decoder.convert(json));
|
||||
if (_nextChunk < _kChunkCount) {
|
||||
_fetchNextChunk();
|
||||
|
||||
Reference in New Issue
Block a user