Use Dart 2 camel case constants (#15360)

This commit is contained in:
Jason Simmons
2018-03-12 11:06:32 -07:00
committed by GitHub
parent 33f9afd99c
commit 466d15433f
141 changed files with 708 additions and 708 deletions

View File

@@ -38,7 +38,7 @@ ui.Picture paint(ui.Rect paintBounds) {
canvas.translate(mid.dx, mid.dy);
paint.color = const ui.Color.fromARGB(128, 255, 0, 255);
canvas.rotate(math.PI/4.0);
canvas.rotate(math.pi/4.0);
final ui.Gradient yellowBlue = new ui.Gradient.linear(
new ui.Offset(-radius, -radius),

View File

@@ -26,8 +26,8 @@ void beginFrame(Duration timeStamp) {
// Here we determine the rotation according to the timeStamp given to us by
// the engine.
final double t = timeStamp.inMicroseconds / Duration.MICROSECONDS_PER_MILLISECOND / 1800.0;
canvas.rotate(math.PI * (t % 1.0));
final double t = timeStamp.inMicroseconds / Duration.microsecondsPerMillisecond / 1800.0;
canvas.rotate(math.pi * (t % 1.0));
canvas.drawRect(new ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
new ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0));

View File

@@ -52,9 +52,9 @@ void main() {
vsync: const NonStopVSync(),
)..repeat();
// The animation will produce a value between 0.0 and 1.0 each frame, but we
// want to rotate the square using a value between 0.0 and math.PI. To change
// want to rotate the square using a value between 0.0 and math.pi. To change
// the range of the animation, we use a Tween.
final Tween<double> tween = new Tween<double>(begin: 0.0, end: math.PI);
final Tween<double> tween = new Tween<double>(begin: 0.0, end: math.pi);
// We add a listener to the animation, which will be called every time the
// animation ticks.
animation.addListener(() {

View File

@@ -7,12 +7,12 @@ import 'dart:math' as math;
import 'package:flutter/rendering.dart';
import 'package:flutter/gestures.dart';
const double kTwoPi = 2 * math.PI;
const double kTwoPi = 2 * math.pi;
class SectorConstraints extends Constraints {
const SectorConstraints({
this.minDeltaRadius: 0.0,
this.maxDeltaRadius: double.INFINITY,
this.maxDeltaRadius: double.infinity,
this.minDeltaTheta: 0.0,
this.maxDeltaTheta: kTwoPi
}) : assert(maxDeltaRadius >= minDeltaRadius),
@@ -99,9 +99,9 @@ abstract class RenderSector extends RenderObject {
void debugAssertDoesMeetConstraints() {
assert(constraints != null);
assert(deltaRadius != null);
assert(deltaRadius < double.INFINITY);
assert(deltaRadius < double.infinity);
assert(deltaTheta != null);
assert(deltaTheta < double.INFINITY);
assert(deltaTheta < double.infinity);
assert(constraints.minDeltaRadius <= deltaRadius);
assert(deltaRadius <= math.max(constraints.minDeltaRadius, constraints.maxDeltaRadius));
assert(constraints.minDeltaTheta <= deltaTheta);
@@ -215,7 +215,7 @@ class RenderSectorRing extends RenderSectorWithChildren {
RenderSectorRing({
BoxDecoration decoration,
double deltaRadius: double.INFINITY,
double deltaRadius: double.infinity,
double padding: 0.0
}) : _padding = padding,
assert(deltaRadius >= 0.0),
@@ -284,7 +284,7 @@ class RenderSectorRing extends RenderSectorWithChildren {
void performLayout() {
assert(parentData is SectorParentData);
deltaRadius = constraints.constrainDeltaRadius(desiredDeltaRadius);
assert(deltaRadius < double.INFINITY);
assert(deltaRadius < double.infinity);
final double innerDeltaRadius = deltaRadius - padding * 2.0;
final double childRadius = parentData.radius + padding;
final double paddingTheta = math.atan(padding / (parentData.radius + deltaRadius));
@@ -487,8 +487,8 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
}
Size getIntrinsicDimensions({
double width: double.INFINITY,
double height: double.INFINITY
double width: double.infinity,
double height: double.infinity
}) {
assert(child is RenderSector);
assert(child.parentData is SectorParentData);
@@ -539,7 +539,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
y -= size.height / 2.0;
// convert to radius/theta
final double radius = math.sqrt(x * x + y * y);
final double theta = (math.atan2(x, -y) - math.PI / 2.0) % kTwoPi;
final double theta = (math.atan2(x, -y) - math.pi / 2.0) % kTwoPi;
if (radius < innerRadius)
return false;
if (radius >= innerRadius + child.deltaRadius)
@@ -555,7 +555,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
class RenderSolidColor extends RenderDecoratedSector {
RenderSolidColor(this.backgroundColor, {
this.desiredDeltaRadius: double.INFINITY,
this.desiredDeltaRadius: double.infinity,
this.desiredDeltaTheta: kTwoPi
}) : super(new BoxDecoration(color: backgroundColor));

View File

@@ -14,22 +14,22 @@ class RenderSolidColorBox extends RenderDecoratedBox {
@override
double computeMinIntrinsicWidth(double height) {
return desiredSize.width == double.INFINITY ? 0.0 : desiredSize.width;
return desiredSize.width == double.infinity ? 0.0 : desiredSize.width;
}
@override
double computeMaxIntrinsicWidth(double height) {
return desiredSize.width == double.INFINITY ? 0.0 : desiredSize.width;
return desiredSize.width == double.infinity ? 0.0 : desiredSize.width;
}
@override
double computeMinIntrinsicHeight(double width) {
return desiredSize.height == double.INFINITY ? 0.0 : desiredSize.height;
return desiredSize.height == double.infinity ? 0.0 : desiredSize.height;
}
@override
double computeMaxIntrinsicHeight(double width) {
return desiredSize.height == double.INFINITY ? 0.0 : desiredSize.height;
return desiredSize.height == double.infinity ? 0.0 : desiredSize.height;
}
@override

View File

@@ -120,7 +120,7 @@ class CalculationManager {
if (isRunning) {
_state = CalculationState.idle;
if (_isolate != null) {
_isolate.kill(priority: Isolate.IMMEDIATE);
_isolate.kill(priority: Isolate.immediate);
_isolate = null;
_completed = 0.0;
_total = 1.0;
@@ -144,7 +144,7 @@ class CalculationManager {
// is synchronous, so if done in the main isolate, the UI would block.
Isolate.spawn(_calculate, message).then<Null>((Isolate isolate) {
if (!isRunning) {
isolate.kill(priority: Isolate.IMMEDIATE);
isolate.kill(priority: Isolate.immediate);
} else {
_state = CalculationState.calculating;
_isolate = isolate;

View File

@@ -34,10 +34,10 @@ class SectorAppState extends State<SectorApp> {
final double currentTheta = this.currentTheta;
if (currentTheta < kTwoPi) {
double deltaTheta;
if (currentTheta >= kTwoPi - (math.PI * 0.2 + 0.05))
if (currentTheta >= kTwoPi - (math.pi * 0.2 + 0.05))
deltaTheta = kTwoPi - currentTheta;
else
deltaTheta = math.PI * rand.nextDouble() / 5.0 + 0.05;
deltaTheta = math.pi * rand.nextDouble() / 5.0 + 0.05;
wantedSectorSizes.add(deltaTheta);
updateEnabledState();
}

View File

@@ -82,7 +82,7 @@ RenderTransform transformBox;
void rotate(Duration timeStamp) {
timeBase ??= timeStamp;
final double delta = (timeStamp - timeBase).inMicroseconds.toDouble() / Duration.MICROSECONDS_PER_SECOND; // radians
final double delta = (timeStamp - timeBase).inMicroseconds.toDouble() / Duration.microsecondsPerSecond; // radians
transformBox.setIdentity();
transformBox.rotateZ(delta);

View File

@@ -17,7 +17,7 @@ class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProvid
super.initState();
// We use 3600 milliseconds instead of 1800 milliseconds because 0.0 -> 1.0
// represents an entire turn of the square whereas in the other examples
// we used 0.0 -> math.PI, which is only half a turn.
// we used 0.0 -> math.pi, which is only half a turn.
_animation = new AnimationController(
duration: const Duration(milliseconds: 3600),
vsync: this,