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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
141 changed files with 708 additions and 708 deletions

View File

@ -398,7 +398,7 @@ class _SnappingScrollPhysics extends ClampingScrollPhysics {
// If the simulation is headed up towards midScrollOffset but will not reach it, // If the simulation is headed up towards midScrollOffset but will not reach it,
// then snap it there. Similarly if the simulation is headed down past // then snap it there. Similarly if the simulation is headed down past
// midScrollOffset but will not reach zero, then snap it to zero. // midScrollOffset but will not reach zero, then snap it to zero.
final double simulationEnd = simulation.x(double.INFINITY); final double simulationEnd = simulation.x(double.infinity);
if (simulationEnd >= midScrollOffset) if (simulationEnd >= midScrollOffset)
return simulation; return simulation;
if (dragVelocity > 0.0) if (dragVelocity > 0.0)

View File

@ -38,7 +38,7 @@ ui.Picture paint(ui.Rect paintBounds) {
canvas.translate(mid.dx, mid.dy); canvas.translate(mid.dx, mid.dy);
paint.color = const ui.Color.fromARGB(128, 255, 0, 255); 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( final ui.Gradient yellowBlue = new ui.Gradient.linear(
new ui.Offset(-radius, -radius), 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 // Here we determine the rotation according to the timeStamp given to us by
// the engine. // the engine.
final double t = timeStamp.inMicroseconds / Duration.MICROSECONDS_PER_MILLISECOND / 1800.0; final double t = timeStamp.inMicroseconds / Duration.microsecondsPerMillisecond / 1800.0;
canvas.rotate(math.PI * (t % 1.0)); canvas.rotate(math.pi * (t % 1.0));
canvas.drawRect(new ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.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)); new ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0));

View File

@ -52,9 +52,9 @@ void main() {
vsync: const NonStopVSync(), vsync: const NonStopVSync(),
)..repeat(); )..repeat();
// The animation will produce a value between 0.0 and 1.0 each frame, but we // 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. // 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 // We add a listener to the animation, which will be called every time the
// animation ticks. // animation ticks.
animation.addListener(() { animation.addListener(() {

View File

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

View File

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

View File

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

View File

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

View File

@ -82,7 +82,7 @@ RenderTransform transformBox;
void rotate(Duration timeStamp) { void rotate(Duration timeStamp) {
timeBase ??= 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.setIdentity();
transformBox.rotateZ(delta); transformBox.rotateZ(delta);

View File

@ -17,7 +17,7 @@ class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProvid
super.initState(); super.initState();
// We use 3600 milliseconds instead of 1800 milliseconds because 0.0 -> 1.0 // 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 // 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( _animation = new AnimationController(
duration: const Duration(milliseconds: 3600), duration: const Duration(milliseconds: 3600),
vsync: this, vsync: this,

View File

@ -34,7 +34,7 @@ final SpringDescription _kFlingSpringDescription = new SpringDescription.withDam
); );
const Tolerance _kFlingTolerance = const Tolerance( const Tolerance _kFlingTolerance = const Tolerance(
velocity: double.INFINITY, velocity: double.infinity,
distance: 0.01, distance: 0.01,
); );
@ -153,8 +153,8 @@ class AnimationController extends Animation<double>
@required TickerProvider vsync, @required TickerProvider vsync,
}) : assert(value != null), }) : assert(value != null),
assert(vsync != null), assert(vsync != null),
lowerBound = double.NEGATIVE_INFINITY, lowerBound = double.negativeInfinity,
upperBound = double.INFINITY, upperBound = double.infinity,
_direction = _AnimationDirection.forward { _direction = _AnimationDirection.forward {
_ticker = vsync.createTicker(_tick); _ticker = vsync.createTicker(_tick);
_internalSetValue(value); _internalSetValue(value);
@ -253,7 +253,7 @@ class AnimationController extends Animation<double>
double get velocity { double get velocity {
if (!isAnimating) if (!isAnimating)
return 0.0; return 0.0;
return _simulation.dx(lastElapsedDuration.inMicroseconds.toDouble() / Duration.MICROSECONDS_PER_SECOND); return _simulation.dx(lastElapsedDuration.inMicroseconds.toDouble() / Duration.microsecondsPerSecond);
} }
void _internalSetValue(double newValue) { void _internalSetValue(double newValue) {
@ -382,10 +382,10 @@ class AnimationController extends Animation<double>
simulationDuration = this.duration * remainingFraction; simulationDuration = this.duration * remainingFraction;
} else if (target == value) { } else if (target == value) {
// Already at target, don't animate. // Already at target, don't animate.
simulationDuration = Duration.ZERO; simulationDuration = Duration.zero;
} }
stop(); stop();
if (simulationDuration == Duration.ZERO) { if (simulationDuration == Duration.zero) {
if (value != target) { if (value != target) {
_value = target.clamp(lowerBound, upperBound); _value = target.clamp(lowerBound, upperBound);
notifyListeners(); notifyListeners();
@ -396,7 +396,7 @@ class AnimationController extends Animation<double>
_checkStatusChanged(); _checkStatusChanged();
return new TickerFuture.complete(); return new TickerFuture.complete();
} }
assert(simulationDuration > Duration.ZERO); assert(simulationDuration > Duration.zero);
assert(!isAnimating); assert(!isAnimating);
return _startSimulation(new _InterpolationSimulation(_value, target, simulationDuration, curve)); return _startSimulation(new _InterpolationSimulation(_value, target, simulationDuration, curve));
} }
@ -466,7 +466,7 @@ class AnimationController extends Animation<double>
assert(simulation != null); assert(simulation != null);
assert(!isAnimating); assert(!isAnimating);
_simulation = simulation; _simulation = simulation;
_lastElapsedDuration = Duration.ZERO; _lastElapsedDuration = Duration.zero;
_value = simulation.x(0.0).clamp(lowerBound, upperBound); _value = simulation.x(0.0).clamp(lowerBound, upperBound);
final Future<Null> result = _ticker.start(); final Future<Null> result = _ticker.start();
_status = (_direction == _AnimationDirection.forward) ? _status = (_direction == _AnimationDirection.forward) ?
@ -534,7 +534,7 @@ class AnimationController extends Animation<double>
void _tick(Duration elapsed) { void _tick(Duration elapsed) {
_lastElapsedDuration = elapsed; _lastElapsedDuration = elapsed;
final double elapsedInSeconds = elapsed.inMicroseconds.toDouble() / Duration.MICROSECONDS_PER_SECOND; final double elapsedInSeconds = elapsed.inMicroseconds.toDouble() / Duration.microsecondsPerSecond;
assert(elapsedInSeconds >= 0.0); assert(elapsedInSeconds >= 0.0);
_value = _simulation.x(elapsedInSeconds).clamp(lowerBound, upperBound); _value = _simulation.x(elapsedInSeconds).clamp(lowerBound, upperBound);
if (_simulation.isDone(elapsedInSeconds)) { if (_simulation.isDone(elapsedInSeconds)) {
@ -562,7 +562,7 @@ class _InterpolationSimulation extends Simulation {
: assert(_begin != null), : assert(_begin != null),
assert(_end != null), assert(_end != null),
assert(duration != null && duration.inMicroseconds > 0), assert(duration != null && duration.inMicroseconds > 0),
_durationInSeconds = duration.inMicroseconds / Duration.MICROSECONDS_PER_SECOND; _durationInSeconds = duration.inMicroseconds / Duration.microsecondsPerSecond;
final double _durationInSeconds; final double _durationInSeconds;
final double _begin; final double _begin;
@ -592,7 +592,7 @@ class _InterpolationSimulation extends Simulation {
class _RepeatingSimulation extends Simulation { class _RepeatingSimulation extends Simulation {
_RepeatingSimulation(this.min, this.max, Duration period) _RepeatingSimulation(this.min, this.max, Duration period)
: _periodInSeconds = period.inMicroseconds / Duration.MICROSECONDS_PER_SECOND { : _periodInSeconds = period.inMicroseconds / Duration.microsecondsPerSecond {
assert(_periodInSeconds > 0.0); assert(_periodInSeconds > 0.0);
} }

View File

@ -376,7 +376,7 @@ class ElasticInCurve extends Curve {
assert(t >= 0.0 && t <= 1.0); assert(t >= 0.0 && t <= 1.0);
final double s = period / 4.0; final double s = period / 4.0;
t = t - 1.0; t = t - 1.0;
return -math.pow(2.0, 10.0 * t) * math.sin((t - s) * (math.PI * 2.0) / period); return -math.pow(2.0, 10.0 * t) * math.sin((t - s) * (math.pi * 2.0) / period);
} }
@override @override
@ -404,7 +404,7 @@ class ElasticOutCurve extends Curve {
double transform(double t) { double transform(double t) {
assert(t >= 0.0 && t <= 1.0); assert(t >= 0.0 && t <= 1.0);
final double s = period / 4.0; final double s = period / 4.0;
return math.pow(2.0, -10 * t) * math.sin((t - s) * (math.PI * 2.0) / period) + 1.0; return math.pow(2.0, -10 * t) * math.sin((t - s) * (math.pi * 2.0) / period) + 1.0;
} }
@override @override
@ -435,9 +435,9 @@ class ElasticInOutCurve extends Curve {
final double s = period / 4.0; final double s = period / 4.0;
t = 2.0 * t - 1.0; t = 2.0 * t - 1.0;
if (t < 0.0) if (t < 0.0)
return -0.5 * math.pow(2.0, 10.0 * t) * math.sin((t - s) * (math.PI * 2.0) / period); return -0.5 * math.pow(2.0, 10.0 * t) * math.sin((t - s) * (math.pi * 2.0) / period);
else else
return math.pow(2.0, -10.0 * t) * math.sin((t - s) * (math.PI * 2.0) / period) * 0.5 + 1.0; return math.pow(2.0, -10.0 * t) * math.sin((t - s) * (math.pi * 2.0) / period) * 0.5 + 1.0;
} }
@override @override

View File

@ -79,7 +79,7 @@ class _CupertinoActivityIndicatorState extends State<CupertinoActivityIndicator>
} }
} }
const double _kTwoPI = math.PI * 2.0; const double _kTwoPI = math.pi * 2.0;
const int _kTickCount = 12; const int _kTickCount = 12;
const int _kHalfTickCount = _kTickCount ~/ 2; const int _kHalfTickCount = _kTickCount ~/ 2;
const Color _kTickColor = CupertinoColors.lightBackgroundGray; const Color _kTickColor = CupertinoColors.lightBackgroundGray;

View File

@ -500,7 +500,7 @@ class _CupertinoLargeTitleNavigationBarSliverDelegate
// and behind the persistent bar. // and behind the persistent bar.
child: new OverflowBox( child: new OverflowBox(
minHeight: 0.0, minHeight: 0.0,
maxHeight: double.INFINITY, maxHeight: double.infinity,
alignment: AlignmentDirectional.bottomStart, alignment: AlignmentDirectional.bottomStart,
child: new Padding( child: new Padding(
padding: const EdgeInsetsDirectional.only( padding: const EdgeInsetsDirectional.only(

View File

@ -274,7 +274,7 @@ class _CupertinoTextSelectionControls extends TextSelectionControls {
switch (type) { switch (type) {
case TextSelectionHandleType.left: // The left handle is upside down on iOS. case TextSelectionHandleType.left: // The left handle is upside down on iOS.
return new Transform( return new Transform(
transform: new Matrix4.rotationZ(math.PI) transform: new Matrix4.rotationZ(math.pi)
..translate(-_kHandlesPadding, -_kHandlesPadding), ..translate(-_kHandlesPadding, -_kHandlesPadding),
child: handle child: handle
); );

View File

@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:convert' show JSON; import 'dart:convert' show json;
import 'dart:developer' as developer; import 'dart:developer' as developer;
import 'dart:io' show exit; import 'dart:io' show exit;
@ -348,7 +348,7 @@ abstract class BindingBase {
/// extension method is called. The callback must return a [Future] /// extension method is called. The callback must return a [Future]
/// that either eventually completes to a return value in the form /// that either eventually completes to a return value in the form
/// of a name/value map where the values can all be converted to /// of a name/value map where the values can all be converted to
/// JSON using `JSON.encode()` (see [JsonCodec.encode]), or fails. In case of failure, the /// JSON using `json.encode()` (see [JsonCodec.encode]), or fails. In case of failure, the
/// failure is reported to the remote caller and is dumped to the /// failure is reported to the remote caller and is dumped to the
/// logs. /// logs.
/// ///
@ -375,7 +375,7 @@ abstract class BindingBase {
if (caughtException == null) { if (caughtException == null) {
result['type'] = '_extensionType'; result['type'] = '_extensionType';
result['method'] = method; result['method'] = method;
return new developer.ServiceExtensionResponse.result(JSON.encode(result)); return new developer.ServiceExtensionResponse.result(json.encode(result));
} else { } else {
FlutterError.reportError(new FlutterErrorDetails( FlutterError.reportError(new FlutterErrorDetails(
exception: caughtException, exception: caughtException,
@ -384,7 +384,7 @@ abstract class BindingBase {
)); ));
return new developer.ServiceExtensionResponse.error( return new developer.ServiceExtensionResponse.error(
developer.ServiceExtensionResponse.extensionError, developer.ServiceExtensionResponse.extensionError,
JSON.encode(<String, String>{ json.encode(<String, String>{
'exception': caughtException.toString(), 'exception': caughtException.toString(),
'stack': caughtStack.toString(), 'stack': caughtStack.toString(),
'method': method, 'method': method,

View File

@ -2238,9 +2238,9 @@ abstract class Diagnosticable {
/// // default value so is not relevant. /// // default value so is not relevant.
/// properties.add(new DoubleProperty('hitTestExtent', hitTestExtent, defaultValue: paintExtent)); /// properties.add(new DoubleProperty('hitTestExtent', hitTestExtent, defaultValue: paintExtent));
/// ///
/// // maxWidth of double.INFINITY indicates the width is unconstrained and /// // maxWidth of double.infinity indicates the width is unconstrained and
/// // so maxWidth has no impact., /// // so maxWidth has no impact.,
/// properties.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.INFINITY)); /// properties.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.infinity));
/// ///
/// // Progress is a value between 0 and 1 or null. Showing it as a /// // Progress is a value between 0 and 1 or null. Showing it as a
/// // percentage makes the meaning clear enough that the name can be /// // percentage makes the meaning clear enough that the name can be

View File

@ -11,7 +11,7 @@ import 'package:typed_data/typed_buffers.dart' show Uint8Buffer;
/// A WriteBuffer instance can be used only once. Attempts to reuse will result /// A WriteBuffer instance can be used only once. Attempts to reuse will result
/// in [NoSuchMethodError]s being thrown. /// in [NoSuchMethodError]s being thrown.
/// ///
/// The byte order used is [Endianness.HOST_ENDIAN] throughout. /// The byte order used is [Endian.host] throughout.
class WriteBuffer { class WriteBuffer {
/// Creates an interface for incrementally building a [ByteData] instance. /// Creates an interface for incrementally building a [ByteData] instance.
WriteBuffer() { WriteBuffer() {
@ -31,32 +31,32 @@ class WriteBuffer {
/// Write a Uint16 into the buffer. /// Write a Uint16 into the buffer.
void putUint16(int value) { void putUint16(int value) {
_eightBytes.setUint16(0, value, Endianness.HOST_ENDIAN); _eightBytes.setUint16(0, value, Endian.host);
_buffer.addAll(_eightBytesAsList, 0, 2); _buffer.addAll(_eightBytesAsList, 0, 2);
} }
/// Write a Uint32 into the buffer. /// Write a Uint32 into the buffer.
void putUint32(int value) { void putUint32(int value) {
_eightBytes.setUint32(0, value, Endianness.HOST_ENDIAN); _eightBytes.setUint32(0, value, Endian.host);
_buffer.addAll(_eightBytesAsList, 0, 4); _buffer.addAll(_eightBytesAsList, 0, 4);
} }
/// Write an Int32 into the buffer. /// Write an Int32 into the buffer.
void putInt32(int value) { void putInt32(int value) {
_eightBytes.setInt32(0, value, Endianness.HOST_ENDIAN); _eightBytes.setInt32(0, value, Endian.host);
_buffer.addAll(_eightBytesAsList, 0, 4); _buffer.addAll(_eightBytesAsList, 0, 4);
} }
/// Write an Int64 into the buffer. /// Write an Int64 into the buffer.
void putInt64(int value) { void putInt64(int value) {
_eightBytes.setInt64(0, value, Endianness.HOST_ENDIAN); _eightBytes.setInt64(0, value, Endian.host);
_buffer.addAll(_eightBytesAsList, 0, 8); _buffer.addAll(_eightBytesAsList, 0, 8);
} }
/// Write an Float64 into the buffer. /// Write an Float64 into the buffer.
void putFloat64(double value) { void putFloat64(double value) {
_alignTo(8); _alignTo(8);
_eightBytes.setFloat64(0, value, Endianness.HOST_ENDIAN); _eightBytes.setFloat64(0, value, Endian.host);
_buffer.addAll(_eightBytesAsList); _buffer.addAll(_eightBytesAsList);
} }
@ -101,7 +101,7 @@ class WriteBuffer {
/// Read-only buffer for reading sequentially from a [ByteData] instance. /// Read-only buffer for reading sequentially from a [ByteData] instance.
/// ///
/// The byte order used is [Endianness.HOST_ENDIAN] throughout. /// The byte order used is [Endian.host] throughout.
class ReadBuffer { class ReadBuffer {
/// Creates a [ReadBuffer] for reading from the specified [data]. /// Creates a [ReadBuffer] for reading from the specified [data].
ReadBuffer(this.data) ReadBuffer(this.data)
@ -123,28 +123,28 @@ class ReadBuffer {
/// Reads a Uint16 from the buffer. /// Reads a Uint16 from the buffer.
int getUint16() { int getUint16() {
final int value = data.getUint16(_position, Endianness.HOST_ENDIAN); final int value = data.getUint16(_position, Endian.host);
_position += 2; _position += 2;
return value; return value;
} }
/// Reads a Uint32 from the buffer. /// Reads a Uint32 from the buffer.
int getUint32() { int getUint32() {
final int value = data.getUint32(_position, Endianness.HOST_ENDIAN); final int value = data.getUint32(_position, Endian.host);
_position += 4; _position += 4;
return value; return value;
} }
/// Reads an Int32 from the buffer. /// Reads an Int32 from the buffer.
int getInt32() { int getInt32() {
final int value = data.getInt32(_position, Endianness.HOST_ENDIAN); final int value = data.getInt32(_position, Endian.host);
_position += 4; _position += 4;
return value; return value;
} }
/// Reads an Int64 from the buffer. /// Reads an Int64 from the buffer.
int getInt64() { int getInt64() {
final int value = data.getInt64(_position, Endianness.HOST_ENDIAN); final int value = data.getInt64(_position, Endian.host);
_position += 8; _position += 8;
return value; return value;
} }
@ -152,7 +152,7 @@ class ReadBuffer {
/// Reads a Float64 from the buffer. /// Reads a Float64 from the buffer.
double getFloat64() { double getFloat64() {
_alignTo(8); _alignTo(8);
final double value = data.getFloat64(_position, Endianness.HOST_ENDIAN); final double value = data.getFloat64(_position, Endian.host);
_position += 8; _position += 8;
return value; return value;
} }

View File

@ -94,7 +94,7 @@ abstract class PointerEvent {
/// Abstract const constructor. This constructor enables subclasses to provide /// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions. /// const constructors so that they can be used in const expressions.
const PointerEvent({ const PointerEvent({
this.timeStamp: Duration.ZERO, this.timeStamp: Duration.zero,
this.pointer: 0, this.pointer: 0,
this.kind: PointerDeviceKind.touch, this.kind: PointerDeviceKind.touch,
this.device: 0, this.device: 0,
@ -289,7 +289,7 @@ class PointerAddedEvent extends PointerEvent {
/// ///
/// All of the argument must be non-null. /// All of the argument must be non-null.
const PointerAddedEvent({ const PointerAddedEvent({
Duration timeStamp: Duration.ZERO, Duration timeStamp: Duration.zero,
PointerDeviceKind kind: PointerDeviceKind.touch, PointerDeviceKind kind: PointerDeviceKind.touch,
int device: 0, int device: 0,
Offset position: Offset.zero, Offset position: Offset.zero,
@ -328,7 +328,7 @@ class PointerRemovedEvent extends PointerEvent {
/// ///
/// All of the argument must be non-null. /// All of the argument must be non-null.
const PointerRemovedEvent({ const PointerRemovedEvent({
Duration timeStamp: Duration.ZERO, Duration timeStamp: Duration.zero,
PointerDeviceKind kind: PointerDeviceKind.touch, PointerDeviceKind kind: PointerDeviceKind.touch,
int device: 0, int device: 0,
bool obscured: false, bool obscured: false,
@ -363,7 +363,7 @@ class PointerHoverEvent extends PointerEvent {
/// ///
/// All of the argument must be non-null. /// All of the argument must be non-null.
const PointerHoverEvent({ const PointerHoverEvent({
Duration timeStamp: Duration.ZERO, Duration timeStamp: Duration.zero,
PointerDeviceKind kind: PointerDeviceKind.touch, PointerDeviceKind kind: PointerDeviceKind.touch,
int device: 0, int device: 0,
Offset position: Offset.zero, Offset position: Offset.zero,
@ -410,7 +410,7 @@ class PointerDownEvent extends PointerEvent {
/// ///
/// All of the argument must be non-null. /// All of the argument must be non-null.
const PointerDownEvent({ const PointerDownEvent({
Duration timeStamp: Duration.ZERO, Duration timeStamp: Duration.zero,
int pointer: 0, int pointer: 0,
PointerDeviceKind kind: PointerDeviceKind.touch, PointerDeviceKind kind: PointerDeviceKind.touch,
int device: 0, int device: 0,
@ -462,7 +462,7 @@ class PointerMoveEvent extends PointerEvent {
/// ///
/// All of the argument must be non-null. /// All of the argument must be non-null.
const PointerMoveEvent({ const PointerMoveEvent({
Duration timeStamp: Duration.ZERO, Duration timeStamp: Duration.zero,
int pointer: 0, int pointer: 0,
PointerDeviceKind kind: PointerDeviceKind.touch, PointerDeviceKind kind: PointerDeviceKind.touch,
int device: 0, int device: 0,
@ -512,7 +512,7 @@ class PointerUpEvent extends PointerEvent {
/// ///
/// All of the argument must be non-null. /// All of the argument must be non-null.
const PointerUpEvent({ const PointerUpEvent({
Duration timeStamp: Duration.ZERO, Duration timeStamp: Duration.zero,
int pointer: 0, int pointer: 0,
PointerDeviceKind kind: PointerDeviceKind.touch, PointerDeviceKind kind: PointerDeviceKind.touch,
int device: 0, int device: 0,
@ -553,7 +553,7 @@ class PointerCancelEvent extends PointerEvent {
/// ///
/// All of the argument must be non-null. /// All of the argument must be non-null.
const PointerCancelEvent({ const PointerCancelEvent({
Duration timeStamp: Duration.ZERO, Duration timeStamp: Duration.zero,
int pointer: 0, int pointer: 0,
PointerDeviceKind kind: PointerDeviceKind.touch, PointerDeviceKind kind: PointerDeviceKind.touch,
int device: 0, int device: 0,

View File

@ -237,7 +237,7 @@ class _TapGesture extends _TapTracker {
entry: GestureBinding.instance.gestureArena.add(event.pointer, gestureRecognizer) entry: GestureBinding.instance.gestureArena.add(event.pointer, gestureRecognizer)
) { ) {
startTrackingPointer(handleEvent); startTrackingPointer(handleEvent);
if (longTapDelay > Duration.ZERO) { if (longTapDelay > Duration.zero) {
_timer = new Timer(longTapDelay, () { _timer = new Timer(longTapDelay, () {
_timer = null; _timer = null;
gestureRecognizer._dispatchLongTap(event.pointer, _lastPosition); gestureRecognizer._dispatchLongTap(event.pointer, _lastPosition);
@ -313,10 +313,10 @@ class _TapGesture extends _TapTracker {
class MultiTapGestureRecognizer extends GestureRecognizer { class MultiTapGestureRecognizer extends GestureRecognizer {
/// Creates a multi-tap gesture recognizer. /// Creates a multi-tap gesture recognizer.
/// ///
/// The [longTapDelay] defaults to [Duration.ZERO], which means /// The [longTapDelay] defaults to [Duration.zero], which means
/// [onLongTapDown] is called immediately after [onTapDown]. /// [onLongTapDown] is called immediately after [onTapDown].
MultiTapGestureRecognizer({ MultiTapGestureRecognizer({
this.longTapDelay: Duration.ZERO, this.longTapDelay: Duration.zero,
Object debugOwner, Object debugOwner,
}) : super(debugOwner: debugOwner); }) : super(debugOwner: debugOwner);

View File

@ -62,17 +62,17 @@ class MaterialPointArcTween extends Tween<Offset> {
_beginAngle = sweepAngle() * (begin.dy - end.dy).sign; _beginAngle = sweepAngle() * (begin.dy - end.dy).sign;
_endAngle = 0.0; _endAngle = 0.0;
} else { } else {
_beginAngle = math.PI + sweepAngle() * (end.dy - begin.dy).sign; _beginAngle = math.pi + sweepAngle() * (end.dy - begin.dy).sign;
_endAngle = math.PI; _endAngle = math.pi;
} }
} else { } else {
_radius = distanceFromAtoB * distanceFromAtoB / (c - end).distance / 2.0; _radius = distanceFromAtoB * distanceFromAtoB / (c - end).distance / 2.0;
_center = new Offset(begin.dx, begin.dy + (end.dy - begin.dy).sign * _radius); _center = new Offset(begin.dx, begin.dy + (end.dy - begin.dy).sign * _radius);
if (begin.dy < end.dy) { if (begin.dy < end.dy) {
_beginAngle = -math.PI / 2.0; _beginAngle = -math.pi / 2.0;
_endAngle = _beginAngle + sweepAngle() * (end.dx - begin.dx).sign; _endAngle = _beginAngle + sweepAngle() * (end.dx - begin.dx).sign;
} else { } else {
_beginAngle = math.PI / 2.0; _beginAngle = math.pi / 2.0;
_endAngle = _beginAngle + sweepAngle() * (begin.dx - end.dx).sign; _endAngle = _beginAngle + sweepAngle() * (begin.dx - end.dx).sign;
} }
} }

View File

@ -705,7 +705,7 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin {
_opacityController.value = widget.visible ? 1.0 : 0.0; _opacityController.value = widget.visible ? 1.0 : 0.0;
_orientationAnimation = new Tween<double>( _orientationAnimation = new Tween<double>(
begin: 0.0, begin: 0.0,
end: math.PI, end: math.pi,
).animate(new CurvedAnimation( ).animate(new CurvedAnimation(
parent: _orientationController = new AnimationController( parent: _orientationController = new AnimationController(
duration: widget.duration, duration: widget.duration,
@ -716,7 +716,7 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin {
..addListener(_rebuild) ..addListener(_rebuild)
..addStatusListener(_resetOrientationAnimation); ..addStatusListener(_resetOrientationAnimation);
if (widget.visible) if (widget.visible)
_orientationOffset = widget.down ? 0.0 : math.PI; _orientationOffset = widget.down ? 0.0 : math.pi;
} }
void _rebuild() { void _rebuild() {
@ -727,8 +727,8 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin {
void _resetOrientationAnimation(AnimationStatus status) { void _resetOrientationAnimation(AnimationStatus status) {
if (status == AnimationStatus.completed) { if (status == AnimationStatus.completed) {
assert(_orientationAnimation.value == math.PI); assert(_orientationAnimation.value == math.pi);
_orientationOffset += math.PI; _orientationOffset += math.pi;
_orientationController.value = 0.0; // TODO(ianh): This triggers a pointless rebuild. _orientationController.value = 0.0; // TODO(ianh): This triggers a pointless rebuild.
} }
} }
@ -742,7 +742,7 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin {
if (widget.visible && (_opacityController.status == AnimationStatus.dismissed)) { if (widget.visible && (_opacityController.status == AnimationStatus.dismissed)) {
_orientationController.stop(); _orientationController.stop();
_orientationController.value = 0.0; _orientationController.value = 0.0;
_orientationOffset = newDown ? 0.0 : math.PI; _orientationOffset = newDown ? 0.0 : math.pi;
skipArrow = true; skipArrow = true;
} }
if (widget.visible) { if (widget.visible) {

View File

@ -204,7 +204,7 @@ class _DayPickerGridDelegate extends SliverGridDelegate {
@override @override
SliverGridLayout getLayout(SliverConstraints constraints) { SliverGridLayout getLayout(SliverConstraints constraints) {
final int columnCount = DateTime.DAYS_PER_WEEK; final int columnCount = DateTime.daysPerWeek;
final double tileWidth = constraints.crossAxisExtent / columnCount; final double tileWidth = constraints.crossAxisExtent / columnCount;
final double tileHeight = math.min(_kDayPickerRowHeight, constraints.viewportMainAxisExtent / (_kMaxDayPickerRowCount + 1)); final double tileHeight = math.min(_kDayPickerRowHeight, constraints.viewportMainAxisExtent / (_kMaxDayPickerRowCount + 1));
return new SliverGridRegularTileLayout( return new SliverGridRegularTileLayout(
@ -319,7 +319,7 @@ class DayPicker extends StatelessWidget {
/// This applies the leap year logic introduced by the Gregorian reforms of /// This applies the leap year logic introduced by the Gregorian reforms of
/// 1582. It will not give valid results for dates prior to that time. /// 1582. It will not give valid results for dates prior to that time.
static int getDaysInMonth(int year, int month) { static int getDaysInMonth(int year, int month) {
if (month == DateTime.FEBRUARY) { if (month == DateTime.february) {
final bool isLeapYear = (year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0); final bool isLeapYear = (year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0);
if (isLeapYear) if (isLeapYear)
return 29; return 29;

View File

@ -365,19 +365,19 @@ class OutlineInputBorder extends InputBorder {
center.blRadiusY * 2.0, center.blRadiusY * 2.0,
); );
final double cornerArcSweep = math.PI / 2.0; final double cornerArcSweep = math.pi / 2.0;
final double tlCornerArcSweep = start < center.tlRadiusX final double tlCornerArcSweep = start < center.tlRadiusX
? math.asin(start / center.tlRadiusX) ? math.asin(start / center.tlRadiusX)
: math.PI / 2.0; : math.pi / 2.0;
final Path path = new Path() final Path path = new Path()
..addArc(tlCorner, math.PI, tlCornerArcSweep) ..addArc(tlCorner, math.pi, tlCornerArcSweep)
..moveTo(center.left + center.tlRadiusX, center.top); ..moveTo(center.left + center.tlRadiusX, center.top);
if (start > center.tlRadiusX) if (start > center.tlRadiusX)
path.lineTo(center.left + start, center.top); path.lineTo(center.left + start, center.top);
final double trCornerArcStart = (3 * math.PI) / 2.0; final double trCornerArcStart = (3 * math.pi) / 2.0;
final double trCornerArcSweep = cornerArcSweep; final double trCornerArcSweep = cornerArcSweep;
if (start + extent < center.width - center.trRadiusX) { if (start + extent < center.width - center.trRadiusX) {
path path
@ -395,7 +395,7 @@ class OutlineInputBorder extends InputBorder {
..lineTo(center.right, center.bottom - center.brRadiusY) ..lineTo(center.right, center.bottom - center.brRadiusY)
..addArc(brCorner, 0.0, cornerArcSweep) ..addArc(brCorner, 0.0, cornerArcSweep)
..lineTo(center.left + center.blRadiusX, center.bottom) ..lineTo(center.left + center.blRadiusX, center.bottom)
..addArc(blCorner, math.PI / 2.0, cornerArcSweep) ..addArc(blCorner, math.pi / 2.0, cornerArcSweep)
..lineTo(center.left, center.top + center.trRadiusY); ..lineTo(center.left, center.top + center.trRadiusY);
} }

View File

@ -305,7 +305,7 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
/// function, rather than constructing this class directly. /// function, rather than constructing this class directly.
const DefaultMaterialLocalizations(); const DefaultMaterialLocalizations();
// Ordered to match DateTime.MONDAY=1, DateTime.SUNDAY=6 // Ordered to match DateTime.monday=1, DateTime.sunday=6
static const List<String> _shortWeekdays = const <String>[ static const List<String> _shortWeekdays = const <String>[
'Mon', 'Mon',
'Tue', 'Tue',
@ -316,7 +316,7 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
'Sun', 'Sun',
]; ];
// Ordered to match DateTime.MONDAY=1, DateTime.SUNDAY=6 // Ordered to match DateTime.monday=1, DateTime.sunday=6
static const List<String> _weekdays = const <String>[ static const List<String> _weekdays = const <String>[
'Monday', 'Monday',
'Tuesday', 'Tuesday',
@ -402,21 +402,21 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
@override @override
String formatMediumDate(DateTime date) { String formatMediumDate(DateTime date) {
final String day = _shortWeekdays[date.weekday - DateTime.MONDAY]; final String day = _shortWeekdays[date.weekday - DateTime.monday];
final String month = _shortMonths[date.month - DateTime.JANUARY]; final String month = _shortMonths[date.month - DateTime.january];
return '$day, $month ${date.day}'; return '$day, $month ${date.day}';
} }
@override @override
String formatFullDate(DateTime date) { String formatFullDate(DateTime date) {
final String month = _months[date.month - DateTime.JANUARY]; final String month = _months[date.month - DateTime.january];
return '${_weekdays[date.weekday - DateTime.MONDAY]}, $month ${date.day}, ${date.year}'; return '${_weekdays[date.weekday - DateTime.monday]}, $month ${date.day}, ${date.year}';
} }
@override @override
String formatMonthYear(DateTime date) { String formatMonthYear(DateTime date) {
final String year = formatYear(date); final String year = formatYear(date);
final String month = _months[date.month - DateTime.JANUARY]; final String month = _months[date.month - DateTime.january];
return '$month $year'; return '$month $year';
} }

View File

@ -204,7 +204,7 @@ class _LinearProgressIndicatorState extends State<LinearProgressIndicator> with
Widget _buildIndicator(BuildContext context, double animationValue, TextDirection textDirection) { Widget _buildIndicator(BuildContext context, double animationValue, TextDirection textDirection) {
return new Container( return new Container(
constraints: const BoxConstraints.tightFor( constraints: const BoxConstraints.tightFor(
width: double.INFINITY, width: double.infinity,
height: _kLinearProgressIndicatorHeight, height: _kLinearProgressIndicatorHeight,
), ),
child: new CustomPaint( child: new CustomPaint(
@ -236,11 +236,11 @@ class _LinearProgressIndicatorState extends State<LinearProgressIndicator> with
} }
class _CircularProgressIndicatorPainter extends CustomPainter { class _CircularProgressIndicatorPainter extends CustomPainter {
static const double _kTwoPI = math.PI * 2.0; static const double _kTwoPI = math.pi * 2.0;
static const double _kEpsilon = .001; static const double _kEpsilon = .001;
// Canvas.drawArc(r, 0, 2*PI) doesn't draw anything, so just get close. // Canvas.drawArc(r, 0, 2*PI) doesn't draw anything, so just get close.
static const double _kSweep = _kTwoPI - _kEpsilon; static const double _kSweep = _kTwoPI - _kEpsilon;
static const double _kStartAngle = -math.PI / 2.0; static const double _kStartAngle = -math.pi / 2.0;
_CircularProgressIndicatorPainter({ _CircularProgressIndicatorPainter({
this.valueColor, this.valueColor,
@ -252,10 +252,10 @@ class _CircularProgressIndicatorPainter extends CustomPainter {
this.strokeWidth, this.strokeWidth,
}) : arcStart = value != null }) : arcStart = value != null
? _kStartAngle ? _kStartAngle
: _kStartAngle + tailValue * 3 / 2 * math.PI + rotationValue * math.PI * 1.7 - stepValue * 0.8 * math.PI, : _kStartAngle + tailValue * 3 / 2 * math.pi + rotationValue * math.pi * 1.7 - stepValue * 0.8 * math.pi,
arcSweep = value != null arcSweep = value != null
? value.clamp(0.0, 1.0) * _kSweep ? value.clamp(0.0, 1.0) * _kSweep
: math.max(headValue * 3 / 2 * math.PI - tailValue * 3 / 2 * math.PI, _kEpsilon); : math.max(headValue * 3 / 2 * math.pi - tailValue * 3 / 2 * math.pi, _kEpsilon);
final Color valueColor; final Color valueColor;
final double value; final double value;

View File

@ -169,14 +169,14 @@ class _MaterialTextSelectionControls extends TextSelectionControls {
switch (type) { switch (type) {
case TextSelectionHandleType.left: // points up-right case TextSelectionHandleType.left: // points up-right
return new Transform( return new Transform(
transform: new Matrix4.rotationZ(math.PI / 2.0), transform: new Matrix4.rotationZ(math.pi / 2.0),
child: handle child: handle
); );
case TextSelectionHandleType.right: // points up-left case TextSelectionHandleType.right: // points up-left
return handle; return handle;
case TextSelectionHandleType.collapsed: // points up case TextSelectionHandleType.collapsed: // points up
return new Transform( return new Transform(
transform: new Matrix4.rotationZ(math.PI / 4.0), transform: new Matrix4.rotationZ(math.pi / 4.0),
child: handle child: handle
); );
} }

View File

@ -22,7 +22,7 @@ import 'time.dart';
import 'typography.dart'; import 'typography.dart';
const Duration _kDialAnimateDuration = const Duration(milliseconds: 200); const Duration _kDialAnimateDuration = const Duration(milliseconds: 200);
const double _kTwoPi = 2 * math.PI; const double _kTwoPi = 2 * math.pi;
const Duration _kVibrateCommitDelay = const Duration(milliseconds: 100); const Duration _kVibrateCommitDelay = const Duration(milliseconds: 100);
enum _TimePickerMode { hour, minute } enum _TimePickerMode { hour, minute }
@ -861,7 +861,7 @@ class _DialPainter extends CustomPainter {
if (labels == null) if (labels == null)
return; return;
final double labelThetaIncrement = -_kTwoPi / labels.length; final double labelThetaIncrement = -_kTwoPi / labels.length;
double labelTheta = math.PI / 2.0; double labelTheta = math.pi / 2.0;
for (_TappableLabel label in labels) { for (_TappableLabel label in labels) {
final TextPainter labelPainter = label.painter; final TextPainter labelPainter = label.painter;
@ -931,7 +931,7 @@ class _DialPainter extends CustomPainter {
if (labels == null) if (labels == null)
return; return;
final double labelThetaIncrement = -_kTwoPi / labels.length; final double labelThetaIncrement = -_kTwoPi / labels.length;
double labelTheta = math.PI / 2.0; double labelTheta = math.pi / 2.0;
for (_TappableLabel label in labels) { for (_TappableLabel label in labels) {
final TextPainter labelPainter = label.painter; final TextPainter labelPainter = label.painter;
@ -1078,7 +1078,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
final double fraction = widget.mode == _TimePickerMode.hour final double fraction = widget.mode == _TimePickerMode.hour
? (time.hour / TimeOfDay.hoursPerPeriod) % TimeOfDay.hoursPerPeriod ? (time.hour / TimeOfDay.hoursPerPeriod) % TimeOfDay.hoursPerPeriod
: (time.minute / TimeOfDay.minutesPerHour) % TimeOfDay.minutesPerHour; : (time.minute / TimeOfDay.minutesPerHour) % TimeOfDay.minutesPerHour;
return (math.PI / 2.0 - fraction * _kTwoPi) % _kTwoPi; return (math.pi / 2.0 - fraction * _kTwoPi) % _kTwoPi;
} }
TimeOfDay _getTimeForTheta(double theta) { TimeOfDay _getTimeForTheta(double theta) {
@ -1115,7 +1115,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
void _updateThetaForPan() { void _updateThetaForPan() {
setState(() { setState(() {
final Offset offset = _position - _center; final Offset offset = _position - _center;
final double angle = (math.atan2(offset.dx, offset.dy) - math.PI / 2.0) % _kTwoPi; final double angle = (math.atan2(offset.dx, offset.dy) - math.pi / 2.0) % _kTwoPi;
_thetaTween _thetaTween
..begin = angle ..begin = angle
..end = angle; // The controller doesn't animate during the pan gesture. ..end = angle; // The controller doesn't animate during the pan gesture.

View File

@ -210,11 +210,11 @@ class AssetImage extends AssetBundleImageProvider {
return completer.future; return completer.future;
} }
static Future<Map<String, List<String>>> _manifestParser(String json) { static Future<Map<String, List<String>>> _manifestParser(String jsonData) {
if (json == null) if (jsonData == null)
return null; return null;
// TODO(ianh): JSON decoding really shouldn't be on the main thread. // TODO(ianh): JSON decoding really shouldn't be on the main thread.
final Map<String, dynamic> parsedJson = JSON.decode(json); final Map<String, dynamic> parsedJson = json.decode(jsonData);
final Iterable<String> keys = parsedJson.keys; final Iterable<String> keys = parsedJson.keys;
final Map<String, List<String>> parsedManifest = final Map<String, List<String>> parsedManifest =
new Map<String, List<String>>.fromIterables(keys, new Map<String, List<String>>.fromIterables(keys,

View File

@ -228,7 +228,7 @@ class TextPainter {
builder.pushStyle(text.style.getTextStyle(textScaleFactor: textScaleFactor)); builder.pushStyle(text.style.getTextStyle(textScaleFactor: textScaleFactor));
builder.addText(_kZeroWidthSpace); builder.addText(_kZeroWidthSpace);
_layoutTemplate = builder.build() _layoutTemplate = builder.build()
..layout(new ui.ParagraphConstraints(width: double.INFINITY)); ..layout(new ui.ParagraphConstraints(width: double.infinity));
} }
return _layoutTemplate.height; return _layoutTemplate.height;
} }
@ -297,7 +297,7 @@ class TextPainter {
builder.pushStyle(text.style.getTextStyle(textScaleFactor: textScaleFactor)); builder.pushStyle(text.style.getTextStyle(textScaleFactor: textScaleFactor));
builder.addText(_kZeroWidthSpace); builder.addText(_kZeroWidthSpace);
final ui.Paragraph paragraph = builder.build() final ui.Paragraph paragraph = builder.build()
..layout(new ui.ParagraphConstraints(width: double.INFINITY)); ..layout(new ui.ParagraphConstraints(width: double.infinity));
switch (baseline) { switch (baseline) {
case TextBaseline.alphabetic: case TextBaseline.alphabetic:
@ -351,7 +351,7 @@ class TextPainter {
/// ///
/// The [text] and [textDirection] properties must be non-null before this is /// The [text] and [textDirection] properties must be non-null before this is
/// called. /// called.
void layout({ double minWidth: 0.0, double maxWidth: double.INFINITY }) { void layout({ double minWidth: 0.0, double maxWidth: double.infinity }) {
assert(text != null, 'TextPainter.text must be set to a non-null value before using the TextPainter.'); assert(text != null, 'TextPainter.text must be set to a non-null value before using the TextPainter.');
assert(textDirection != null, 'TextPainter.textDirection must be set to a non-null value before using the TextPainter.'); assert(textDirection != null, 'TextPainter.textDirection must be set to a non-null value before using the TextPainter.');
if (!_needsLayout && minWidth == _lastMinWidth && maxWidth == _lastMaxWidth) if (!_needsLayout && minWidth == _lastMinWidth && maxWidth == _lastMaxWidth)

View File

@ -22,10 +22,10 @@ class ClampedSimulation extends Simulation {
/// The named arguments specify the ranges for the clamping behavior, as /// The named arguments specify the ranges for the clamping behavior, as
/// applied to [x] and [dx]. /// applied to [x] and [dx].
ClampedSimulation(this.simulation, { ClampedSimulation(this.simulation, {
this.xMin: double.NEGATIVE_INFINITY, this.xMin: double.negativeInfinity,
this.xMax: double.INFINITY, this.xMax: double.infinity,
this.dxMin: double.NEGATIVE_INFINITY, this.dxMin: double.negativeInfinity,
this.dxMax: double.INFINITY this.dxMax: double.infinity
}) : assert(simulation != null), }) : assert(simulation != null),
assert(xMax >= xMin), assert(xMax >= xMin),
assert(dxMax >= dxMin); assert(dxMax >= dxMin);

View File

@ -62,7 +62,7 @@ class FrictionSimulation extends Simulation {
// Solving for D given x(time) is trickier. Algebra courtesy of Wolfram Alpha: // Solving for D given x(time) is trickier. Algebra courtesy of Wolfram Alpha:
// x1 = x0 + (v0 * D^((log(v1) - log(v0)) / log(D))) / log(D) - v0 / log(D), find D // x1 = x0 + (v0 * D^((log(v1) - log(v0)) / log(D))) / log(D) - v0 / log(D), find D
static double _dragFor(double startPosition, double endPosition, double startVelocity, double endVelocity) { static double _dragFor(double startPosition, double endPosition, double startVelocity, double endVelocity) {
return math.pow(math.E, (startVelocity - endVelocity) / (startPosition - endPosition)); return math.pow(math.e, (startVelocity - endVelocity) / (startPosition - endPosition));
} }
@override @override
@ -71,17 +71,17 @@ class FrictionSimulation extends Simulation {
@override @override
double dx(double time) => _v * math.pow(_drag, time); double dx(double time) => _v * math.pow(_drag, time);
/// The value of [x] at `double.INFINITY`. /// The value of [x] at `double.infinity`.
double get finalX => _x - _v / _dragLog; double get finalX => _x - _v / _dragLog;
/// The time at which the value of `x(time)` will equal [x]. /// The time at which the value of `x(time)` will equal [x].
/// ///
/// Returns `double.INFINITY` if the simulation will never reach [x]. /// Returns `double.infinity` if the simulation will never reach [x].
double timeAtX(double x) { double timeAtX(double x) {
if (x == _x) if (x == _x)
return 0.0; return 0.0;
if (_v == 0.0 || (_v > 0 ? (x < _x || x > finalX) : (x > _x || x < finalX))) if (_v == 0.0 || (_v > 0 ? (x < _x || x > finalX) : (x > _x || x < finalX)))
return double.INFINITY; return double.infinity;
return math.log(_dragLog * (x - _x) / _v + 1.0) / _dragLog; return math.log(_dragLog * (x - _x) / _v + 1.0) / _dragLog;
} }

View File

@ -191,12 +191,12 @@ class _CriticalSolution implements _SpringSolution {
@override @override
double x(double time) { double x(double time) {
return (_c1 + _c2 * time) * math.pow(math.E, _r * time); return (_c1 + _c2 * time) * math.pow(math.e, _r * time);
} }
@override @override
double dx(double time) { double dx(double time) {
final double power = math.pow(math.E, _r * time); final double power = math.pow(math.e, _r * time);
return _r * (_c1 + _c2 * time) * power + _c2 * power; return _r * (_c1 + _c2 * time) * power + _c2 * power;
} }
@ -228,14 +228,14 @@ class _OverdampedSolution implements _SpringSolution {
@override @override
double x(double time) { double x(double time) {
return _c1 * math.pow(math.E, _r1 * time) + return _c1 * math.pow(math.e, _r1 * time) +
_c2 * math.pow(math.E, _r2 * time); _c2 * math.pow(math.e, _r2 * time);
} }
@override @override
double dx(double time) { double dx(double time) {
return _c1 * _r1 * math.pow(math.E, _r1 * time) + return _c1 * _r1 * math.pow(math.e, _r1 * time) +
_c2 * _r2 * math.pow(math.E, _r2 * time); _c2 * _r2 * math.pow(math.e, _r2 * time);
} }
@override @override
@ -266,13 +266,13 @@ class _UnderdampedSolution implements _SpringSolution {
@override @override
double x(double time) { double x(double time) {
return math.pow(math.E, _r * time) * return math.pow(math.e, _r * time) *
(_c1 * math.cos(_w * time) + _c2 * math.sin(_w * time)); (_c1 * math.cos(_w * time) + _c2 * math.sin(_w * time));
} }
@override @override
double dx(double time) { double dx(double time) {
final double power = math.pow(math.E, _r * time); final double power = math.pow(math.e, _r * time);
final double cosine = math.cos(_w * time); final double cosine = math.cos(_w * time);
final double sine = math.sin(_w * time); final double sine = math.sin(_w * time);
return power * (_c2 * _w * cosine - _c1 * _w * sine) + return power * (_c2 * _w * cosine - _c1 * _w * sine) +

View File

@ -30,10 +30,10 @@ class _DebugSize extends Size {
/// ///
/// The constraints themselves must satisfy these relations: /// The constraints themselves must satisfy these relations:
/// ///
/// * 0.0 <= [minWidth] <= [maxWidth] <= [double.INFINITY] /// * 0.0 <= [minWidth] <= [maxWidth] <= [double.infinity]
/// * 0.0 <= [minHeight] <= [maxHeight] <= [double.INFINITY] /// * 0.0 <= [minHeight] <= [maxHeight] <= [double.infinity]
/// ///
/// [double.INFINITY] is a legal value for each constraint. /// [double.infinity] is a legal value for each constraint.
/// ///
/// ## The box layout model /// ## The box layout model
/// ///
@ -83,9 +83,9 @@ class BoxConstraints extends Constraints {
/// Creates box constraints with the given constraints. /// Creates box constraints with the given constraints.
const BoxConstraints({ const BoxConstraints({
this.minWidth: 0.0, this.minWidth: 0.0,
this.maxWidth: double.INFINITY, this.maxWidth: double.infinity,
this.minHeight: 0.0, this.minHeight: 0.0,
this.maxHeight: double.INFINITY this.maxHeight: double.infinity
}); });
/// The minimum width that satisfies the constraints. /// The minimum width that satisfies the constraints.
@ -93,7 +93,7 @@ class BoxConstraints extends Constraints {
/// The maximum width that satisfies the constraints. /// The maximum width that satisfies the constraints.
/// ///
/// Might be [double.INFINITY]. /// Might be [double.infinity].
final double maxWidth; final double maxWidth;
/// The minimum height that satisfies the constraints. /// The minimum height that satisfies the constraints.
@ -101,7 +101,7 @@ class BoxConstraints extends Constraints {
/// The maximum height that satisfies the constraints. /// The maximum height that satisfies the constraints.
/// ///
/// Might be [double.INFINITY]. /// Might be [double.infinity].
final double maxHeight; final double maxHeight;
/// Creates box constraints that is respected only by the given size. /// Creates box constraints that is respected only by the given size.
@ -122,9 +122,9 @@ class BoxConstraints extends Constraints {
double width, double width,
double height double height
}): minWidth = width != null ? width : 0.0, }): minWidth = width != null ? width : 0.0,
maxWidth = width != null ? width : double.INFINITY, maxWidth = width != null ? width : double.infinity,
minHeight = height != null ? height : 0.0, minHeight = height != null ? height : 0.0,
maxHeight = height != null ? height : double.INFINITY; maxHeight = height != null ? height : double.infinity;
/// Creates box constraints that require the given width or height, except if /// Creates box constraints that require the given width or height, except if
/// they are infinite. /// they are infinite.
@ -134,12 +134,12 @@ class BoxConstraints extends Constraints {
/// * [new BoxConstraints.tightFor], which is similar but instead of being /// * [new BoxConstraints.tightFor], which is similar but instead of being
/// tight if the value is not infinite, is tight if the value is non-null. /// tight if the value is not infinite, is tight if the value is non-null.
const BoxConstraints.tightForFinite({ const BoxConstraints.tightForFinite({
double width: double.INFINITY, double width: double.infinity,
double height: double.INFINITY double height: double.infinity
}): minWidth = width != double.INFINITY ? width : 0.0, }): minWidth = width != double.infinity ? width : 0.0,
maxWidth = width != double.INFINITY ? width : double.INFINITY, maxWidth = width != double.infinity ? width : double.infinity,
minHeight = height != double.INFINITY ? height : 0.0, minHeight = height != double.infinity ? height : 0.0,
maxHeight = height != double.INFINITY ? height : double.INFINITY; maxHeight = height != double.infinity ? height : double.infinity;
/// Creates box constraints that forbid sizes larger than the given size. /// Creates box constraints that forbid sizes larger than the given size.
BoxConstraints.loose(Size size) BoxConstraints.loose(Size size)
@ -155,10 +155,10 @@ class BoxConstraints extends Constraints {
const BoxConstraints.expand({ const BoxConstraints.expand({
double width, double width,
double height double height
}): minWidth = width != null ? width : double.INFINITY, }): minWidth = width != null ? width : double.infinity,
maxWidth = width != null ? width : double.INFINITY, maxWidth = width != null ? width : double.infinity,
minHeight = height != null ? height : double.INFINITY, minHeight = height != null ? height : double.infinity,
maxHeight = height != null ? height : double.INFINITY; maxHeight = height != null ? height : double.infinity;
/// Creates a copy of this box constraints but with the given fields replaced with the new values. /// Creates a copy of this box constraints but with the given fields replaced with the new values.
BoxConstraints copyWith({ BoxConstraints copyWith({
@ -243,14 +243,14 @@ class BoxConstraints extends Constraints {
/// Returns the width that both satisfies the constraints and is as close as /// Returns the width that both satisfies the constraints and is as close as
/// possible to the given width. /// possible to the given width.
double constrainWidth([double width = double.INFINITY]) { double constrainWidth([double width = double.infinity]) {
assert(debugAssertIsValid()); assert(debugAssertIsValid());
return width.clamp(minWidth, maxWidth); return width.clamp(minWidth, maxWidth);
} }
/// Returns the height that both satisfies the constraints and is as close as /// Returns the height that both satisfies the constraints and is as close as
/// possible to the given height. /// possible to the given height.
double constrainHeight([double height = double.INFINITY]) { double constrainHeight([double height = double.infinity]) {
assert(debugAssertIsValid()); assert(debugAssertIsValid());
return height.clamp(minHeight, maxHeight); return height.clamp(minHeight, maxHeight);
} }
@ -346,10 +346,10 @@ class BoxConstraints extends Constraints {
bool get isTight => hasTightWidth && hasTightHeight; bool get isTight => hasTightWidth && hasTightHeight;
/// Whether there is an upper bound on the maximum width. /// Whether there is an upper bound on the maximum width.
bool get hasBoundedWidth => maxWidth < double.INFINITY; bool get hasBoundedWidth => maxWidth < double.infinity;
/// Whether there is an upper bound on the maximum height. /// Whether there is an upper bound on the maximum height.
bool get hasBoundedHeight => maxHeight < double.INFINITY; bool get hasBoundedHeight => maxHeight < double.infinity;
/// Whether the given size satisfies the constraints. /// Whether the given size satisfies the constraints.
bool isSatisfiedBy(Size size) { bool isSatisfiedBy(Size size) {
@ -424,15 +424,15 @@ class BoxConstraints extends Constraints {
return a * (1.0 - t); return a * (1.0 - t);
assert(a.debugAssertIsValid()); assert(a.debugAssertIsValid());
assert(b.debugAssertIsValid()); assert(b.debugAssertIsValid());
assert((a.minWidth.isFinite && b.minWidth.isFinite) || (a.minWidth == double.INFINITY && b.minWidth == double.INFINITY), 'Cannot interpolate between finite constraints and unbounded constraints.'); assert((a.minWidth.isFinite && b.minWidth.isFinite) || (a.minWidth == double.infinity && b.minWidth == double.infinity), 'Cannot interpolate between finite constraints and unbounded constraints.');
assert((a.maxWidth.isFinite && b.maxWidth.isFinite) || (a.maxWidth == double.INFINITY && b.maxWidth == double.INFINITY), 'Cannot interpolate between finite constraints and unbounded constraints.'); assert((a.maxWidth.isFinite && b.maxWidth.isFinite) || (a.maxWidth == double.infinity && b.maxWidth == double.infinity), 'Cannot interpolate between finite constraints and unbounded constraints.');
assert((a.minHeight.isFinite && b.minHeight.isFinite) || (a.minHeight == double.INFINITY && b.minHeight == double.INFINITY), 'Cannot interpolate between finite constraints and unbounded constraints.'); assert((a.minHeight.isFinite && b.minHeight.isFinite) || (a.minHeight == double.infinity && b.minHeight == double.infinity), 'Cannot interpolate between finite constraints and unbounded constraints.');
assert((a.maxHeight.isFinite && b.maxHeight.isFinite) || (a.maxHeight == double.INFINITY && b.maxHeight == double.INFINITY), 'Cannot interpolate between finite constraints and unbounded constraints.'); assert((a.maxHeight.isFinite && b.maxHeight.isFinite) || (a.maxHeight == double.infinity && b.maxHeight == double.infinity), 'Cannot interpolate between finite constraints and unbounded constraints.');
return new BoxConstraints( return new BoxConstraints(
minWidth: a.minWidth.isFinite ? ui.lerpDouble(a.minWidth, b.minWidth, t) : double.INFINITY, minWidth: a.minWidth.isFinite ? ui.lerpDouble(a.minWidth, b.minWidth, t) : double.infinity,
maxWidth: a.maxWidth.isFinite ? ui.lerpDouble(a.maxWidth, b.maxWidth, t) : double.INFINITY, maxWidth: a.maxWidth.isFinite ? ui.lerpDouble(a.maxWidth, b.maxWidth, t) : double.infinity,
minHeight: a.minHeight.isFinite ? ui.lerpDouble(a.minHeight, b.minHeight, t) : double.INFINITY, minHeight: a.minHeight.isFinite ? ui.lerpDouble(a.minHeight, b.minHeight, t) : double.infinity,
maxHeight: a.maxHeight.isFinite ? ui.lerpDouble(a.maxHeight, b.maxHeight, t) : double.INFINITY, maxHeight: a.maxHeight.isFinite ? ui.lerpDouble(a.maxHeight, b.maxHeight, t) : double.infinity,
); );
} }
@ -557,10 +557,10 @@ class BoxConstraints extends Constraints {
@override @override
String toString() { String toString() {
final String annotation = isNormalized ? '' : '; NOT NORMALIZED'; final String annotation = isNormalized ? '' : '; NOT NORMALIZED';
if (minWidth == double.INFINITY && minHeight == double.INFINITY) if (minWidth == double.infinity && minHeight == double.infinity)
return 'BoxConstraints(biggest$annotation)'; return 'BoxConstraints(biggest$annotation)';
if (minWidth == 0 && maxWidth == double.INFINITY && if (minWidth == 0 && maxWidth == double.infinity &&
minHeight == 0 && maxHeight == double.INFINITY) minHeight == 0 && maxHeight == double.infinity)
return 'BoxConstraints(unconstrained$annotation)'; return 'BoxConstraints(unconstrained$annotation)';
String describe(double min, double max, String dim) { String describe(double min, double max, String dim) {
if (min == max) if (min == max)
@ -1089,7 +1089,7 @@ abstract class RenderBox extends RenderObject {
throw new FlutterError( throw new FlutterError(
'The height argument to getMinIntrinsicWidth was null.\n' 'The height argument to getMinIntrinsicWidth was null.\n'
'The argument to getMinIntrinsicWidth must not be negative or null. ' 'The argument to getMinIntrinsicWidth must not be negative or null. '
'If you do not have a specific height in mind, then pass double.INFINITY instead.' 'If you do not have a specific height in mind, then pass double.infinity instead.'
); );
} }
if (height < 0.0) { if (height < 0.0) {
@ -1228,7 +1228,7 @@ abstract class RenderBox extends RenderObject {
throw new FlutterError( throw new FlutterError(
'The height argument to getMaxIntrinsicWidth was null.\n' 'The height argument to getMaxIntrinsicWidth was null.\n'
'The argument to getMaxIntrinsicWidth must not be negative or null. ' 'The argument to getMaxIntrinsicWidth must not be negative or null. '
'If you do not have a specific height in mind, then pass double.INFINITY instead.' 'If you do not have a specific height in mind, then pass double.infinity instead.'
); );
} }
if (height < 0.0) { if (height < 0.0) {
@ -1304,7 +1304,7 @@ abstract class RenderBox extends RenderObject {
throw new FlutterError( throw new FlutterError(
'The width argument to getMinIntrinsicHeight was null.\n' 'The width argument to getMinIntrinsicHeight was null.\n'
'The argument to getMinIntrinsicHeight must not be negative or null. ' 'The argument to getMinIntrinsicHeight must not be negative or null. '
'If you do not have a specific width in mind, then pass double.INFINITY instead.' 'If you do not have a specific width in mind, then pass double.infinity instead.'
); );
} }
if (width < 0.0) { if (width < 0.0) {
@ -1377,7 +1377,7 @@ abstract class RenderBox extends RenderObject {
throw new FlutterError( throw new FlutterError(
'The width argument to getMaxIntrinsicHeight was null.\n' 'The width argument to getMaxIntrinsicHeight was null.\n'
'The argument to getMaxIntrinsicHeight must not be negative or null. ' 'The argument to getMaxIntrinsicHeight must not be negative or null. '
'If you do not have a specific width in mind, then pass double.INFINITY instead.' 'If you do not have a specific width in mind, then pass double.infinity instead.'
); );
} }
if (width < 0.0) { if (width < 0.0) {
@ -1747,8 +1747,8 @@ abstract class RenderBox extends RenderObject {
} }
} }
testIntrinsicsForValues(getMinIntrinsicWidth, getMaxIntrinsicWidth, 'Width', double.INFINITY); testIntrinsicsForValues(getMinIntrinsicWidth, getMaxIntrinsicWidth, 'Width', double.infinity);
testIntrinsicsForValues(getMinIntrinsicHeight, getMaxIntrinsicHeight, 'Height', double.INFINITY); testIntrinsicsForValues(getMinIntrinsicHeight, getMaxIntrinsicHeight, 'Height', double.infinity);
if (constraints.hasBoundedWidth) if (constraints.hasBoundedWidth)
testIntrinsicsForValues(getMinIntrinsicWidth, getMaxIntrinsicWidth, 'Width', constraints.maxWidth); testIntrinsicsForValues(getMinIntrinsicWidth, getMaxIntrinsicWidth, 'Width', constraints.maxWidth);
if (constraints.hasBoundedHeight) if (constraints.hasBoundedHeight)

View File

@ -148,7 +148,7 @@ abstract class DebugOverflowIndicatorMixin extends RenderObject {
label: 'LEFT OVERFLOWED BY ${_formatPixels(overflow.left)} PIXELS', label: 'LEFT OVERFLOWED BY ${_formatPixels(overflow.left)} PIXELS',
labelOffset: markerRect.centerLeft + labelOffset: markerRect.centerLeft +
const Offset(_indicatorFontSizePixels + _indicatorLabelPaddingPixels, 0.0), const Offset(_indicatorFontSizePixels + _indicatorLabelPaddingPixels, 0.0),
rotation: math.PI / 2.0, rotation: math.pi / 2.0,
side: _OverflowSide.left, side: _OverflowSide.left,
)); ));
} }
@ -164,7 +164,7 @@ abstract class DebugOverflowIndicatorMixin extends RenderObject {
label: 'RIGHT OVERFLOWED BY ${_formatPixels(overflow.right)} PIXELS', label: 'RIGHT OVERFLOWED BY ${_formatPixels(overflow.right)} PIXELS',
labelOffset: markerRect.centerRight - labelOffset: markerRect.centerRight -
const Offset(_indicatorFontSizePixels + _indicatorLabelPaddingPixels, 0.0), const Offset(_indicatorFontSizePixels + _indicatorLabelPaddingPixels, 0.0),
rotation: -math.PI / 2.0, rotation: -math.pi / 2.0,
side: _OverflowSide.right, side: _OverflowSide.right,
)); ));
} }

View File

@ -512,13 +512,13 @@ class RenderEditable extends RenderBox {
@override @override
double computeMinIntrinsicWidth(double height) { double computeMinIntrinsicWidth(double height) {
_layoutText(double.INFINITY); _layoutText(double.infinity);
return _textPainter.minIntrinsicWidth; return _textPainter.minIntrinsicWidth;
} }
@override @override
double computeMaxIntrinsicWidth(double height) { double computeMaxIntrinsicWidth(double height) {
_layoutText(double.INFINITY); _layoutText(double.infinity);
return _textPainter.maxIntrinsicWidth; return _textPainter.maxIntrinsicWidth;
} }
@ -529,7 +529,7 @@ class RenderEditable extends RenderBox {
double _preferredHeight(double width) { double _preferredHeight(double width) {
if (maxLines != null) if (maxLines != null)
return preferredLineHeight * maxLines; return preferredLineHeight * maxLines;
if (width == double.INFINITY) { if (width == double.infinity) {
final String text = _textPainter.text.toPlainText(); final String text = _textPainter.text.toPlainText();
int lines = 1; int lines = 1;
for (int index = 0; index < text.length; index += 1) { for (int index = 0; index < text.length; index += 1) {
@ -646,7 +646,7 @@ class RenderEditable extends RenderBox {
return; return;
final double caretMargin = _kCaretGap + _kCaretWidth; final double caretMargin = _kCaretGap + _kCaretWidth;
final double availableWidth = math.max(0.0, constraintWidth - caretMargin); final double availableWidth = math.max(0.0, constraintWidth - caretMargin);
final double maxWidth = _isMultiline ? availableWidth : double.INFINITY; final double maxWidth = _isMultiline ? availableWidth : double.infinity;
_textPainter.layout(minWidth: availableWidth, maxWidth: maxWidth); _textPainter.layout(minWidth: availableWidth, maxWidth: maxWidth);
_textLayoutLastWidth = constraintWidth; _textLayoutLastWidth = constraintWidth;
} }

View File

@ -524,11 +524,11 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
if (flex == 0) { if (flex == 0) {
switch (_direction) { switch (_direction) {
case Axis.horizontal: case Axis.horizontal:
mainSize = child.getMaxIntrinsicWidth(double.INFINITY); mainSize = child.getMaxIntrinsicWidth(double.infinity);
crossSize = childSize(child, mainSize); crossSize = childSize(child, mainSize);
break; break;
case Axis.vertical: case Axis.vertical:
mainSize = child.getMaxIntrinsicHeight(double.INFINITY); mainSize = child.getMaxIntrinsicHeight(double.infinity);
crossSize = childSize(child, mainSize); crossSize = childSize(child, mainSize);
break; break;
} }
@ -639,7 +639,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
int totalChildren = 0; int totalChildren = 0;
assert(constraints != null); assert(constraints != null);
final double maxMainSize = _direction == Axis.horizontal ? constraints.maxWidth : constraints.maxHeight; final double maxMainSize = _direction == Axis.horizontal ? constraints.maxWidth : constraints.maxHeight;
final bool canFlex = maxMainSize < double.INFINITY; final bool canFlex = maxMainSize < double.infinity;
double crossSize = 0.0; double crossSize = 0.0;
double allocatedSize = 0.0; // Sum of the sizes of the non-flexible children. double allocatedSize = 0.0; // Sum of the sizes of the non-flexible children.
@ -748,16 +748,16 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
double allocatedFlexSpace = 0.0; double allocatedFlexSpace = 0.0;
double maxBaselineDistance = 0.0; double maxBaselineDistance = 0.0;
if (totalFlex > 0 || crossAxisAlignment == CrossAxisAlignment.baseline) { if (totalFlex > 0 || crossAxisAlignment == CrossAxisAlignment.baseline) {
final double spacePerFlex = canFlex && totalFlex > 0 ? (freeSpace / totalFlex) : double.NAN; final double spacePerFlex = canFlex && totalFlex > 0 ? (freeSpace / totalFlex) : double.nan;
child = firstChild; child = firstChild;
while (child != null) { while (child != null) {
final int flex = _getFlex(child); final int flex = _getFlex(child);
if (flex > 0) { if (flex > 0) {
final double maxChildExtent = canFlex ? (child == lastFlexChild ? (freeSpace - allocatedFlexSpace) : spacePerFlex * flex) : double.INFINITY; final double maxChildExtent = canFlex ? (child == lastFlexChild ? (freeSpace - allocatedFlexSpace) : spacePerFlex * flex) : double.infinity;
double minChildExtent; double minChildExtent;
switch (_getFit(child)) { switch (_getFit(child)) {
case FlexFit.tight: case FlexFit.tight:
assert(maxChildExtent < double.INFINITY); assert(maxChildExtent < double.infinity);
minChildExtent = maxChildExtent; minChildExtent = maxChildExtent;
break; break;
case FlexFit.loose: case FlexFit.loose:

View File

@ -502,7 +502,7 @@ abstract class Constraints {
/// This might involve checks more detailed than [isNormalized]. /// This might involve checks more detailed than [isNormalized].
/// ///
/// For example, the [BoxConstraints] subclass verifies that the constraints /// For example, the [BoxConstraints] subclass verifies that the constraints
/// are not [double.NAN]. /// are not [double.nan].
/// ///
/// If the `isAppliedConstraint` argument is true, then even stricter rules /// If the `isAppliedConstraint` argument is true, then even stricter rules
/// are enforced. This argument is set to true when checking constraints that /// are enforced. This argument is set to true when checking constraints that

View File

@ -174,9 +174,9 @@ class RenderParagraph extends RenderBox {
markNeedsLayout(); markNeedsLayout();
} }
void _layoutText({ double minWidth: 0.0, double maxWidth: double.INFINITY }) { void _layoutText({ double minWidth: 0.0, double maxWidth: double.infinity }) {
final bool widthMatters = softWrap || overflow == TextOverflow.ellipsis; final bool widthMatters = softWrap || overflow == TextOverflow.ellipsis;
_textPainter.layout(minWidth: minWidth, maxWidth: widthMatters ? maxWidth : double.INFINITY); _textPainter.layout(minWidth: minWidth, maxWidth: widthMatters ? maxWidth : double.infinity);
} }
void _layoutTextWithConstraints(BoxConstraints constraints) { void _layoutTextWithConstraints(BoxConstraints constraints) {

View File

@ -162,7 +162,7 @@ class RenderPerformanceOverlay extends RenderBox {
@override @override
void performResize() { void performResize() {
size = constraints.constrain(new Size(double.INFINITY, _intrinsicHeight)); size = constraints.constrain(new Size(double.infinity, _intrinsicHeight));
} }
@override @override

View File

@ -302,8 +302,8 @@ class RenderLimitedBox extends RenderProxyBox {
/// non-negative. /// non-negative.
RenderLimitedBox({ RenderLimitedBox({
RenderBox child, RenderBox child,
double maxWidth: double.INFINITY, double maxWidth: double.infinity,
double maxHeight: double.INFINITY double maxHeight: double.infinity
}) : assert(maxWidth != null && maxWidth >= 0.0), }) : assert(maxWidth != null && maxWidth >= 0.0),
assert(maxHeight != null && maxHeight >= 0.0), assert(maxHeight != null && maxHeight >= 0.0),
_maxWidth = maxWidth, _maxWidth = maxWidth,
@ -354,8 +354,8 @@ class RenderLimitedBox extends RenderProxyBox {
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description); super.debugFillProperties(description);
description.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.INFINITY)); description.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.infinity));
description.add(new DoubleProperty('maxHeight', maxHeight, defaultValue: double.INFINITY)); description.add(new DoubleProperty('maxHeight', maxHeight, defaultValue: double.infinity));
} }
} }
@ -591,7 +591,7 @@ class RenderIntrinsicWidth extends RenderProxyBox {
if (child == null) if (child == null)
return 0.0; return 0.0;
if (!width.isFinite) if (!width.isFinite)
width = computeMaxIntrinsicWidth(double.INFINITY); width = computeMaxIntrinsicWidth(double.infinity);
assert(width.isFinite); assert(width.isFinite);
final double height = child.getMinIntrinsicHeight(width); final double height = child.getMinIntrinsicHeight(width);
return _applyStep(height, _stepHeight); return _applyStep(height, _stepHeight);
@ -602,7 +602,7 @@ class RenderIntrinsicWidth extends RenderProxyBox {
if (child == null) if (child == null)
return 0.0; return 0.0;
if (!width.isFinite) if (!width.isFinite)
width = computeMaxIntrinsicWidth(double.INFINITY); width = computeMaxIntrinsicWidth(double.infinity);
assert(width.isFinite); assert(width.isFinite);
final double height = child.getMaxIntrinsicHeight(width); final double height = child.getMaxIntrinsicHeight(width);
return _applyStep(height, _stepHeight); return _applyStep(height, _stepHeight);
@ -658,7 +658,7 @@ class RenderIntrinsicHeight extends RenderProxyBox {
if (child == null) if (child == null)
return 0.0; return 0.0;
if (!height.isFinite) if (!height.isFinite)
height = child.getMaxIntrinsicHeight(double.INFINITY); height = child.getMaxIntrinsicHeight(double.infinity);
assert(height.isFinite); assert(height.isFinite);
return child.getMinIntrinsicWidth(height); return child.getMinIntrinsicWidth(height);
} }
@ -668,7 +668,7 @@ class RenderIntrinsicHeight extends RenderProxyBox {
if (child == null) if (child == null)
return 0.0; return 0.0;
if (!height.isFinite) if (!height.isFinite)
height = child.getMaxIntrinsicHeight(double.INFINITY); height = child.getMaxIntrinsicHeight(double.infinity);
assert(height.isFinite); assert(height.isFinite);
return child.getMaxIntrinsicWidth(height); return child.getMaxIntrinsicWidth(height);
} }
@ -4039,10 +4039,10 @@ class RenderFollowerLayer extends RenderProxyBox {
Offset.zero, Offset.zero,
childPaintBounds: new Rect.fromLTRB( childPaintBounds: new Rect.fromLTRB(
// We don't know where we'll end up, so we have no idea what our cull rect should be. // We don't know where we'll end up, so we have no idea what our cull rect should be.
double.NEGATIVE_INFINITY, double.negativeInfinity,
double.NEGATIVE_INFINITY, double.negativeInfinity,
double.INFINITY, double.infinity,
double.INFINITY, double.infinity,
), ),
); );
} }

View File

@ -12,7 +12,7 @@ import 'package:vector_math/vector_math_64.dart';
import 'box.dart'; import 'box.dart';
import 'object.dart'; import 'object.dart';
const double _kQuarterTurnsInRadians = math.PI / 2.0; const double _kQuarterTurnsInRadians = math.pi / 2.0;
/// Rotates its child by a integral number of quarter turns. /// Rotates its child by a integral number of quarter turns.
/// ///

View File

@ -149,7 +149,7 @@ class RenderPadding extends RenderShiftedBox {
_resolve(); _resolve();
final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right; final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right;
final double totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom; final double totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom;
if (child != null) // next line relies on double.INFINITY absorption if (child != null) // next line relies on double.infinity absorption
return child.getMinIntrinsicWidth(math.max(0.0, height - totalVerticalPadding)) + totalHorizontalPadding; return child.getMinIntrinsicWidth(math.max(0.0, height - totalVerticalPadding)) + totalHorizontalPadding;
return totalHorizontalPadding; return totalHorizontalPadding;
} }
@ -159,7 +159,7 @@ class RenderPadding extends RenderShiftedBox {
_resolve(); _resolve();
final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right; final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right;
final double totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom; final double totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom;
if (child != null) // next line relies on double.INFINITY absorption if (child != null) // next line relies on double.infinity absorption
return child.getMaxIntrinsicWidth(math.max(0.0, height - totalVerticalPadding)) + totalHorizontalPadding; return child.getMaxIntrinsicWidth(math.max(0.0, height - totalVerticalPadding)) + totalHorizontalPadding;
return totalHorizontalPadding; return totalHorizontalPadding;
} }
@ -169,7 +169,7 @@ class RenderPadding extends RenderShiftedBox {
_resolve(); _resolve();
final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right; final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right;
final double totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom; final double totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom;
if (child != null) // next line relies on double.INFINITY absorption if (child != null) // next line relies on double.infinity absorption
return child.getMinIntrinsicHeight(math.max(0.0, width - totalHorizontalPadding)) + totalVerticalPadding; return child.getMinIntrinsicHeight(math.max(0.0, width - totalHorizontalPadding)) + totalVerticalPadding;
return totalVerticalPadding; return totalVerticalPadding;
} }
@ -179,7 +179,7 @@ class RenderPadding extends RenderShiftedBox {
_resolve(); _resolve();
final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right; final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right;
final double totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom; final double totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom;
if (child != null) // next line relies on double.INFINITY absorption if (child != null) // next line relies on double.infinity absorption
return child.getMaxIntrinsicHeight(math.max(0.0, width - totalHorizontalPadding)) + totalVerticalPadding; return child.getMaxIntrinsicHeight(math.max(0.0, width - totalHorizontalPadding)) + totalVerticalPadding;
return totalVerticalPadding; return totalVerticalPadding;
} }
@ -374,17 +374,17 @@ class RenderPositionedBox extends RenderAligningShiftedBox {
@override @override
void performLayout() { void performLayout() {
final bool shrinkWrapWidth = _widthFactor != null || constraints.maxWidth == double.INFINITY; final bool shrinkWrapWidth = _widthFactor != null || constraints.maxWidth == double.infinity;
final bool shrinkWrapHeight = _heightFactor != null || constraints.maxHeight == double.INFINITY; final bool shrinkWrapHeight = _heightFactor != null || constraints.maxHeight == double.infinity;
if (child != null) { if (child != null) {
child.layout(constraints.loosen(), parentUsesSize: true); child.layout(constraints.loosen(), parentUsesSize: true);
size = constraints.constrain(new Size(shrinkWrapWidth ? child.size.width * (_widthFactor ?? 1.0) : double.INFINITY, size = constraints.constrain(new Size(shrinkWrapWidth ? child.size.width * (_widthFactor ?? 1.0) : double.infinity,
shrinkWrapHeight ? child.size.height * (_heightFactor ?? 1.0) : double.INFINITY)); shrinkWrapHeight ? child.size.height * (_heightFactor ?? 1.0) : double.infinity));
alignChild(); alignChild();
} else { } else {
size = constraints.constrain(new Size(shrinkWrapWidth ? 0.0 : double.INFINITY, size = constraints.constrain(new Size(shrinkWrapWidth ? 0.0 : double.infinity,
shrinkWrapHeight ? 0.0 : double.INFINITY)); shrinkWrapHeight ? 0.0 : double.infinity));
} }
} }
@ -870,7 +870,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox {
double result; double result;
if (child == null) { if (child == null) {
result = super.computeMinIntrinsicWidth(height); result = super.computeMinIntrinsicWidth(height);
} else { // the following line relies on double.INFINITY absorption } else { // the following line relies on double.infinity absorption
result = child.getMinIntrinsicWidth(height * (_heightFactor ?? 1.0)); result = child.getMinIntrinsicWidth(height * (_heightFactor ?? 1.0));
} }
assert(result.isFinite); assert(result.isFinite);
@ -882,7 +882,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox {
double result; double result;
if (child == null) { if (child == null) {
result = super.computeMaxIntrinsicWidth(height); result = super.computeMaxIntrinsicWidth(height);
} else { // the following line relies on double.INFINITY absorption } else { // the following line relies on double.infinity absorption
result = child.getMaxIntrinsicWidth(height * (_heightFactor ?? 1.0)); result = child.getMaxIntrinsicWidth(height * (_heightFactor ?? 1.0));
} }
assert(result.isFinite); assert(result.isFinite);
@ -894,7 +894,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox {
double result; double result;
if (child == null) { if (child == null) {
result = super.computeMinIntrinsicHeight(width); result = super.computeMinIntrinsicHeight(width);
} else { // the following line relies on double.INFINITY absorption } else { // the following line relies on double.infinity absorption
result = child.getMinIntrinsicHeight(width * (_widthFactor ?? 1.0)); result = child.getMinIntrinsicHeight(width * (_widthFactor ?? 1.0));
} }
assert(result.isFinite); assert(result.isFinite);
@ -906,7 +906,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox {
double result; double result;
if (child == null) { if (child == null) {
result = super.computeMaxIntrinsicHeight(width); result = super.computeMaxIntrinsicHeight(width);
} else { // the following line relies on double.INFINITY absorption } else { // the following line relies on double.infinity absorption
result = child.getMaxIntrinsicHeight(width * (_widthFactor ?? 1.0)); result = child.getMaxIntrinsicHeight(width * (_widthFactor ?? 1.0));
} }
assert(result.isFinite); assert(result.isFinite);

View File

@ -296,7 +296,7 @@ class SliverConstraints extends Constraints {
/// Useful for slivers that have [RenderBox] children. /// Useful for slivers that have [RenderBox] children.
BoxConstraints asBoxConstraints({ BoxConstraints asBoxConstraints({
double minExtent: 0.0, double minExtent: 0.0,
double maxExtent: double.INFINITY, double maxExtent: double.infinity,
double crossAxisExtent, double crossAxisExtent,
}) { }) {
crossAxisExtent ??= this.crossAxisExtent; crossAxisExtent ??= this.crossAxisExtent;

View File

@ -97,7 +97,7 @@ class IntrinsicColumnWidth extends TableColumnWidth {
double minIntrinsicWidth(Iterable<RenderBox> cells, double containerWidth) { double minIntrinsicWidth(Iterable<RenderBox> cells, double containerWidth) {
double result = 0.0; double result = 0.0;
for (RenderBox cell in cells) for (RenderBox cell in cells)
result = math.max(result, cell.getMinIntrinsicWidth(double.INFINITY)); result = math.max(result, cell.getMinIntrinsicWidth(double.infinity));
return result; return result;
} }
@ -105,7 +105,7 @@ class IntrinsicColumnWidth extends TableColumnWidth {
double maxIntrinsicWidth(Iterable<RenderBox> cells, double containerWidth) { double maxIntrinsicWidth(Iterable<RenderBox> cells, double containerWidth) {
double result = 0.0; double result = 0.0;
for (RenderBox cell in cells) for (RenderBox cell in cells)
result = math.max(result, cell.getMaxIntrinsicWidth(double.INFINITY)); result = math.max(result, cell.getMaxIntrinsicWidth(double.infinity));
return result; return result;
} }
@ -726,7 +726,7 @@ class RenderTable extends RenderBox {
for (int x = 0; x < columns; x += 1) { for (int x = 0; x < columns; x += 1) {
final TableColumnWidth columnWidth = _columnWidths[x] ?? defaultColumnWidth; final TableColumnWidth columnWidth = _columnWidths[x] ?? defaultColumnWidth;
final Iterable<RenderBox> columnCells = column(x); final Iterable<RenderBox> columnCells = column(x);
totalMinWidth += columnWidth.minIntrinsicWidth(columnCells, double.INFINITY); totalMinWidth += columnWidth.minIntrinsicWidth(columnCells, double.infinity);
} }
return totalMinWidth; return totalMinWidth;
} }
@ -738,7 +738,7 @@ class RenderTable extends RenderBox {
for (int x = 0; x < columns; x += 1) { for (int x = 0; x < columns; x += 1) {
final TableColumnWidth columnWidth = _columnWidths[x] ?? defaultColumnWidth; final TableColumnWidth columnWidth = _columnWidths[x] ?? defaultColumnWidth;
final Iterable<RenderBox> columnCells = column(x); final Iterable<RenderBox> columnCells = column(x);
totalMaxWidth += columnWidth.maxIntrinsicWidth(columnCells, double.INFINITY); totalMaxWidth += columnWidth.maxIntrinsicWidth(columnCells, double.infinity);
} }
return totalMaxWidth; return totalMaxWidth;
} }

View File

@ -390,7 +390,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
int childCount = 0; int childCount = 0;
RenderBox child = firstChild; RenderBox child = firstChild;
while (child != null) { while (child != null) {
final double childWidth = child.getMaxIntrinsicWidth(double.INFINITY); final double childWidth = child.getMaxIntrinsicWidth(double.infinity);
final double childHeight = child.getMaxIntrinsicHeight(childWidth); final double childHeight = child.getMaxIntrinsicHeight(childWidth);
if (runWidth + childWidth > width) { if (runWidth + childWidth > width) {
height += runHeight; height += runHeight;
@ -422,7 +422,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
int childCount = 0; int childCount = 0;
RenderBox child = firstChild; RenderBox child = firstChild;
while (child != null) { while (child != null) {
final double childHeight = child.getMaxIntrinsicHeight(double.INFINITY); final double childHeight = child.getMaxIntrinsicHeight(double.infinity);
final double childWidth = child.getMaxIntrinsicWidth(childHeight); final double childWidth = child.getMaxIntrinsicWidth(childHeight);
if (runHeight + childHeight > height) { if (runHeight + childHeight > height) {
width += runWidth; width += runWidth;
@ -452,7 +452,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
double width = 0.0; double width = 0.0;
RenderBox child = firstChild; RenderBox child = firstChild;
while (child != null) { while (child != null) {
width = math.max(width, child.getMinIntrinsicWidth(double.INFINITY)); width = math.max(width, child.getMinIntrinsicWidth(double.infinity));
child = childAfter(child); child = childAfter(child);
} }
return width; return width;
@ -469,7 +469,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
double width = 0.0; double width = 0.0;
RenderBox child = firstChild; RenderBox child = firstChild;
while (child != null) { while (child != null) {
width += child.getMaxIntrinsicWidth(double.INFINITY); width += child.getMaxIntrinsicWidth(double.infinity);
child = childAfter(child); child = childAfter(child);
} }
return width; return width;
@ -488,7 +488,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
double height = 0.0; double height = 0.0;
RenderBox child = firstChild; RenderBox child = firstChild;
while (child != null) { while (child != null) {
height = math.max(height, child.getMinIntrinsicHeight(double.INFINITY)); height = math.max(height, child.getMinIntrinsicHeight(double.infinity));
child = childAfter(child); child = childAfter(child);
} }
return height; return height;
@ -505,7 +505,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
double height = 0.0; double height = 0.0;
RenderBox child = firstChild; RenderBox child = firstChild;
while (child != null) { while (child != null) {
height += child.getMaxIntrinsicHeight(double.INFINITY); height += child.getMaxIntrinsicHeight(double.infinity);
child = childAfter(child); child = childAfter(child);
} }
return height; return height;

View File

@ -772,8 +772,8 @@ abstract class SchedulerBinding extends BindingBase with ServicesBinding {
} }
Duration _firstRawTimeStampInEpoch; Duration _firstRawTimeStampInEpoch;
Duration _epochStart = Duration.ZERO; Duration _epochStart = Duration.zero;
Duration _lastRawTimeStamp = Duration.ZERO; Duration _lastRawTimeStamp = Duration.zero;
/// Prepares the scheduler for a non-monotonic change to how time stamps are /// Prepares the scheduler for a non-monotonic change to how time stamps are
/// calculated. /// calculated.
@ -806,7 +806,7 @@ abstract class SchedulerBinding extends BindingBase with ServicesBinding {
/// These mechanisms together combine to ensure that the durations we give /// These mechanisms together combine to ensure that the durations we give
/// during frame callbacks are monotonically increasing. /// during frame callbacks are monotonically increasing.
Duration _adjustForEpoch(Duration rawTimeStamp) { Duration _adjustForEpoch(Duration rawTimeStamp) {
final Duration rawDurationSinceEpoch = _firstRawTimeStampInEpoch == null ? Duration.ZERO : rawTimeStamp - _firstRawTimeStampInEpoch; final Duration rawDurationSinceEpoch = _firstRawTimeStampInEpoch == null ? Duration.zero : rawTimeStamp - _firstRawTimeStampInEpoch;
return new Duration(microseconds: (rawDurationSinceEpoch.inMicroseconds / timeDilation).round() + _epochStart.inMicroseconds); return new Duration(microseconds: (rawDurationSinceEpoch.inMicroseconds / timeDilation).round() + _epochStart.inMicroseconds);
} }
@ -965,13 +965,13 @@ abstract class SchedulerBinding extends BindingBase with ServicesBinding {
if (timeStamp.inDays > 0) if (timeStamp.inDays > 0)
buffer.write('${timeStamp.inDays}d '); buffer.write('${timeStamp.inDays}d ');
if (timeStamp.inHours > 0) if (timeStamp.inHours > 0)
buffer.write('${timeStamp.inHours - timeStamp.inDays * Duration.HOURS_PER_DAY}h '); buffer.write('${timeStamp.inHours - timeStamp.inDays * Duration.hoursPerDay}h ');
if (timeStamp.inMinutes > 0) if (timeStamp.inMinutes > 0)
buffer.write('${timeStamp.inMinutes - timeStamp.inHours * Duration.MINUTES_PER_HOUR}m '); buffer.write('${timeStamp.inMinutes - timeStamp.inHours * Duration.minutesPerHour}m ');
if (timeStamp.inSeconds > 0) if (timeStamp.inSeconds > 0)
buffer.write('${timeStamp.inSeconds - timeStamp.inMinutes * Duration.SECONDS_PER_MINUTE}s '); buffer.write('${timeStamp.inSeconds - timeStamp.inMinutes * Duration.secondsPerMinute}s ');
buffer.write('${timeStamp.inMilliseconds - timeStamp.inSeconds * Duration.MILLISECONDS_PER_SECOND}'); buffer.write('${timeStamp.inMilliseconds - timeStamp.inSeconds * Duration.millisecondsPerSecond}');
final int microseconds = timeStamp.inMicroseconds - timeStamp.inMilliseconds * Duration.MICROSECONDS_PER_MILLISECOND; final int microseconds = timeStamp.inMicroseconds - timeStamp.inMilliseconds * Duration.microsecondsPerMillisecond;
if (microseconds > 0) if (microseconds > 0)
buffer.write('.${microseconds.toString().padLeft(3, "0")}'); buffer.write('.${microseconds.toString().padLeft(3, "0")}');
buffer.write('ms'); buffer.write('ms');

View File

@ -163,13 +163,13 @@ abstract class CachingAssetBundle extends AssetBundle {
if (data.lengthInBytes < 10 * 1024) { if (data.lengthInBytes < 10 * 1024) {
// 10KB takes about 3ms to parse on a Pixel 2 XL. // 10KB takes about 3ms to parse on a Pixel 2 XL.
// See: https://github.com/dart-lang/sdk/issues/31954 // See: https://github.com/dart-lang/sdk/issues/31954
return UTF8.decode(data.buffer.asUint8List()); return utf8.decode(data.buffer.asUint8List());
} }
return compute(_utf8decode, data, debugLabel: 'UTF8 decode for "$key"'); return compute(_utf8decode, data, debugLabel: 'UTF8 decode for "$key"');
} }
static String _utf8decode(ByteData data) { static String _utf8decode(ByteData data) {
return UTF8.decode(data.buffer.asUint8List()); return utf8.decode(data.buffer.asUint8List());
} }
/// Retrieve a string from the asset bundle, parse it with the given function, /// Retrieve a string from the asset bundle, parse it with the given function,
@ -223,7 +223,7 @@ abstract class CachingAssetBundle extends AssetBundle {
class PlatformAssetBundle extends CachingAssetBundle { class PlatformAssetBundle extends CachingAssetBundle {
@override @override
Future<ByteData> load(String key) async { Future<ByteData> load(String key) async {
final Uint8List encoded = UTF8.encoder.convert(new Uri(path: key).path); final Uint8List encoded = utf8.encoder.convert(new Uri(path: key).path);
final ByteData asset = final ByteData asset =
await BinaryMessages.send('flutter/assets', encoded.buffer.asByteData()); await BinaryMessages.send('flutter/assets', encoded.buffer.asByteData());
if (asset == null) if (asset == null)

View File

@ -37,14 +37,14 @@ class StringCodec implements MessageCodec<String> {
String decodeMessage(ByteData message) { String decodeMessage(ByteData message) {
if (message == null) if (message == null)
return null; return null;
return UTF8.decoder.convert(message.buffer.asUint8List()); return utf8.decoder.convert(message.buffer.asUint8List());
} }
@override @override
ByteData encodeMessage(String message) { ByteData encodeMessage(String message) {
if (message == null) if (message == null)
return null; return null;
final Uint8List encoded = UTF8.encoder.convert(message); final Uint8List encoded = utf8.encoder.convert(message);
return encoded.buffer.asByteData(); return encoded.buffer.asByteData();
} }
} }
@ -79,14 +79,14 @@ class JSONMessageCodec implements MessageCodec<dynamic> {
ByteData encodeMessage(dynamic message) { ByteData encodeMessage(dynamic message) {
if (message == null) if (message == null)
return null; return null;
return const StringCodec().encodeMessage(JSON.encode(message)); return const StringCodec().encodeMessage(json.encode(message));
} }
@override @override
dynamic decodeMessage(ByteData message) { dynamic decodeMessage(ByteData message) {
if (message == null) if (message == null)
return message; return message;
return JSON.decode(const StringCodec().decodeMessage(message)); return json.decode(const StringCodec().decodeMessage(message));
} }
} }
@ -308,7 +308,7 @@ class StandardMessageCodec implements MessageCodec<dynamic> {
buffer.putFloat64(value); buffer.putFloat64(value);
} else if (value is String) { } else if (value is String) {
buffer.putUint8(_kString); buffer.putUint8(_kString);
final List<int> bytes = UTF8.encoder.convert(value); final List<int> bytes = utf8.encoder.convert(value);
_writeSize(buffer, bytes.length); _writeSize(buffer, bytes.length);
buffer.putUint8List(bytes); buffer.putUint8List(bytes);
} else if (value is Uint8List) { } else if (value is Uint8List) {
@ -380,7 +380,7 @@ class StandardMessageCodec implements MessageCodec<dynamic> {
// 2018-01-09 and will be made unavailable. // 2018-01-09 and will be made unavailable.
// TODO(mravn): remove this case once the APIs are unavailable. // TODO(mravn): remove this case once the APIs are unavailable.
final int length = _readSize(buffer); final int length = _readSize(buffer);
final String hex = UTF8.decoder.convert(buffer.getUint8List(length)); final String hex = utf8.decoder.convert(buffer.getUint8List(length));
result = int.parse(hex, radix: 16); result = int.parse(hex, radix: 16);
break; break;
case _kFloat64: case _kFloat64:
@ -388,7 +388,7 @@ class StandardMessageCodec implements MessageCodec<dynamic> {
break; break;
case _kString: case _kString:
final int length = _readSize(buffer); final int length = _readSize(buffer);
result = UTF8.decoder.convert(buffer.getUint8List(length)); result = utf8.decoder.convert(buffer.getUint8List(length));
break; break;
case _kUint8List: case _kUint8List:
final int length = _readSize(buffer); final int length = _readSize(buffer);

View File

@ -204,20 +204,20 @@ class BannerPainter extends CustomPainter {
switch (location) { switch (location) {
case BannerLocation.bottomStart: case BannerLocation.bottomStart:
case BannerLocation.topEnd: case BannerLocation.topEnd:
return -math.PI / 4.0; return -math.pi / 4.0;
case BannerLocation.bottomEnd: case BannerLocation.bottomEnd:
case BannerLocation.topStart: case BannerLocation.topStart:
return math.PI / 4.0; return math.pi / 4.0;
} }
break; break;
case TextDirection.ltr: case TextDirection.ltr:
switch (location) { switch (location) {
case BannerLocation.bottomStart: case BannerLocation.bottomStart:
case BannerLocation.topEnd: case BannerLocation.topEnd:
return math.PI / 4.0; return math.pi / 4.0;
case BannerLocation.bottomEnd: case BannerLocation.bottomEnd:
case BannerLocation.topStart: case BannerLocation.topStart:
return -math.PI / 4.0; return -math.pi / 4.0;
} }
break; break;
} }

View File

@ -805,7 +805,7 @@ class PhysicalShape extends SingleChildRenderObjectWidget {
/// color: Colors.black, /// color: Colors.black,
/// child: new Transform( /// child: new Transform(
/// alignment: Alignment.topRight, /// alignment: Alignment.topRight,
/// transform: new Matrix4.skewY(0.3)..rotateZ(-math.PI / 12.0), /// transform: new Matrix4.skewY(0.3)..rotateZ(-math.pi / 12.0),
/// child: new Container( /// child: new Container(
/// padding: const EdgeInsets.all(8.0), /// padding: const EdgeInsets.all(8.0),
/// color: const Color(0xFFE8581C), /// color: const Color(0xFFE8581C),
@ -848,7 +848,7 @@ class Transform extends SingleChildRenderObjectWidget {
/// ///
/// ```dart /// ```dart
/// new Transform.rotate( /// new Transform.rotate(
/// angle: -math.PI / 12.0, /// angle: -math.pi / 12.0,
/// child: new Container( /// child: new Container(
/// padding: const EdgeInsets.all(8.0), /// padding: const EdgeInsets.all(8.0),
/// color: const Color(0xFFE8581C), /// color: const Color(0xFFE8581C),
@ -1549,7 +1549,7 @@ class CustomMultiChildLayout extends MultiChildRenderObjectWidget {
/// ///
/// The [new SizedBox.expand] constructor can be used to make a [SizedBox] that /// The [new SizedBox.expand] constructor can be used to make a [SizedBox] that
/// sizes itself to fit the parent. It is equivalent to setting [width] and /// sizes itself to fit the parent. It is equivalent to setting [width] and
/// [height] to [double.INFINITY]. /// [height] to [double.infinity].
/// ///
/// ## Sample code /// ## Sample code
/// ///
@ -1586,8 +1586,8 @@ class SizedBox extends SingleChildRenderObjectWidget {
/// Creates a box that will become as large as its parent allows. /// Creates a box that will become as large as its parent allows.
const SizedBox.expand({ Key key, Widget child }) const SizedBox.expand({ Key key, Widget child })
: width = double.INFINITY, : width = double.infinity,
height = double.INFINITY, height = double.infinity,
super(key: key, child: child); super(key: key, child: child);
/// Creates a box with the specified size. /// Creates a box with the specified size.
@ -1620,7 +1620,7 @@ class SizedBox extends SingleChildRenderObjectWidget {
@override @override
String toStringShort() { String toStringShort() {
final String type = (width == double.INFINITY && height == double.INFINITY) ? final String type = (width == double.infinity && height == double.infinity) ?
'$runtimeType.expand' : '$runtimeType'; '$runtimeType.expand' : '$runtimeType';
return key == null ? '$type' : '$type-$key'; return key == null ? '$type' : '$type-$key';
} }
@ -1628,7 +1628,7 @@ class SizedBox extends SingleChildRenderObjectWidget {
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description); super.debugFillProperties(description);
final DiagnosticLevel level = (width == double.INFINITY && height == double.INFINITY) final DiagnosticLevel level = (width == double.infinity && height == double.infinity)
? DiagnosticLevel.hidden ? DiagnosticLevel.hidden
: DiagnosticLevel.info; : DiagnosticLevel.info;
description.add(new DoubleProperty('width', width, defaultValue: null, level: level)); description.add(new DoubleProperty('width', width, defaultValue: null, level: level));
@ -1905,8 +1905,8 @@ class LimitedBox extends SingleChildRenderObjectWidget {
/// negative. /// negative.
const LimitedBox({ const LimitedBox({
Key key, Key key,
this.maxWidth: double.INFINITY, this.maxWidth: double.infinity,
this.maxHeight: double.INFINITY, this.maxHeight: double.infinity,
Widget child, Widget child,
}) : assert(maxWidth != null && maxWidth >= 0.0), }) : assert(maxWidth != null && maxWidth >= 0.0),
assert(maxHeight != null && maxHeight >= 0.0), assert(maxHeight != null && maxHeight >= 0.0),
@ -1938,8 +1938,8 @@ class LimitedBox extends SingleChildRenderObjectWidget {
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description); super.debugFillProperties(description);
description.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.INFINITY)); description.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.infinity));
description.add(new DoubleProperty('maxHeight', maxHeight, defaultValue: double.INFINITY)); description.add(new DoubleProperty('maxHeight', maxHeight, defaultValue: double.infinity));
} }
} }

View File

@ -971,9 +971,9 @@ class _NestedScrollPosition extends ScrollPosition implements ScrollActivityDele
// One is if the physics allow it, via applyFullDragUpdate (see below). An // One is if the physics allow it, via applyFullDragUpdate (see below). An
// overscroll situation can also be forced, e.g. if the scroll position is // overscroll situation can also be forced, e.g. if the scroll position is
// artificially set using the scroll controller. // artificially set using the scroll controller.
final double min = delta < 0.0 ? -double.INFINITY : math.min(minScrollExtent, pixels); final double min = delta < 0.0 ? -double.infinity : math.min(minScrollExtent, pixels);
// The logic for max is equivalent but on the other side. // The logic for max is equivalent but on the other side.
final double max = delta > 0.0 ? double.INFINITY : math.max(maxScrollExtent, pixels); final double max = delta > 0.0 ? double.infinity : math.max(maxScrollExtent, pixels);
final double oldPixels = pixels; final double oldPixels = pixels;
final double newPixels = (pixels - delta).clamp(min, max); final double newPixels = (pixels - delta).clamp(min, max);
final double clampedDelta = newPixels - pixels; final double clampedDelta = newPixels - pixels;

View File

@ -308,7 +308,7 @@ class _GlowController extends ChangeNotifier {
static const Duration _pullTime = const Duration(milliseconds: 167); static const Duration _pullTime = const Duration(milliseconds: 167);
static const Duration _pullHoldTime = const Duration(milliseconds: 167); static const Duration _pullHoldTime = const Duration(milliseconds: 167);
static const Duration _pullDecayTime = const Duration(milliseconds: 2000); static const Duration _pullDecayTime = const Duration(milliseconds: 2000);
static final Duration _crossAxisHalfTime = new Duration(microseconds: (Duration.MICROSECONDS_PER_SECOND / 60.0).round()); static final Duration _crossAxisHalfTime = new Duration(microseconds: (Duration.microsecondsPerSecond / 60.0).round());
static const double _maxOpacity = 0.5; static const double _maxOpacity = 0.5;
static const double _pullOpacityGlowFactor = 0.8; static const double _pullOpacityGlowFactor = 0.8;
@ -479,7 +479,7 @@ class _GlowingOverscrollIndicatorPainter extends CustomPainter {
/// The direction of the viewport. /// The direction of the viewport.
final AxisDirection axisDirection; final AxisDirection axisDirection;
static const double piOver2 = math.PI / 2.0; static const double piOver2 = math.pi / 2.0;
void _paintSide(Canvas canvas, Size size, _GlowController controller, AxisDirection axisDirection, GrowthDirection growthDirection) { void _paintSide(Canvas canvas, Size size, _GlowController controller, AxisDirection axisDirection, GrowthDirection growthDirection) {
if (controller == null) if (controller == null)

View File

@ -107,7 +107,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
AnimationController createAnimationController() { AnimationController createAnimationController() {
assert(!_transitionCompleter.isCompleted, 'Cannot reuse a $runtimeType after disposing it.'); assert(!_transitionCompleter.isCompleted, 'Cannot reuse a $runtimeType after disposing it.');
final Duration duration = transitionDuration; final Duration duration = transitionDuration;
assert(duration != null && duration >= Duration.ZERO); assert(duration != null && duration >= Duration.zero);
return new AnimationController( return new AnimationController(
duration: duration, duration: duration,
debugLabel: debugLabel, debugLabel: debugLabel,

View File

@ -574,7 +574,7 @@ class DrivenScrollActivity extends ScrollActivity {
}) : assert(from != null), }) : assert(from != null),
assert(to != null), assert(to != null),
assert(duration != null), assert(duration != null),
assert(duration > Duration.ZERO), assert(duration > Duration.zero),
assert(curve != null), assert(curve != null),
super(delegate) { super(delegate) {
_completer = new Completer<Null>(); _completer = new Completer<Null>();

View File

@ -459,7 +459,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics {
/// by just scrolling this position. /// by just scrolling this position.
Future<Null> ensureVisible(RenderObject object, { Future<Null> ensureVisible(RenderObject object, {
double alignment: 0.0, double alignment: 0.0,
Duration duration: Duration.ZERO, Duration duration: Duration.zero,
Curve curve: Curves.ease, Curve curve: Curves.ease,
}) { }) {
assert(object.attached); assert(object.attached);
@ -471,7 +471,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics {
if (target == pixels) if (target == pixels)
return new Future<Null>.value(); return new Future<Null>.value();
if (duration == Duration.ZERO) { if (duration == Duration.zero) {
jumpTo(target); jumpTo(target);
return new Future<Null>.value(); return new Future<Null>.value();
} }

View File

@ -44,10 +44,10 @@ class BouncingScrollSimulation extends Simulation {
super(tolerance: tolerance) { super(tolerance: tolerance) {
if (position < leadingExtent) { if (position < leadingExtent) {
_springSimulation = _underscrollSimulation(position, velocity); _springSimulation = _underscrollSimulation(position, velocity);
_springTime = double.NEGATIVE_INFINITY; _springTime = double.negativeInfinity;
} else if (position > trailingExtent) { } else if (position > trailingExtent) {
_springSimulation = _overscrollSimulation(position, velocity); _springSimulation = _overscrollSimulation(position, velocity);
_springTime = double.NEGATIVE_INFINITY; _springTime = double.negativeInfinity;
} else { } else {
_frictionSimulation = new FrictionSimulation(0.135, position, velocity); _frictionSimulation = new FrictionSimulation(0.135, position, velocity);
final double finalX = _frictionSimulation.finalX; final double finalX = _frictionSimulation.finalX;
@ -66,7 +66,7 @@ class BouncingScrollSimulation extends Simulation {
); );
assert(_springTime.isFinite); assert(_springTime.isFinite);
} else { } else {
_springTime = double.INFINITY; _springTime = double.infinity;
} }
} }
assert(_springTime != null); assert(_springTime != null);

View File

@ -193,7 +193,7 @@ class Scrollable extends StatefulWidget {
/// given context visible. /// given context visible.
static Future<Null> ensureVisible(BuildContext context, { static Future<Null> ensureVisible(BuildContext context, {
double alignment: 0.0, double alignment: 0.0,
Duration duration: Duration.ZERO, Duration duration: Duration.zero,
Curve curve: Curves.ease, Curve curve: Curves.ease,
}) { }) {
final List<Future<Null>> futures = <Future<Null>>[]; final List<Future<Null>> futures = <Future<Null>>[];
@ -210,7 +210,7 @@ class Scrollable extends StatefulWidget {
scrollable = Scrollable.of(context); scrollable = Scrollable.of(context);
} }
if (futures.isEmpty || duration == Duration.ZERO) if (futures.isEmpty || duration == Duration.zero)
return new Future<Null>.value(); return new Future<Null>.value();
if (futures.length == 1) if (futures.length == 1)
return futures.single; return futures.single;

View File

@ -773,7 +773,7 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
) { ) {
final int childCount = this.childCount; final int childCount = this.childCount;
if (childCount == null) if (childCount == null)
return double.INFINITY; return double.infinity;
if (lastIndex == childCount - 1) if (lastIndex == childCount - 1)
return trailingScrollOffset; return trailingScrollOffset;
final int reifiedCount = lastIndex - firstIndex + 1; final int reifiedCount = lastIndex - firstIndex + 1;

View File

@ -236,7 +236,7 @@ class RotationTransition extends AnimatedWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final double turnsValue = turns.value; final double turnsValue = turns.value;
final Matrix4 transform = new Matrix4.rotationZ(turnsValue * math.PI * 2.0); final Matrix4 transform = new Matrix4.rotationZ(turnsValue * math.pi * 2.0);
return new Transform( return new Transform(
transform: transform, transform: transform,
alignment: Alignment.center, alignment: Alignment.center,
@ -592,7 +592,7 @@ class AlignTransition extends AnimatedWidget {
/// child: new Container(width: 200.0, height: 200.0, color: Colors.green), /// child: new Container(width: 200.0, height: 200.0, color: Colors.green),
/// builder: (BuildContext context, Widget child) { /// builder: (BuildContext context, Widget child) {
/// return new Transform.rotate( /// return new Transform.rotate(
/// angle: _controller.value * 2.0 * math.PI, /// angle: _controller.value * 2.0 * math.pi,
/// child: child, /// child: child,
/// ); /// );
/// }, /// },

View File

@ -334,7 +334,7 @@ class WidgetInspectorService {
else else
throw new FlutterError('Cannot get parent chain for node of type ${value.runtimeType}'); throw new FlutterError('Cannot get parent chain for node of type ${value.runtimeType}');
return JSON.encode(path.map((_DiagnosticsPathNode node) => _pathNodeToJson(node, groupName)).toList()); return json.encode(path.map((_DiagnosticsPathNode node) => _pathNodeToJson(node, groupName)).toList());
} }
Map<String, Object> _pathNodeToJson(_DiagnosticsPathNode pathNode, String groupName) { Map<String, Object> _pathNodeToJson(_DiagnosticsPathNode pathNode, String groupName) {
@ -393,7 +393,7 @@ class WidgetInspectorService {
} }
String _serialize(DiagnosticsNode node, String groupName) { String _serialize(DiagnosticsNode node, String groupName) {
return JSON.encode(_nodeToJson(node, groupName)); return json.encode(_nodeToJson(node, groupName));
} }
List<Map<String, Object>> _nodesToJson(Iterable<DiagnosticsNode> nodes, String groupName) { List<Map<String, Object>> _nodesToJson(Iterable<DiagnosticsNode> nodes, String groupName) {
@ -406,14 +406,14 @@ class WidgetInspectorService {
/// object that `diagnosticsNodeId` references. /// object that `diagnosticsNodeId` references.
String getProperties(String diagnosticsNodeId, String groupName) { String getProperties(String diagnosticsNodeId, String groupName) {
final DiagnosticsNode node = toObject(diagnosticsNodeId); final DiagnosticsNode node = toObject(diagnosticsNodeId);
return JSON.encode(_nodesToJson(node == null ? const <DiagnosticsNode>[] : node.getProperties(), groupName)); return json.encode(_nodesToJson(node == null ? const <DiagnosticsNode>[] : node.getProperties(), groupName));
} }
/// Returns a JSON representation of the children of the [DiagnosticsNode] /// Returns a JSON representation of the children of the [DiagnosticsNode]
/// object that `diagnosticsNodeId` references. /// object that `diagnosticsNodeId` references.
String getChildren(String diagnosticsNodeId, String groupName) { String getChildren(String diagnosticsNodeId, String groupName) {
final DiagnosticsNode node = toObject(diagnosticsNodeId); final DiagnosticsNode node = toObject(diagnosticsNodeId);
return JSON.encode(_nodesToJson(node == null ? const <DiagnosticsNode>[] : node.getChildren(), groupName)); return json.encode(_nodesToJson(node == null ? const <DiagnosticsNode>[] : node.getChildren(), groupName));
} }
/// Returns a JSON representation of the [DiagnosticsNode] for the root /// Returns a JSON representation of the [DiagnosticsNode] for the root
@ -614,7 +614,7 @@ class _WidgetInspectorState extends State<WidgetInspector>
// Order matches by the size of the hit area. // Order matches by the size of the hit area.
double _area(RenderObject object) { double _area(RenderObject object) {
final Size size = object.semanticBounds?.size; final Size size = object.semanticBounds?.size;
return size == null ? double.MAX_FINITE : size.width * size.height; return size == null ? double.maxFinite : size.width * size.height;
} }
regularHits.sort((RenderObject a, RenderObject b) => _area(a).compareTo(_area(b))); regularHits.sort((RenderObject a, RenderObject b) => _area(a).compareTo(_area(b)));
final Set<RenderObject> hits = new LinkedHashSet<RenderObject>(); final Set<RenderObject> hits = new LinkedHashSet<RenderObject>();
@ -823,7 +823,7 @@ class _RenderInspectorOverlay extends RenderBox {
@override @override
void performResize() { void performResize() {
size = constraints.constrain(const Size(double.INFINITY, double.INFINITY)); size = constraints.constrain(const Size(double.infinity, double.infinity));
} }
@override @override

View File

@ -234,14 +234,14 @@ void main() {
// edges // edges
controller.forward(); controller.forward();
expect(controller.velocity, inInclusiveRange(0.4, 0.6)); expect(controller.velocity, inInclusiveRange(0.4, 0.6));
tick(Duration.ZERO); tick(Duration.zero);
expect(controller.velocity, inInclusiveRange(0.4, 0.6)); expect(controller.velocity, inInclusiveRange(0.4, 0.6));
tick(const Duration(milliseconds: 5)); tick(const Duration(milliseconds: 5));
expect(controller.velocity, inInclusiveRange(0.9, 1.1)); expect(controller.velocity, inInclusiveRange(0.9, 1.1));
controller.forward(from: 0.5); controller.forward(from: 0.5);
expect(controller.velocity, inInclusiveRange(0.4, 0.6)); expect(controller.velocity, inInclusiveRange(0.4, 0.6));
tick(Duration.ZERO); tick(Duration.zero);
expect(controller.velocity, inInclusiveRange(0.4, 0.6)); expect(controller.velocity, inInclusiveRange(0.4, 0.6));
tick(const Duration(milliseconds: 5)); tick(const Duration(milliseconds: 5));
expect(controller.velocity, inInclusiveRange(0.9, 1.1)); expect(controller.velocity, inInclusiveRange(0.9, 1.1));
@ -249,13 +249,13 @@ void main() {
// stopped // stopped
controller.forward(from: 1.0); controller.forward(from: 1.0);
expect(controller.velocity, 0.0); expect(controller.velocity, 0.0);
tick(Duration.ZERO); tick(Duration.zero);
expect(controller.velocity, 0.0); expect(controller.velocity, 0.0);
tick(const Duration(milliseconds: 500)); tick(const Duration(milliseconds: 500));
expect(controller.velocity, 0.0); expect(controller.velocity, 0.0);
controller.forward(); controller.forward();
tick(Duration.ZERO); tick(Duration.zero);
tick(const Duration(milliseconds: 1000)); tick(const Duration(milliseconds: 1000));
expect(controller.velocity, 0.0); expect(controller.velocity, 0.0);
@ -383,7 +383,7 @@ void main() {
expect(controller.value, currentValue); expect(controller.value, currentValue);
}); });
test('animateTo can deal with duration == Duration.ZERO', () { test('animateTo can deal with duration == Duration.zero', () {
final AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
vsync: const TestVSync(), vsync: const TestVSync(),
@ -391,7 +391,7 @@ void main() {
controller.forward(from: 0.2); controller.forward(from: 0.2);
expect(controller.value, 0.2); expect(controller.value, 0.2);
controller.animateTo(1.0, duration: Duration.ZERO); controller.animateTo(1.0, duration: Duration.zero);
expect(SchedulerBinding.instance.transientCallbackCount, equals(0), reason: 'Expected no animation.'); expect(SchedulerBinding.instance.transientCallbackCount, equals(0), reason: 'Expected no animation.');
expect(controller.value, 1.0); expect(controller.value, 1.0);
}); });

View File

@ -13,7 +13,7 @@ void main() {
tasks.add(1); tasks.add(1);
// Flush 0 microtasks. // Flush 0 microtasks.
await new Future<Null>.delayed(Duration.ZERO); await new Future<Null>.delayed(Duration.zero);
scheduleMicrotask(() { scheduleMicrotask(() {
tasks.add(3); tasks.add(3);
@ -25,7 +25,7 @@ void main() {
tasks.add(2); tasks.add(2);
// Flush 2 microtasks. // Flush 2 microtasks.
await new Future<Null>.delayed(Duration.ZERO); await new Future<Null>.delayed(Duration.zero);
scheduleMicrotask(() { scheduleMicrotask(() {
tasks.add(6); tasks.add(6);
@ -40,7 +40,7 @@ void main() {
tasks.add(5); tasks.add(5);
// Flush 3 microtasks. // Flush 3 microtasks.
await new Future<Null>.delayed(Duration.ZERO); await new Future<Null>.delayed(Duration.zero);
tasks.add(9); tasks.add(9);

View File

@ -51,7 +51,7 @@ enum ExampleEnum {
/// Encode and decode to JSON to make sure all objects in the JSON for the /// Encode and decode to JSON to make sure all objects in the JSON for the
/// [DiagnosticsNode] are valid JSON. /// [DiagnosticsNode] are valid JSON.
Map<String, Object> simulateJsonSerialization(DiagnosticsNode node) { Map<String, Object> simulateJsonSerialization(DiagnosticsNode node) {
return JSON.decode(JSON.encode(node.toJsonMap())); return json.decode(json.encode(node.toJsonMap()));
} }
void validateNodeJsonSerialization(DiagnosticsNode node) { void validateNodeJsonSerialization(DiagnosticsNode node) {

View File

@ -64,7 +64,7 @@ void main() {
expect(read.getInt64List(3), equals(integers)); expect(read.getInt64List(3), equals(integers));
}); });
test('of double list when unaligned', () { test('of double list when unaligned', () {
final Float64List doubles = new Float64List.fromList(<double>[3.14, double.NAN]); final Float64List doubles = new Float64List.fromList(<double>[3.14, double.nan]);
final WriteBuffer write = new WriteBuffer(); final WriteBuffer write = new WriteBuffer();
write.putUint8(9); write.putUint8(9);
write.putFloat64List(doubles); write.putFloat64List(doubles);

View File

@ -56,7 +56,7 @@ class TestServiceExtensionsBinding extends BindingBase
Future<Null> doFrame() async { Future<Null> doFrame() async {
frameScheduled = false; frameScheduled = false;
if (ui.window.onBeginFrame != null) if (ui.window.onBeginFrame != null)
ui.window.onBeginFrame(Duration.ZERO); ui.window.onBeginFrame(Duration.zero);
await flushMicrotasks(); await flushMicrotasks();
if (ui.window.onDrawFrame != null) if (ui.window.onDrawFrame != null)
ui.window.onDrawFrame(); ui.window.onDrawFrame();
@ -303,7 +303,7 @@ void main() {
completed = false; completed = false;
BinaryMessages.setMockMessageHandler('flutter/assets', (ByteData message) async { BinaryMessages.setMockMessageHandler('flutter/assets', (ByteData message) async {
expect(UTF8.decode(message.buffer.asUint8List()), 'test'); expect(utf8.decode(message.buffer.asUint8List()), 'test');
completed = true; completed = true;
return new ByteData(5); // 0x0000000000 return new ByteData(5); // 0x0000000000
}); });

View File

@ -26,16 +26,16 @@ void _tests() {
final Finder previousMonthIcon = find.byWidgetPredicate((Widget w) => w is IconButton && (w.tooltip?.startsWith('Previous month') ?? false)); final Finder previousMonthIcon = find.byWidgetPredicate((Widget w) => w is IconButton && (w.tooltip?.startsWith('Previous month') ?? false));
setUp(() { setUp(() {
firstDate = new DateTime(2001, DateTime.JANUARY, 1); firstDate = new DateTime(2001, DateTime.january, 1);
lastDate = new DateTime(2031, DateTime.DECEMBER, 31); lastDate = new DateTime(2031, DateTime.december, 31);
initialDate = new DateTime(2016, DateTime.JANUARY, 15); initialDate = new DateTime(2016, DateTime.january, 15);
selectableDayPredicate = null; selectableDayPredicate = null;
initialDatePickerMode = null; initialDatePickerMode = null;
}); });
testWidgets('tap-select a day', (WidgetTester tester) async { testWidgets('tap-select a day', (WidgetTester tester) async {
final Key _datePickerKey = new UniqueKey(); final Key _datePickerKey = new UniqueKey();
DateTime _selectedDate = new DateTime(2016, DateTime.JULY, 26); DateTime _selectedDate = new DateTime(2016, DateTime.july, 26);
await tester.pumpWidget( await tester.pumpWidget(
new MaterialApp( new MaterialApp(
@ -64,7 +64,7 @@ void _tests() {
) )
); );
expect(_selectedDate, equals(new DateTime(2016, DateTime.JULY, 26))); expect(_selectedDate, equals(new DateTime(2016, DateTime.july, 26)));
await tester.tapAt(const Offset(50.0, 100.0)); await tester.tapAt(const Offset(50.0, 100.0));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
@ -72,31 +72,31 @@ void _tests() {
await tester.tap(find.text('1')); await tester.tap(find.text('1'));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(_selectedDate, equals(new DateTime(2016, DateTime.JULY, 1))); expect(_selectedDate, equals(new DateTime(2016, DateTime.july, 1)));
await tester.tap(nextMonthIcon); await tester.tap(nextMonthIcon);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(_selectedDate, equals(new DateTime(2016, DateTime.JULY, 1))); expect(_selectedDate, equals(new DateTime(2016, DateTime.july, 1)));
await tester.tap(find.text('5')); await tester.tap(find.text('5'));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(_selectedDate, equals(new DateTime(2016, DateTime.AUGUST, 5))); expect(_selectedDate, equals(new DateTime(2016, DateTime.august, 5)));
await tester.drag(find.byKey(_datePickerKey), const Offset(-400.0, 0.0)); await tester.drag(find.byKey(_datePickerKey), const Offset(-400.0, 0.0));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(_selectedDate, equals(new DateTime(2016, DateTime.AUGUST, 5))); expect(_selectedDate, equals(new DateTime(2016, DateTime.august, 5)));
await tester.tap(find.text('25')); await tester.tap(find.text('25'));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(_selectedDate, equals(new DateTime(2016, DateTime.SEPTEMBER, 25))); expect(_selectedDate, equals(new DateTime(2016, DateTime.september, 25)));
await tester.drag(find.byKey(_datePickerKey), const Offset(800.0, 0.0)); await tester.drag(find.byKey(_datePickerKey), const Offset(800.0, 0.0));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(_selectedDate, equals(new DateTime(2016, DateTime.SEPTEMBER, 25))); expect(_selectedDate, equals(new DateTime(2016, DateTime.september, 25)));
await tester.tap(find.text('17')); await tester.tap(find.text('17'));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(_selectedDate, equals(new DateTime(2016, DateTime.AUGUST, 17))); expect(_selectedDate, equals(new DateTime(2016, DateTime.august, 17)));
}); });
testWidgets('render picker with intrinsic dimensions', (WidgetTester tester) async { testWidgets('render picker with intrinsic dimensions', (WidgetTester tester) async {
@ -112,7 +112,7 @@ void _tests() {
firstDate: new DateTime(0), firstDate: new DateTime(0),
lastDate: new DateTime(9999), lastDate: new DateTime(9999),
onChanged: (DateTime value) { }, onChanged: (DateTime value) { },
selectedDate: new DateTime(2000, DateTime.JANUARY, 1), selectedDate: new DateTime(2000, DateTime.january, 1),
), ),
), ),
), ),
@ -172,7 +172,7 @@ void _tests() {
testWidgets('Initial date is the default', (WidgetTester tester) async { testWidgets('Initial date is the default', (WidgetTester tester) async {
await preparePicker(tester, (Future<DateTime> date) async { await preparePicker(tester, (Future<DateTime> date) async {
await tester.tap(find.text('OK')); await tester.tap(find.text('OK'));
expect(await date, equals(new DateTime(2016, DateTime.JANUARY, 15))); expect(await date, equals(new DateTime(2016, DateTime.january, 15)));
}); });
}); });
@ -187,7 +187,7 @@ void _tests() {
await preparePicker(tester, (Future<DateTime> date) async { await preparePicker(tester, (Future<DateTime> date) async {
await tester.tap(find.text('12')); await tester.tap(find.text('12'));
await tester.tap(find.text('OK')); await tester.tap(find.text('OK'));
expect(await date, equals(new DateTime(2016, DateTime.JANUARY, 12))); expect(await date, equals(new DateTime(2016, DateTime.january, 12)));
}); });
}); });
@ -197,7 +197,7 @@ void _tests() {
await tester.pumpAndSettle(const Duration(seconds: 1)); await tester.pumpAndSettle(const Duration(seconds: 1));
await tester.tap(find.text('25')); await tester.tap(find.text('25'));
await tester.tap(find.text('OK')); await tester.tap(find.text('OK'));
expect(await date, equals(new DateTime(2015, DateTime.DECEMBER, 25))); expect(await date, equals(new DateTime(2015, DateTime.december, 25)));
}); });
}); });
@ -207,7 +207,7 @@ void _tests() {
await tester.pump(); await tester.pump();
await tester.tap(find.text('2018')); await tester.tap(find.text('2018'));
await tester.tap(find.text('OK')); await tester.tap(find.text('OK'));
expect(await date, equals(new DateTime(2018, DateTime.JANUARY, 15))); expect(await date, equals(new DateTime(2018, DateTime.january, 15)));
}); });
}); });
@ -220,12 +220,12 @@ void _tests() {
final MaterialLocalizations localizations = MaterialLocalizations.of( final MaterialLocalizations localizations = MaterialLocalizations.of(
tester.element(find.byType(DayPicker)) tester.element(find.byType(DayPicker))
); );
final String dayLabel = localizations.formatMediumDate(new DateTime(2017, DateTime.JANUARY, 15)); final String dayLabel = localizations.formatMediumDate(new DateTime(2017, DateTime.january, 15));
await tester.tap(find.text(dayLabel)); await tester.tap(find.text(dayLabel));
await tester.pump(); await tester.pump();
await tester.tap(find.text('19')); await tester.tap(find.text('19'));
await tester.tap(find.text('OK')); await tester.tap(find.text('OK'));
expect(await date, equals(new DateTime(2017, DateTime.JANUARY, 19))); expect(await date, equals(new DateTime(2017, DateTime.january, 19)));
}); });
}); });
@ -241,7 +241,7 @@ void _tests() {
}); });
testWidgets('Cannot select a day outside bounds', (WidgetTester tester) async { testWidgets('Cannot select a day outside bounds', (WidgetTester tester) async {
initialDate = new DateTime(2017, DateTime.JANUARY, 15); initialDate = new DateTime(2017, DateTime.january, 15);
firstDate = initialDate; firstDate = initialDate;
lastDate = initialDate; lastDate = initialDate;
await preparePicker(tester, (Future<DateTime> date) async { await preparePicker(tester, (Future<DateTime> date) async {
@ -254,9 +254,9 @@ void _tests() {
}); });
testWidgets('Cannot select a month past last date', (WidgetTester tester) async { testWidgets('Cannot select a month past last date', (WidgetTester tester) async {
initialDate = new DateTime(2017, DateTime.JANUARY, 15); initialDate = new DateTime(2017, DateTime.january, 15);
firstDate = initialDate; firstDate = initialDate;
lastDate = new DateTime(2017, DateTime.FEBRUARY, 20); lastDate = new DateTime(2017, DateTime.february, 20);
await preparePicker(tester, (Future<DateTime> date) async { await preparePicker(tester, (Future<DateTime> date) async {
await tester.tap(nextMonthIcon); await tester.tap(nextMonthIcon);
await tester.pumpAndSettle(const Duration(seconds: 1)); await tester.pumpAndSettle(const Duration(seconds: 1));
@ -266,8 +266,8 @@ void _tests() {
}); });
testWidgets('Cannot select a month before first date', (WidgetTester tester) async { testWidgets('Cannot select a month before first date', (WidgetTester tester) async {
initialDate = new DateTime(2017, DateTime.JANUARY, 15); initialDate = new DateTime(2017, DateTime.january, 15);
firstDate = new DateTime(2016, DateTime.DECEMBER, 10); firstDate = new DateTime(2016, DateTime.december, 10);
lastDate = initialDate; lastDate = initialDate;
await preparePicker(tester, (Future<DateTime> date) async { await preparePicker(tester, (Future<DateTime> date) async {
await tester.tap(previousMonthIcon); await tester.tap(previousMonthIcon);
@ -278,21 +278,21 @@ void _tests() {
}); });
testWidgets('Only predicate days are selectable', (WidgetTester tester) async { testWidgets('Only predicate days are selectable', (WidgetTester tester) async {
initialDate = new DateTime(2017, DateTime.JANUARY, 16); initialDate = new DateTime(2017, DateTime.january, 16);
firstDate = new DateTime(2017, DateTime.JANUARY, 10); firstDate = new DateTime(2017, DateTime.january, 10);
lastDate = new DateTime(2017, DateTime.JANUARY, 20); lastDate = new DateTime(2017, DateTime.january, 20);
selectableDayPredicate = (DateTime day) => day.day.isEven; selectableDayPredicate = (DateTime day) => day.day.isEven;
await preparePicker(tester, (Future<DateTime> date) async { await preparePicker(tester, (Future<DateTime> date) async {
await tester.tap(find.text('10')); // Even, works. await tester.tap(find.text('10')); // Even, works.
await tester.tap(find.text('13')); // Odd, doesn't work. await tester.tap(find.text('13')); // Odd, doesn't work.
await tester.tap(find.text('17')); // Odd, doesn't work. await tester.tap(find.text('17')); // Odd, doesn't work.
await tester.tap(find.text('OK')); await tester.tap(find.text('OK'));
expect(await date, equals(new DateTime(2017, DateTime.JANUARY, 10))); expect(await date, equals(new DateTime(2017, DateTime.january, 10)));
}); });
}); });
testWidgets('Can select initial date picker mode', (WidgetTester tester) async { testWidgets('Can select initial date picker mode', (WidgetTester tester) async {
initialDate = new DateTime(2014, DateTime.JANUARY, 15); initialDate = new DateTime(2014, DateTime.january, 15);
initialDatePickerMode = DatePickerMode.year; initialDatePickerMode = DatePickerMode.year;
await preparePicker(tester, (Future<DateTime> date) async { await preparePicker(tester, (Future<DateTime> date) async {
await tester.pump(); await tester.pump();
@ -300,7 +300,7 @@ void _tests() {
// The initial current year is 2014. // The initial current year is 2014.
await tester.tap(find.text('2018')); await tester.tap(find.text('2018'));
await tester.tap(find.text('OK')); await tester.tap(find.text('OK'));
expect(await date, equals(new DateTime(2018, DateTime.JANUARY, 15))); expect(await date, equals(new DateTime(2018, DateTime.january, 15)));
}); });
}); });
@ -310,9 +310,9 @@ void _tests() {
setUp(() { setUp(() {
feedback = new FeedbackTester(); feedback = new FeedbackTester();
initialDate = new DateTime(2017, DateTime.JANUARY, 16); initialDate = new DateTime(2017, DateTime.january, 16);
firstDate = new DateTime(2017, DateTime.JANUARY, 10); firstDate = new DateTime(2017, DateTime.january, 10);
lastDate = new DateTime(2018, DateTime.JANUARY, 20); lastDate = new DateTime(2018, DateTime.january, 20);
selectableDayPredicate = (DateTime date) => date.day.isEven; selectableDayPredicate = (DateTime date) => date.day.isEven;
}); });

View File

@ -403,7 +403,7 @@ bool pathDoesNotContainCircle(Path path, Rect circleBounds) {
assert(circleBounds.width == circleBounds.height); assert(circleBounds.width == circleBounds.height);
final double radius = circleBounds.width / 2.0; final double radius = circleBounds.width / 2.0;
for (double theta = 0.0; theta <= 2.0 * math.PI; theta += math.PI / 20.0) { for (double theta = 0.0; theta <= 2.0 * math.pi; theta += math.pi / 20.0) {
for (double i = 0.0; i < 1; i += 0.01) { for (double i = 0.0; i < 1; i += 0.01) {
final double x = i * radius * math.cos(theta); final double x = i * radius * math.cos(theta);
final double y = i * radius * math.sin(theta); final double y = i * radius * math.sin(theta);

View File

@ -670,8 +670,8 @@ void main() {
child: const Material( child: const Material(
child: const Center( child: const Center(
child: const OverflowBox( child: const OverflowBox(
maxWidth: double.INFINITY, maxWidth: double.infinity,
maxHeight: double.INFINITY, maxHeight: double.infinity,
child: const Slider( child: const Slider(
value: 0.5, value: 0.5,
onChanged: null, onChanged: null,
@ -706,8 +706,8 @@ void main() {
), ),
child: new Center( child: new Center(
child: new OverflowBox( child: new OverflowBox(
maxWidth: double.INFINITY, maxWidth: double.infinity,
maxHeight: double.INFINITY, maxHeight: double.infinity,
child: new Slider( child: new Slider(
key: sliderKey, key: sliderKey,
min: 0.0, min: 0.0,

View File

@ -25,8 +25,8 @@ void main() {
expect(friction.timeAtX(friction.x(0.5)), closeTo(0.5, _kEpsilon)); expect(friction.timeAtX(friction.x(0.5)), closeTo(0.5, _kEpsilon));
expect(friction.timeAtX(friction.x(2.0)), closeTo(2.0, _kEpsilon)); expect(friction.timeAtX(friction.x(2.0)), closeTo(2.0, _kEpsilon));
expect(friction.timeAtX(-1.0), double.INFINITY); expect(friction.timeAtX(-1.0), double.infinity);
expect(friction.timeAtX(200.0), double.INFINITY); expect(friction.timeAtX(200.0), double.infinity);
}); });
test('Friction simulation negative velocity', () { test('Friction simulation negative velocity', () {
@ -46,7 +46,7 @@ void main() {
expect(friction.timeAtX(friction.x(0.5)), closeTo(0.5, _kEpsilon)); expect(friction.timeAtX(friction.x(0.5)), closeTo(0.5, _kEpsilon));
expect(friction.timeAtX(friction.x(2.0)), closeTo(2.0, _kEpsilon)); expect(friction.timeAtX(friction.x(2.0)), closeTo(2.0, _kEpsilon));
expect(friction.timeAtX(101.0), double.INFINITY); expect(friction.timeAtX(101.0), double.infinity);
expect(friction.timeAtX(40.0), double.INFINITY); expect(friction.timeAtX(40.0), double.infinity);
}); });
} }

View File

@ -239,7 +239,7 @@ void main() {
position: 100.0, position: 100.0,
velocity: 400.0, velocity: 400.0,
leadingExtent: 0.0, leadingExtent: 0.0,
trailingExtent: double.INFINITY, trailingExtent: double.infinity,
spring: spring, spring: spring,
); );
scroll.tolerance = const Tolerance(velocity: 1.0); scroll.tolerance = const Tolerance(velocity: 1.0);

View File

@ -23,10 +23,10 @@ void main() {
expect(box.getMaxIntrinsicHeight(200.0), 100.0); expect(box.getMaxIntrinsicHeight(200.0), 100.0);
expect(box.getMaxIntrinsicHeight(400.0), 200.0); expect(box.getMaxIntrinsicHeight(400.0), 200.0);
expect(box.getMinIntrinsicWidth(double.INFINITY), 0.0); expect(box.getMinIntrinsicWidth(double.infinity), 0.0);
expect(box.getMaxIntrinsicWidth(double.INFINITY), 0.0); expect(box.getMaxIntrinsicWidth(double.infinity), 0.0);
expect(box.getMinIntrinsicHeight(double.INFINITY), 0.0); expect(box.getMinIntrinsicHeight(double.infinity), 0.0);
expect(box.getMaxIntrinsicHeight(double.INFINITY), 0.0); expect(box.getMaxIntrinsicHeight(double.infinity), 0.0);
}); });
test('RenderAspectRatio: Intrinsic sizing 0.5', () { test('RenderAspectRatio: Intrinsic sizing 0.5', () {
@ -44,10 +44,10 @@ void main() {
expect(box.getMaxIntrinsicHeight(200.0), 400.0); expect(box.getMaxIntrinsicHeight(200.0), 400.0);
expect(box.getMaxIntrinsicHeight(400.0), 800.0); expect(box.getMaxIntrinsicHeight(400.0), 800.0);
expect(box.getMinIntrinsicWidth(double.INFINITY), 0.0); expect(box.getMinIntrinsicWidth(double.infinity), 0.0);
expect(box.getMaxIntrinsicWidth(double.INFINITY), 0.0); expect(box.getMaxIntrinsicWidth(double.infinity), 0.0);
expect(box.getMinIntrinsicHeight(double.INFINITY), 0.0); expect(box.getMinIntrinsicHeight(double.infinity), 0.0);
expect(box.getMaxIntrinsicHeight(double.INFINITY), 0.0); expect(box.getMaxIntrinsicHeight(double.infinity), 0.0);
}); });
test('RenderAspectRatio: Intrinsic sizing 2.0', () { test('RenderAspectRatio: Intrinsic sizing 2.0', () {
@ -68,10 +68,10 @@ void main() {
expect(box.getMaxIntrinsicHeight(200.0), 100.0); expect(box.getMaxIntrinsicHeight(200.0), 100.0);
expect(box.getMaxIntrinsicHeight(400.0), 200.0); expect(box.getMaxIntrinsicHeight(400.0), 200.0);
expect(box.getMinIntrinsicWidth(double.INFINITY), 90.0); expect(box.getMinIntrinsicWidth(double.infinity), 90.0);
expect(box.getMaxIntrinsicWidth(double.INFINITY), 90.0); expect(box.getMaxIntrinsicWidth(double.infinity), 90.0);
expect(box.getMinIntrinsicHeight(double.INFINITY), 70.0); expect(box.getMinIntrinsicHeight(double.infinity), 70.0);
expect(box.getMaxIntrinsicHeight(double.INFINITY), 70.0); expect(box.getMaxIntrinsicHeight(double.infinity), 70.0);
}); });
test('RenderAspectRatio: Intrinsic sizing 0.5', () { test('RenderAspectRatio: Intrinsic sizing 0.5', () {
@ -92,10 +92,10 @@ void main() {
expect(box.getMaxIntrinsicHeight(200.0), 400.0); expect(box.getMaxIntrinsicHeight(200.0), 400.0);
expect(box.getMaxIntrinsicHeight(400.0), 800.0); expect(box.getMaxIntrinsicHeight(400.0), 800.0);
expect(box.getMinIntrinsicWidth(double.INFINITY), 90.0); expect(box.getMinIntrinsicWidth(double.infinity), 90.0);
expect(box.getMaxIntrinsicWidth(double.INFINITY), 90.0); expect(box.getMaxIntrinsicWidth(double.infinity), 90.0);
expect(box.getMinIntrinsicHeight(double.INFINITY), 70.0); expect(box.getMinIntrinsicHeight(double.infinity), 70.0);
expect(box.getMaxIntrinsicHeight(double.INFINITY), 70.0); expect(box.getMaxIntrinsicHeight(double.infinity), 70.0);
}); });
test('RenderAspectRatio: Unbounded', () { test('RenderAspectRatio: Unbounded', () {
@ -105,8 +105,8 @@ void main() {
hadError = true; hadError = true;
}; };
final RenderBox box = new RenderConstrainedOverflowBox( final RenderBox box = new RenderConstrainedOverflowBox(
maxWidth: double.INFINITY, maxWidth: double.infinity,
maxHeight: double.INFINITY, maxHeight: double.infinity,
child: new RenderAspectRatio( child: new RenderAspectRatio(
aspectRatio: 0.5, aspectRatio: 0.5,
child: new RenderSizedBox(const Size(90.0, 70.0)) child: new RenderSizedBox(const Size(90.0, 70.0))
@ -139,13 +139,13 @@ void main() {
pumpFrame(); pumpFrame();
expect(inside.size, const Size(90.0, 90.0)); expect(inside.size, const Size(90.0, 90.0));
outside.maxWidth = double.INFINITY; outside.maxWidth = double.infinity;
outside.maxHeight = 90.0; outside.maxHeight = 90.0;
pumpFrame(); pumpFrame();
expect(inside.size, const Size(90.0, 90.0)); expect(inside.size, const Size(90.0, 90.0));
outside.maxWidth = 90.0; outside.maxWidth = 90.0;
outside.maxHeight = double.INFINITY; outside.maxHeight = double.infinity;
pumpFrame(); pumpFrame();
expect(inside.size, const Size(90.0, 90.0)); expect(inside.size, const Size(90.0, 90.0));
@ -161,13 +161,13 @@ void main() {
pumpFrame(); pumpFrame();
expect(inside.size, const Size(90.0, 45.0)); expect(inside.size, const Size(90.0, 45.0));
outside.maxWidth = double.INFINITY; outside.maxWidth = double.infinity;
outside.maxHeight = 90.0; outside.maxHeight = 90.0;
pumpFrame(); pumpFrame();
expect(inside.size, const Size(180.0, 90.0)); expect(inside.size, const Size(180.0, 90.0));
outside.maxWidth = 90.0; outside.maxWidth = 90.0;
outside.maxHeight = double.INFINITY; outside.maxHeight = double.infinity;
pumpFrame(); pumpFrame();
expect(inside.size, const Size(90.0, 45.0)); expect(inside.size, const Size(90.0, 45.0));
@ -184,13 +184,13 @@ void main() {
pumpFrame(); pumpFrame();
expect(inside.size, const Size(90.0, 80.0)); expect(inside.size, const Size(90.0, 80.0));
outside.maxWidth = double.INFINITY; outside.maxWidth = double.infinity;
outside.maxHeight = 90.0; outside.maxHeight = 90.0;
pumpFrame(); pumpFrame();
expect(inside.size, const Size(180.0, 90.0)); expect(inside.size, const Size(180.0, 90.0));
outside.maxWidth = 90.0; outside.maxWidth = 90.0;
outside.maxHeight = double.INFINITY; outside.maxHeight = double.infinity;
pumpFrame(); pumpFrame();
expect(inside.size, const Size(90.0, 80.0)); expect(inside.size, const Size(90.0, 80.0));
}); });

View File

@ -92,20 +92,20 @@ void main() {
test('BoxConstraints lerp with unbounded width', () { test('BoxConstraints lerp with unbounded width', () {
const BoxConstraints constraints1 = const BoxConstraints( const BoxConstraints constraints1 = const BoxConstraints(
minWidth: double.INFINITY, minWidth: double.infinity,
maxWidth: double.INFINITY, maxWidth: double.infinity,
minHeight: 10.0, minHeight: 10.0,
maxHeight: 20.0, maxHeight: 20.0,
); );
const BoxConstraints constraints2 = const BoxConstraints( const BoxConstraints constraints2 = const BoxConstraints(
minWidth: double.INFINITY, minWidth: double.infinity,
maxWidth: double.INFINITY, maxWidth: double.infinity,
minHeight: 20.0, minHeight: 20.0,
maxHeight: 30.0, maxHeight: 30.0,
); );
const BoxConstraints constraints3 = const BoxConstraints( const BoxConstraints constraints3 = const BoxConstraints(
minWidth: double.INFINITY, minWidth: double.infinity,
maxWidth: double.INFINITY, maxWidth: double.infinity,
minHeight: 15.0, minHeight: 15.0,
maxHeight: 25.0, maxHeight: 25.0,
); );
@ -116,40 +116,40 @@ void main() {
const BoxConstraints constraints1 = const BoxConstraints( const BoxConstraints constraints1 = const BoxConstraints(
minWidth: 10.0, minWidth: 10.0,
maxWidth: 20.0, maxWidth: 20.0,
minHeight: double.INFINITY, minHeight: double.infinity,
maxHeight: double.INFINITY, maxHeight: double.infinity,
); );
const BoxConstraints constraints2 = const BoxConstraints( const BoxConstraints constraints2 = const BoxConstraints(
minWidth: 20.0, minWidth: 20.0,
maxWidth: 30.0, maxWidth: 30.0,
minHeight: double.INFINITY, minHeight: double.infinity,
maxHeight: double.INFINITY, maxHeight: double.infinity,
); );
const BoxConstraints constraints3 = const BoxConstraints( const BoxConstraints constraints3 = const BoxConstraints(
minWidth: 15.0, minWidth: 15.0,
maxWidth: 25.0, maxWidth: 25.0,
minHeight: double.INFINITY, minHeight: double.infinity,
maxHeight: double.INFINITY, maxHeight: double.infinity,
); );
expect(BoxConstraints.lerp(constraints1, constraints2, 0.5), constraints3); expect(BoxConstraints.lerp(constraints1, constraints2, 0.5), constraints3);
}); });
test('BoxConstraints lerp from bounded to unbounded', () { test('BoxConstraints lerp from bounded to unbounded', () {
const BoxConstraints constraints1 = const BoxConstraints( const BoxConstraints constraints1 = const BoxConstraints(
minWidth: double.INFINITY, minWidth: double.infinity,
maxWidth: double.INFINITY, maxWidth: double.infinity,
minHeight: double.INFINITY, minHeight: double.infinity,
maxHeight: double.INFINITY, maxHeight: double.infinity,
); );
const BoxConstraints constraints2 = const BoxConstraints( const BoxConstraints constraints2 = const BoxConstraints(
minWidth: 20.0, minWidth: 20.0,
maxWidth: 30.0, maxWidth: 30.0,
minHeight: double.INFINITY, minHeight: double.infinity,
maxHeight: double.INFINITY, maxHeight: double.infinity,
); );
const BoxConstraints constraints3 = const BoxConstraints( const BoxConstraints constraints3 = const BoxConstraints(
minWidth: double.INFINITY, minWidth: double.infinity,
maxWidth: double.INFINITY, maxWidth: double.infinity,
minHeight: 20.0, minHeight: 20.0,
maxHeight: 30.0, maxHeight: 30.0,
); );

View File

@ -36,7 +36,7 @@ void main() {
result = 'no exception'; result = 'no exception';
try { try {
const BoxConstraints constraints = const BoxConstraints(minWidth: double.NAN, maxWidth: double.NAN, minHeight: 2.0, maxHeight: double.NAN); const BoxConstraints constraints = const BoxConstraints(minWidth: double.nan, maxWidth: double.nan, minHeight: 2.0, maxHeight: double.nan);
assert(constraints.debugAssertIsValid()); assert(constraints.debugAssertIsValid());
} on FlutterError catch (e) { } on FlutterError catch (e) {
result = '$e'; result = '$e';
@ -49,7 +49,7 @@ void main() {
result = 'no exception'; result = 'no exception';
try { try {
const BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN); const BoxConstraints constraints = const BoxConstraints(minHeight: double.nan);
assert(constraints.debugAssertIsValid()); assert(constraints.debugAssertIsValid());
} on FlutterError catch (e) { } on FlutterError catch (e) {
result = '$e'; result = '$e';
@ -62,7 +62,7 @@ void main() {
result = 'no exception'; result = 'no exception';
try { try {
const BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN, maxWidth: 0.0/0.0); const BoxConstraints constraints = const BoxConstraints(minHeight: double.nan, maxWidth: 0.0/0.0);
assert(constraints.debugAssertIsValid()); assert(constraints.debugAssertIsValid());
} on FlutterError catch (e) { } on FlutterError catch (e) {
result = '$e'; result = '$e';

View File

@ -50,8 +50,8 @@ class RenderIntrinsicSize extends RenderProxyBox {
void performLayout() { void performLayout() {
child.layout(constraints); child.layout(constraints);
size = new Size( size = new Size(
child.getMinIntrinsicWidth(double.INFINITY), child.getMinIntrinsicWidth(double.infinity),
child.getMinIntrinsicHeight(double.INFINITY) child.getMinIntrinsicHeight(double.infinity)
); );
} }
} }

View File

@ -16,10 +16,10 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
offset: new ViewportOffset.zero(), offset: new ViewportOffset.zero(),
); );
expect(editable.getMinIntrinsicWidth(double.INFINITY), 50.0); expect(editable.getMinIntrinsicWidth(double.infinity), 50.0);
expect(editable.getMaxIntrinsicWidth(double.INFINITY), 50.0); expect(editable.getMaxIntrinsicWidth(double.infinity), 50.0);
expect(editable.getMinIntrinsicHeight(double.INFINITY), 10.0); expect(editable.getMinIntrinsicHeight(double.infinity), 10.0);
expect(editable.getMaxIntrinsicHeight(double.INFINITY), 10.0); expect(editable.getMaxIntrinsicHeight(double.infinity), 10.0);
expect( expect(
editable.toStringDeep(minLevel: DiagnosticLevel.info), editable.toStringDeep(minLevel: DiagnosticLevel.info),

View File

@ -302,7 +302,7 @@ void main() {
); );
final RenderConstrainedOverflowBox parent = new RenderConstrainedOverflowBox( final RenderConstrainedOverflowBox parent = new RenderConstrainedOverflowBox(
minWidth: 0.0, minWidth: 0.0,
maxWidth: double.INFINITY, maxWidth: double.infinity,
minHeight: 0.0, minHeight: 0.0,
maxHeight: 400.0, maxHeight: 400.0,
child: flex, child: flex,
@ -347,7 +347,7 @@ void main() {
); );
final RenderConstrainedOverflowBox parent = new RenderConstrainedOverflowBox( final RenderConstrainedOverflowBox parent = new RenderConstrainedOverflowBox(
minWidth: 0.0, minWidth: 0.0,
maxWidth: double.INFINITY, maxWidth: double.infinity,
minHeight: 0.0, minHeight: 0.0,
maxHeight: 400.0, maxHeight: 400.0,
child: flex, child: flex,
@ -376,7 +376,7 @@ void main() {
); );
final RenderConstrainedOverflowBox parent = new RenderConstrainedOverflowBox( final RenderConstrainedOverflowBox parent = new RenderConstrainedOverflowBox(
minWidth: 0.0, minWidth: 0.0,
maxWidth: double.INFINITY, maxWidth: double.infinity,
minHeight: 0.0, minHeight: 0.0,
maxHeight: 400.0, maxHeight: 400.0,
child: flex, child: flex,

View File

@ -73,10 +73,10 @@ void main() {
expect(parent.getMinIntrinsicHeight(80.0), equals(20.0)); expect(parent.getMinIntrinsicHeight(80.0), equals(20.0));
expect(parent.getMaxIntrinsicHeight(80.0), equals(200.0)); expect(parent.getMaxIntrinsicHeight(80.0), equals(200.0));
expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(100.0)); expect(parent.getMinIntrinsicWidth(double.infinity), equals(100.0));
expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(100.0)); expect(parent.getMaxIntrinsicWidth(double.infinity), equals(100.0));
expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(20.0)); expect(parent.getMinIntrinsicHeight(double.infinity), equals(20.0));
expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(200.0)); expect(parent.getMaxIntrinsicHeight(double.infinity), equals(200.0));
}); });
test('IntrinsicWidth without a child', () { test('IntrinsicWidth without a child', () {
@ -107,10 +107,10 @@ void main() {
expect(parent.getMinIntrinsicHeight(80.0), equals(0.0)); expect(parent.getMinIntrinsicHeight(80.0), equals(0.0));
expect(parent.getMaxIntrinsicHeight(80.0), equals(0.0)); expect(parent.getMaxIntrinsicHeight(80.0), equals(0.0));
expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(0.0)); expect(parent.getMinIntrinsicWidth(double.infinity), equals(0.0));
expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(0.0)); expect(parent.getMaxIntrinsicWidth(double.infinity), equals(0.0));
expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(0.0)); expect(parent.getMinIntrinsicHeight(double.infinity), equals(0.0));
expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(0.0)); expect(parent.getMaxIntrinsicHeight(double.infinity), equals(0.0));
}); });
test('Shrink-wrapping width (stepped width)', () { test('Shrink-wrapping width (stepped width)', () {
@ -142,10 +142,10 @@ void main() {
expect(parent.getMinIntrinsicHeight(80.0), equals(20.0)); expect(parent.getMinIntrinsicHeight(80.0), equals(20.0));
expect(parent.getMaxIntrinsicHeight(80.0), equals(200.0)); expect(parent.getMaxIntrinsicHeight(80.0), equals(200.0));
expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(3.0 * 47.0)); expect(parent.getMinIntrinsicWidth(double.infinity), equals(3.0 * 47.0));
expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(3.0 * 47.0)); expect(parent.getMaxIntrinsicWidth(double.infinity), equals(3.0 * 47.0));
expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(20.0)); expect(parent.getMinIntrinsicHeight(double.infinity), equals(20.0));
expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(200.0)); expect(parent.getMaxIntrinsicHeight(double.infinity), equals(200.0));
}); });
test('Shrink-wrapping width (stepped height)', () { test('Shrink-wrapping width (stepped height)', () {
@ -177,10 +177,10 @@ void main() {
expect(parent.getMinIntrinsicHeight(80.0), equals(1.0 * 47.0)); expect(parent.getMinIntrinsicHeight(80.0), equals(1.0 * 47.0));
expect(parent.getMaxIntrinsicHeight(80.0), equals(5.0 * 47.0)); expect(parent.getMaxIntrinsicHeight(80.0), equals(5.0 * 47.0));
expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(100.0)); expect(parent.getMinIntrinsicWidth(double.infinity), equals(100.0));
expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(100.0)); expect(parent.getMaxIntrinsicWidth(double.infinity), equals(100.0));
expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(1.0 * 47.0)); expect(parent.getMinIntrinsicHeight(double.infinity), equals(1.0 * 47.0));
expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(5.0 * 47.0)); expect(parent.getMaxIntrinsicHeight(double.infinity), equals(5.0 * 47.0));
}); });
test('Shrink-wrapping width (stepped everything)', () { test('Shrink-wrapping width (stepped everything)', () {
@ -212,10 +212,10 @@ void main() {
expect(parent.getMinIntrinsicHeight(80.0), equals(1.0 * 47.0)); expect(parent.getMinIntrinsicHeight(80.0), equals(1.0 * 47.0));
expect(parent.getMaxIntrinsicHeight(80.0), equals(5.0 * 47.0)); expect(parent.getMaxIntrinsicHeight(80.0), equals(5.0 * 47.0));
expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(3.0 * 37.0)); expect(parent.getMinIntrinsicWidth(double.infinity), equals(3.0 * 37.0));
expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(3.0 * 37.0)); expect(parent.getMaxIntrinsicWidth(double.infinity), equals(3.0 * 37.0));
expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(1.0 * 47.0)); expect(parent.getMinIntrinsicHeight(double.infinity), equals(1.0 * 47.0));
expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(5.0 * 47.0)); expect(parent.getMaxIntrinsicHeight(double.infinity), equals(5.0 * 47.0));
}); });
test('Shrink-wrapping height', () { test('Shrink-wrapping height', () {
@ -247,10 +247,10 @@ void main() {
expect(parent.getMinIntrinsicHeight(80.0), equals(200.0)); expect(parent.getMinIntrinsicHeight(80.0), equals(200.0));
expect(parent.getMaxIntrinsicHeight(80.0), equals(200.0)); expect(parent.getMaxIntrinsicHeight(80.0), equals(200.0));
expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(10.0)); expect(parent.getMinIntrinsicWidth(double.infinity), equals(10.0));
expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(100.0)); expect(parent.getMaxIntrinsicWidth(double.infinity), equals(100.0));
expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(200.0)); expect(parent.getMinIntrinsicHeight(double.infinity), equals(200.0));
expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(200.0)); expect(parent.getMaxIntrinsicHeight(double.infinity), equals(200.0));
}); });
test('IntrinsicHeight without a child', () { test('IntrinsicHeight without a child', () {
@ -281,10 +281,10 @@ void main() {
expect(parent.getMinIntrinsicHeight(80.0), equals(0.0)); expect(parent.getMinIntrinsicHeight(80.0), equals(0.0));
expect(parent.getMaxIntrinsicHeight(80.0), equals(0.0)); expect(parent.getMaxIntrinsicHeight(80.0), equals(0.0));
expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(0.0)); expect(parent.getMinIntrinsicWidth(double.infinity), equals(0.0));
expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(0.0)); expect(parent.getMaxIntrinsicWidth(double.infinity), equals(0.0));
expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(0.0)); expect(parent.getMinIntrinsicHeight(double.infinity), equals(0.0));
expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(0.0)); expect(parent.getMaxIntrinsicHeight(double.infinity), equals(0.0));
}); });
test('Padding and boring intrinsics', () { test('Padding and boring intrinsics', () {
@ -308,10 +308,10 @@ void main() {
expect(box.getMinIntrinsicHeight(80.0), 50.0); expect(box.getMinIntrinsicHeight(80.0), 50.0);
expect(box.getMaxIntrinsicHeight(80.0), 50.0); expect(box.getMaxIntrinsicHeight(80.0), 50.0);
expect(box.getMinIntrinsicWidth(double.INFINITY), 50.0); expect(box.getMinIntrinsicWidth(double.infinity), 50.0);
expect(box.getMaxIntrinsicWidth(double.INFINITY), 50.0); expect(box.getMaxIntrinsicWidth(double.infinity), 50.0);
expect(box.getMinIntrinsicHeight(double.INFINITY), 50.0); expect(box.getMinIntrinsicHeight(double.infinity), 50.0);
expect(box.getMaxIntrinsicHeight(double.INFINITY), 50.0); expect(box.getMaxIntrinsicHeight(double.infinity), 50.0);
// also a smoke test: // also a smoke test:
layout( layout(
@ -346,10 +346,10 @@ void main() {
expect(box.getMinIntrinsicHeight(80.0), 80.0); expect(box.getMinIntrinsicHeight(80.0), 80.0);
expect(box.getMaxIntrinsicHeight(80.0), 80.0); expect(box.getMaxIntrinsicHeight(80.0), 80.0);
expect(box.getMinIntrinsicWidth(double.INFINITY), 30.0); expect(box.getMinIntrinsicWidth(double.infinity), 30.0);
expect(box.getMaxIntrinsicWidth(double.INFINITY), 30.0); expect(box.getMaxIntrinsicWidth(double.infinity), 30.0);
expect(box.getMinIntrinsicHeight(double.INFINITY), 30.0); expect(box.getMinIntrinsicHeight(double.infinity), 30.0);
expect(box.getMaxIntrinsicHeight(double.INFINITY), 30.0); expect(box.getMaxIntrinsicHeight(double.infinity), 30.0);
// also a smoke test: // also a smoke test:
layout( layout(
@ -384,10 +384,10 @@ void main() {
expect(box.getMinIntrinsicHeight(80.0), 50.0); expect(box.getMinIntrinsicHeight(80.0), 50.0);
expect(box.getMaxIntrinsicHeight(80.0), 50.0); expect(box.getMaxIntrinsicHeight(80.0), 50.0);
expect(box.getMinIntrinsicWidth(double.INFINITY), 50.0); expect(box.getMinIntrinsicWidth(double.infinity), 50.0);
expect(box.getMaxIntrinsicWidth(double.INFINITY), 50.0); expect(box.getMaxIntrinsicWidth(double.infinity), 50.0);
expect(box.getMinIntrinsicHeight(double.INFINITY), 50.0); expect(box.getMinIntrinsicHeight(double.infinity), 50.0);
expect(box.getMaxIntrinsicHeight(double.INFINITY), 50.0); expect(box.getMaxIntrinsicHeight(double.infinity), 50.0);
// also a smoke test: // also a smoke test:
layout( layout(
@ -422,10 +422,10 @@ void main() {
expect(box.getMinIntrinsicHeight(80.0), 80.0); expect(box.getMinIntrinsicHeight(80.0), 80.0);
expect(box.getMaxIntrinsicHeight(80.0), 80.0); expect(box.getMaxIntrinsicHeight(80.0), 80.0);
expect(box.getMinIntrinsicWidth(double.INFINITY), 30.0); expect(box.getMinIntrinsicWidth(double.infinity), 30.0);
expect(box.getMaxIntrinsicWidth(double.INFINITY), 30.0); expect(box.getMaxIntrinsicWidth(double.infinity), 30.0);
expect(box.getMinIntrinsicHeight(double.INFINITY), 30.0); expect(box.getMinIntrinsicHeight(double.infinity), 30.0);
expect(box.getMaxIntrinsicHeight(double.INFINITY), 30.0); expect(box.getMaxIntrinsicHeight(double.infinity), 30.0);
// also a smoke test: // also a smoke test:
layout( layout(

View File

@ -15,9 +15,9 @@ void main() {
); );
final RenderBox parent = new RenderConstrainedOverflowBox( final RenderBox parent = new RenderConstrainedOverflowBox(
minWidth: 0.0, minWidth: 0.0,
maxWidth: double.INFINITY, maxWidth: double.infinity,
minHeight: 0.0, minHeight: 0.0,
maxHeight: double.INFINITY, maxHeight: double.infinity,
child: new RenderLimitedBox( child: new RenderLimitedBox(
maxWidth: 100.0, maxWidth: 100.0,
maxHeight: 200.0, maxHeight: 200.0,
@ -64,7 +64,7 @@ void main() {
); );
final RenderBox parent = new RenderConstrainedOverflowBox( final RenderBox parent = new RenderConstrainedOverflowBox(
minWidth: 0.0, minWidth: 0.0,
maxWidth: double.INFINITY, maxWidth: double.infinity,
minHeight: 500.0, minHeight: 500.0,
maxHeight: 500.0, maxHeight: 500.0,
child: new RenderLimitedBox( child: new RenderLimitedBox(
@ -86,7 +86,7 @@ void main() {
minWidth: 500.0, minWidth: 500.0,
maxWidth: 500.0, maxWidth: 500.0,
minHeight: 0.0, minHeight: 0.0,
maxHeight: double.INFINITY, maxHeight: double.infinity,
child: new RenderLimitedBox( child: new RenderLimitedBox(
maxWidth: 100.0, maxWidth: 100.0,
maxHeight: 200.0, maxHeight: 200.0,
@ -105,7 +105,7 @@ void main() {
minWidth: 10.0, minWidth: 10.0,
maxWidth: 500.0, maxWidth: 500.0,
minHeight: 0.0, minHeight: 0.0,
maxHeight: double.INFINITY, maxHeight: double.infinity,
child: box = new RenderLimitedBox( child: box = new RenderLimitedBox(
maxWidth: 100.0, maxWidth: 100.0,
maxHeight: 200.0, maxHeight: 200.0,

View File

@ -20,10 +20,10 @@ void main() {
], ],
); );
final double textWidth = paragraph.getMaxIntrinsicWidth(double.INFINITY); final double textWidth = paragraph.getMaxIntrinsicWidth(double.infinity);
final double oneLineTextHeight = paragraph.getMinIntrinsicHeight(double.INFINITY); final double oneLineTextHeight = paragraph.getMinIntrinsicHeight(double.infinity);
final double constrainedWidth = textWidth * 0.9; final double constrainedWidth = textWidth * 0.9;
final double wrappedTextWidth = paragraph.getMinIntrinsicWidth(double.INFINITY); final double wrappedTextWidth = paragraph.getMinIntrinsicWidth(double.infinity);
final double twoLinesTextHeight = paragraph.getMinIntrinsicHeight(constrainedWidth); final double twoLinesTextHeight = paragraph.getMinIntrinsicHeight(constrainedWidth);
final double manyLinesTextHeight = paragraph.getMinIntrinsicHeight(0.0); final double manyLinesTextHeight = paragraph.getMinIntrinsicHeight(0.0);
@ -33,16 +33,16 @@ void main() {
expect(oneLineTextHeight, lessThan(twoLinesTextHeight)); expect(oneLineTextHeight, lessThan(twoLinesTextHeight));
expect(twoLinesTextHeight, lessThan(oneLineTextHeight * 3.0)); expect(twoLinesTextHeight, lessThan(oneLineTextHeight * 3.0));
expect(manyLinesTextHeight, greaterThan(twoLinesTextHeight)); expect(manyLinesTextHeight, greaterThan(twoLinesTextHeight));
expect(paragraph.getMaxIntrinsicHeight(double.INFINITY), equals(oneLineTextHeight)); expect(paragraph.getMaxIntrinsicHeight(double.infinity), equals(oneLineTextHeight));
expect(paragraph.getMaxIntrinsicHeight(constrainedWidth), equals(twoLinesTextHeight)); expect(paragraph.getMaxIntrinsicHeight(constrainedWidth), equals(twoLinesTextHeight));
expect(paragraph.getMaxIntrinsicHeight(0.0), equals(manyLinesTextHeight)); expect(paragraph.getMaxIntrinsicHeight(0.0), equals(manyLinesTextHeight));
// vertical block (same expectations) // vertical block (same expectations)
expect(testBlock.getMinIntrinsicWidth(double.INFINITY), equals(wrappedTextWidth)); expect(testBlock.getMinIntrinsicWidth(double.infinity), equals(wrappedTextWidth));
expect(testBlock.getMaxIntrinsicWidth(double.INFINITY), equals(textWidth)); expect(testBlock.getMaxIntrinsicWidth(double.infinity), equals(textWidth));
expect(testBlock.getMinIntrinsicHeight(double.INFINITY), equals(oneLineTextHeight)); expect(testBlock.getMinIntrinsicHeight(double.infinity), equals(oneLineTextHeight));
expect(testBlock.getMinIntrinsicHeight(constrainedWidth), equals(twoLinesTextHeight)); expect(testBlock.getMinIntrinsicHeight(constrainedWidth), equals(twoLinesTextHeight));
expect(testBlock.getMaxIntrinsicHeight(double.INFINITY), equals(oneLineTextHeight)); expect(testBlock.getMaxIntrinsicHeight(double.infinity), equals(oneLineTextHeight));
expect(testBlock.getMaxIntrinsicHeight(constrainedWidth), equals(twoLinesTextHeight)); expect(testBlock.getMaxIntrinsicHeight(constrainedWidth), equals(twoLinesTextHeight));
expect(testBlock.getMinIntrinsicWidth(0.0), equals(wrappedTextWidth)); expect(testBlock.getMinIntrinsicWidth(0.0), equals(wrappedTextWidth));
expect(testBlock.getMaxIntrinsicWidth(0.0), equals(textWidth)); expect(testBlock.getMaxIntrinsicWidth(0.0), equals(textWidth));
@ -53,11 +53,11 @@ void main() {
// horizontal block (same expectations again) // horizontal block (same expectations again)
testBlock.axisDirection = AxisDirection.right; testBlock.axisDirection = AxisDirection.right;
expect(testBlock.getMinIntrinsicWidth(double.INFINITY), equals(wrappedTextWidth)); expect(testBlock.getMinIntrinsicWidth(double.infinity), equals(wrappedTextWidth));
expect(testBlock.getMaxIntrinsicWidth(double.INFINITY), equals(textWidth)); expect(testBlock.getMaxIntrinsicWidth(double.infinity), equals(textWidth));
expect(testBlock.getMinIntrinsicHeight(double.INFINITY), equals(oneLineTextHeight)); expect(testBlock.getMinIntrinsicHeight(double.infinity), equals(oneLineTextHeight));
expect(testBlock.getMinIntrinsicHeight(constrainedWidth), equals(twoLinesTextHeight)); expect(testBlock.getMinIntrinsicHeight(constrainedWidth), equals(twoLinesTextHeight));
expect(testBlock.getMaxIntrinsicHeight(double.INFINITY), equals(oneLineTextHeight)); expect(testBlock.getMaxIntrinsicHeight(double.infinity), equals(oneLineTextHeight));
expect(testBlock.getMaxIntrinsicHeight(constrainedWidth), equals(twoLinesTextHeight)); expect(testBlock.getMaxIntrinsicHeight(constrainedWidth), equals(twoLinesTextHeight));
expect(testBlock.getMinIntrinsicWidth(0.0), equals(wrappedTextWidth)); expect(testBlock.getMinIntrinsicWidth(0.0), equals(wrappedTextWidth));
expect(testBlock.getMaxIntrinsicWidth(0.0), equals(textWidth)); expect(testBlock.getMaxIntrinsicWidth(0.0), equals(textWidth));

View File

@ -16,8 +16,8 @@ void main() {
test('RenderLimitedBox getters and setters', () { test('RenderLimitedBox getters and setters', () {
final RenderLimitedBox box = new RenderLimitedBox(); final RenderLimitedBox box = new RenderLimitedBox();
expect(box.maxWidth, double.INFINITY); expect(box.maxWidth, double.infinity);
expect(box.maxHeight, double.INFINITY); expect(box.maxHeight, double.infinity);
box.maxWidth = 0.0; box.maxWidth = 0.0;
box.maxHeight = 1.0; box.maxHeight = 1.0;
expect(box.maxHeight, 1.0); expect(box.maxHeight, 1.0);

View File

@ -95,7 +95,7 @@ void main() {
test('RenderTransform - rotation', () { test('RenderTransform - rotation', () {
RenderBox inner; RenderBox inner;
final RenderBox sizer = new RenderTransform( final RenderBox sizer = new RenderTransform(
transform: new Matrix4.rotationZ(math.PI), transform: new Matrix4.rotationZ(math.pi),
alignment: Alignment.center, alignment: Alignment.center,
child: inner = new RenderSizedBox(const Size(100.0, 100.0)), child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
); );
@ -113,7 +113,7 @@ void main() {
test('RenderTransform - rotation with internal offset', () { test('RenderTransform - rotation with internal offset', () {
RenderBox inner; RenderBox inner;
final RenderBox sizer = new RenderTransform( final RenderBox sizer = new RenderTransform(
transform: new Matrix4.rotationZ(math.PI), transform: new Matrix4.rotationZ(math.pi),
alignment: Alignment.center, alignment: Alignment.center,
child: new RenderPadding( child: new RenderPadding(
padding: const EdgeInsets.only(left: 20.0), padding: const EdgeInsets.only(left: 20.0),
@ -134,7 +134,7 @@ void main() {
test('RenderTransform - perspective - globalToLocal', () { test('RenderTransform - perspective - globalToLocal', () {
RenderBox inner; RenderBox inner;
final RenderBox sizer = new RenderTransform( final RenderBox sizer = new RenderTransform(
transform: rotateAroundXAxis(math.PI * 0.25), // at pi/4, we are about 70 pixels high transform: rotateAroundXAxis(math.pi * 0.25), // at pi/4, we are about 70 pixels high
alignment: Alignment.center, alignment: Alignment.center,
child: inner = new RenderSizedBox(const Size(100.0, 100.0)), child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
); );
@ -151,7 +151,7 @@ void main() {
test('RenderTransform - perspective - localToGlobal', () { test('RenderTransform - perspective - localToGlobal', () {
RenderBox inner; RenderBox inner;
final RenderBox sizer = new RenderTransform( final RenderBox sizer = new RenderTransform(
transform: rotateAroundXAxis(math.PI * 0.4999), // at pi/2, we're seeing the box on its edge, transform: rotateAroundXAxis(math.pi * 0.4999), // at pi/2, we're seeing the box on its edge,
alignment: Alignment.center, alignment: Alignment.center,
child: inner = new RenderSizedBox(const Size(100.0, 100.0)), child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
); );

View File

@ -137,8 +137,8 @@ void main() {
_checkEncodeDecode<dynamic>(standard, 9223372036854775807); _checkEncodeDecode<dynamic>(standard, 9223372036854775807);
_checkEncodeDecode<dynamic>(standard, -9223372036854775807); _checkEncodeDecode<dynamic>(standard, -9223372036854775807);
_checkEncodeDecode<dynamic>(standard, 3.14); _checkEncodeDecode<dynamic>(standard, 3.14);
_checkEncodeDecode<dynamic>(standard, double.INFINITY); _checkEncodeDecode<dynamic>(standard, double.infinity);
_checkEncodeDecode<dynamic>(standard, double.NAN); _checkEncodeDecode<dynamic>(standard, double.nan);
_checkEncodeDecode<dynamic>(standard, ''); _checkEncodeDecode<dynamic>(standard, '');
_checkEncodeDecode<dynamic>(standard, 'hello'); _checkEncodeDecode<dynamic>(standard, 'hello');
_checkEncodeDecode<dynamic>(standard, 'special chars >\u263A\u{1F602}<'); _checkEncodeDecode<dynamic>(standard, 'special chars >\u263A\u{1F602}<');
@ -161,15 +161,15 @@ void main() {
<int>[-0x7fffffffffffffff - 1, 0, 0x7fffffffffffffff]), <int>[-0x7fffffffffffffff - 1, 0, 0x7fffffffffffffff]),
null, // ensures the offset of the following list is unaligned. null, // ensures the offset of the following list is unaligned.
new Float64List.fromList(<double>[ new Float64List.fromList(<double>[
double.NEGATIVE_INFINITY, double.negativeInfinity,
-double.MAX_FINITE, -double.maxFinite,
-double.MIN_POSITIVE, -double.minPositive,
-0.0, -0.0,
0.0, 0.0,
double.MIN_POSITIVE, double.minPositive,
double.MAX_FINITE, double.maxFinite,
double.INFINITY, double.infinity,
double.NAN double.nan
]), ]),
<dynamic>['nested', <dynamic>[]], <dynamic>['nested', <dynamic>[]],
<dynamic, dynamic>{ 'a': 'nested', null: <dynamic, dynamic>{} }, <dynamic, dynamic>{ 'a': 'nested', null: <dynamic, dynamic>{} },

View File

@ -190,7 +190,7 @@ void main() {
); );
final List<dynamic> events = await channel.receiveBroadcastStream('hello').toList(); final List<dynamic> events = await channel.receiveBroadcastStream('hello').toList();
expect(events, orderedEquals(<String>['hello1', 'hello2'])); expect(events, orderedEquals(<String>['hello1', 'hello2']));
await new Future<Null>.delayed(Duration.ZERO); await new Future<Null>.delayed(Duration.zero);
expect(canceled, isTrue); expect(canceled, isTrue);
}); });
test('can receive error event', () async { test('can receive error event', () async {
@ -212,7 +212,7 @@ void main() {
final List<dynamic> events = <dynamic>[]; final List<dynamic> events = <dynamic>[];
final List<dynamic> errors = <dynamic>[]; final List<dynamic> errors = <dynamic>[];
channel.receiveBroadcastStream('hello').listen(events.add, onError: errors.add); channel.receiveBroadcastStream('hello').listen(events.add, onError: errors.add);
await new Future<Null>.delayed(Duration.ZERO); await new Future<Null>.delayed(Duration.zero);
expect(events, isEmpty); expect(events, isEmpty);
expect(errors, hasLength(1)); expect(errors, hasLength(1));
expect(errors[0], const isInstanceOf<PlatformException>()); expect(errors[0], const isInstanceOf<PlatformException>());

View File

@ -328,7 +328,7 @@ void main() {
} }
Future<Null> eventFiring(WidgetTester tester) async { Future<Null> eventFiring(WidgetTester tester) async {
await tester.pump(Duration.ZERO); await tester.pump(Duration.zero);
} }
class StringCollector extends StreamBuilderBase<String, List<String>> { class StringCollector extends StreamBuilderBase<String, List<String>> {

View File

@ -48,7 +48,7 @@ void main() {
}); });
expect(rotateCommand, isNotNull); expect(rotateCommand, isNotNull);
expect(rotateCommand.positionalArguments[0], equals(-math.PI / 4.0)); expect(rotateCommand.positionalArguments[0], equals(-math.pi / 4.0));
}); });
test('A Banner with a location of topStart paints in the top right (RTL)', () { test('A Banner with a location of topStart paints in the top right (RTL)', () {
@ -76,7 +76,7 @@ void main() {
}); });
expect(rotateCommand, isNotNull); expect(rotateCommand, isNotNull);
expect(rotateCommand.positionalArguments[0], equals(math.PI / 4.0)); expect(rotateCommand.positionalArguments[0], equals(math.pi / 4.0));
}); });
test('A Banner with a location of topEnd paints in the top right (LTR)', () { test('A Banner with a location of topEnd paints in the top right (LTR)', () {
@ -104,7 +104,7 @@ void main() {
}); });
expect(rotateCommand, isNotNull); expect(rotateCommand, isNotNull);
expect(rotateCommand.positionalArguments[0], equals(math.PI / 4.0)); expect(rotateCommand.positionalArguments[0], equals(math.pi / 4.0));
}); });
test('A Banner with a location of topEnd paints in the top left (RTL)', () { test('A Banner with a location of topEnd paints in the top left (RTL)', () {
@ -132,7 +132,7 @@ void main() {
}); });
expect(rotateCommand, isNotNull); expect(rotateCommand, isNotNull);
expect(rotateCommand.positionalArguments[0], equals(-math.PI / 4.0)); expect(rotateCommand.positionalArguments[0], equals(-math.pi / 4.0));
}); });
test('A Banner with a location of bottomStart paints in the bottom left (LTR)', () { test('A Banner with a location of bottomStart paints in the bottom left (LTR)', () {
@ -160,7 +160,7 @@ void main() {
}); });
expect(rotateCommand, isNotNull); expect(rotateCommand, isNotNull);
expect(rotateCommand.positionalArguments[0], equals(math.PI / 4.0)); expect(rotateCommand.positionalArguments[0], equals(math.pi / 4.0));
}); });
test('A Banner with a location of bottomStart paints in the bottom right (RTL)', () { test('A Banner with a location of bottomStart paints in the bottom right (RTL)', () {
@ -188,7 +188,7 @@ void main() {
}); });
expect(rotateCommand, isNotNull); expect(rotateCommand, isNotNull);
expect(rotateCommand.positionalArguments[0], equals(-math.PI / 4.0)); expect(rotateCommand.positionalArguments[0], equals(-math.pi / 4.0));
}); });
test('A Banner with a location of bottomEnd paints in the bottom right (LTR)', () { test('A Banner with a location of bottomEnd paints in the bottom right (LTR)', () {
@ -216,7 +216,7 @@ void main() {
}); });
expect(rotateCommand, isNotNull); expect(rotateCommand, isNotNull);
expect(rotateCommand.positionalArguments[0], equals(-math.PI / 4.0)); expect(rotateCommand.positionalArguments[0], equals(-math.pi / 4.0));
}); });
test('A Banner with a location of bottomEnd paints in the bottom left (RTL)', () { test('A Banner with a location of bottomEnd paints in the bottom left (RTL)', () {
@ -244,7 +244,7 @@ void main() {
}); });
expect(rotateCommand, isNotNull); expect(rotateCommand, isNotNull);
expect(rotateCommand.positionalArguments[0], equals(math.PI / 4.0)); expect(rotateCommand.positionalArguments[0], equals(math.pi / 4.0));
}); });
testWidgets('Banner widget', (WidgetTester tester) async { testWidgets('Banner widget', (WidgetTester tester) async {
@ -257,7 +257,7 @@ void main() {
expect(find.byType(CustomPaint), paints expect(find.byType(CustomPaint), paints
..save ..save
..translate(x: 800.0, y: 0.0) ..translate(x: 800.0, y: 0.0)
..rotate(angle: math.PI / 4.0) ..rotate(angle: math.pi / 4.0)
..rect(rect: new Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0x7f000000), hasMaskFilter: true) ..rect(rect: new Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0x7f000000), hasMaskFilter: true)
..rect(rect: new Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0xa0b71c1c), hasMaskFilter: false) ..rect(rect: new Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0xa0b71c1c), hasMaskFilter: false)
..paragraph(offset: const Offset(-40.0, 29.0)) ..paragraph(offset: const Offset(-40.0, 29.0))
@ -270,7 +270,7 @@ void main() {
expect(find.byType(CheckedModeBanner), paints expect(find.byType(CheckedModeBanner), paints
..save ..save
..translate(x: 800.0, y: 0.0) ..translate(x: 800.0, y: 0.0)
..rotate(angle: math.PI / 4.0) ..rotate(angle: math.pi / 4.0)
..rect(rect: new Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0x7f000000), hasMaskFilter: true) ..rect(rect: new Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0x7f000000), hasMaskFilter: true)
..rect(rect: new Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0xa0b71c1c), hasMaskFilter: false) ..rect(rect: new Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0xa0b71c1c), hasMaskFilter: false)
..paragraph(offset: const Offset(-40.0, 29.0)) ..paragraph(offset: const Offset(-40.0, 29.0))

View File

@ -193,7 +193,7 @@ void main() {
height: 200.0, height: 200.0,
child: new Center( child: new Center(
child: new Transform( child: new Transform(
transform: new Matrix4.rotationZ(math.PI), transform: new Matrix4.rotationZ(math.pi),
child: new Container( child: new Container(
key: const ValueKey<int>(0), key: const ValueKey<int>(0),
width: 100.0, width: 100.0,
@ -449,7 +449,7 @@ void main() {
height: 200.0, height: 200.0,
child: new Center( child: new Center(
child: new Transform( child: new Transform(
transform: new Matrix4.rotationZ(math.PI), transform: new Matrix4.rotationZ(math.pi),
child: new Container( child: new Container(
key: const ValueKey<int>(0), key: const ValueKey<int>(0),
width: 100.0, width: 100.0,

View File

@ -56,7 +56,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -95,7 +95,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -130,7 +130,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -165,7 +165,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -200,7 +200,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -231,7 +231,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -259,7 +259,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -287,7 +287,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -314,7 +314,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -351,7 +351,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -384,7 +384,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -417,7 +417,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -450,7 +450,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -479,7 +479,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -505,7 +505,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -531,7 +531,7 @@ void main() {
), ),
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
expect(find.byType(Container), paints expect(find.byType(Container), paints
@ -551,7 +551,7 @@ void main() {
matchTextDirection: false, matchTextDirection: false,
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
await tester.pumpWidget( await tester.pumpWidget(
@ -563,7 +563,7 @@ void main() {
matchTextDirection: true, matchTextDirection: true,
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
await tester.pumpWidget( await tester.pumpWidget(
@ -575,7 +575,7 @@ void main() {
matchTextDirection: false, matchTextDirection: false,
), ),
), ),
Duration.ZERO, Duration.zero,
EnginePhase.layout, // so that we don't try to paint the fake images EnginePhase.layout, // so that we don't try to paint the fake images
); );
}); });

View File

@ -22,7 +22,7 @@ void main() {
expect(new ValueKey<int>(nonconst(3)) == new ValueKey<int>(nonconst(3)), isTrue); expect(new ValueKey<int>(nonconst(3)) == new ValueKey<int>(nonconst(3)), isTrue);
expect(new ValueKey<num>(nonconst(3)) == new ValueKey<int>(nonconst(3)), isFalse); expect(new ValueKey<num>(nonconst(3)) == new ValueKey<int>(nonconst(3)), isFalse);
expect(new ValueKey<int>(nonconst(3)) == new ValueKey<int>(nonconst(2)), isFalse); expect(new ValueKey<int>(nonconst(3)) == new ValueKey<int>(nonconst(2)), isFalse);
expect(const ValueKey<double>(double.NAN) == const ValueKey<double>(double.NAN), isFalse); expect(const ValueKey<double>(double.nan) == const ValueKey<double>(double.nan), isFalse);
expect(new Key(nonconst('')) == new ValueKey<String>(nonconst('')), isTrue); expect(new Key(nonconst('')) == new ValueKey<String>(nonconst('')), isTrue);
expect(new ValueKey<String>(nonconst('')) == new ValueKey<String>(nonconst('')), isTrue); expect(new ValueKey<String>(nonconst('')) == new ValueKey<String>(nonconst('')), isTrue);

View File

@ -171,8 +171,8 @@ class LinkedScrollPosition extends ScrollPositionWithSingleContext {
assert(beforeOverscroll == 0.0 || afterOverscroll == 0.0); assert(beforeOverscroll == 0.0 || afterOverscroll == 0.0);
final double localOverscroll = setPixels(value.clamp( final double localOverscroll = setPixels(value.clamp(
owner.canLinkWithBefore ? minScrollExtent : -double.INFINITY, owner.canLinkWithBefore ? minScrollExtent : -double.infinity,
owner.canLinkWithAfter ? maxScrollExtent : double.INFINITY, owner.canLinkWithAfter ? maxScrollExtent : double.infinity,
)); ));
assert(localOverscroll == 0.0 || (beforeOverscroll == 0.0 && afterOverscroll == 0.0)); assert(localOverscroll == 0.0 || (beforeOverscroll == 0.0 && afterOverscroll == 0.0));

View File

@ -243,11 +243,11 @@ void main() {
); );
final RenderObject painter = tester.renderObject(find.byType(CustomPaint)); final RenderObject painter = tester.renderObject(find.byType(CustomPaint));
await slowDrag(tester, const Offset(200.0, 200.0), const Offset(5.0, 0.0)); await slowDrag(tester, const Offset(200.0, 200.0), const Offset(5.0, 0.0));
expect(painter, paints..rotate(angle: math.PI / 2.0)..circle()..saveRestore()); expect(painter, paints..rotate(angle: math.pi / 2.0)..circle()..saveRestore());
expect(painter, isNot(paints..circle()..circle())); expect(painter, isNot(paints..circle()..circle()));
await slowDrag(tester, const Offset(200.0, 200.0), const Offset(-5.0, 0.0)); await slowDrag(tester, const Offset(200.0, 200.0), const Offset(-5.0, 0.0));
expect(painter, paints..rotate(angle: math.PI / 2.0)..circle() expect(painter, paints..rotate(angle: math.pi / 2.0)..circle()
..rotate(angle: math.PI / 2.0)..circle()); ..rotate(angle: math.pi / 2.0)..circle());
await tester.pumpAndSettle(const Duration(seconds: 1)); await tester.pumpAndSettle(const Duration(seconds: 1));
expect(painter, doesNotOverscroll); expect(painter, doesNotOverscroll);
@ -296,7 +296,7 @@ void main() {
); );
painter = tester.renderObject(find.byType(CustomPaint)); painter = tester.renderObject(find.byType(CustomPaint));
await slowDrag(tester, const Offset(200.0, 200.0), const Offset(5.0, 0.0)); await slowDrag(tester, const Offset(200.0, 200.0), const Offset(5.0, 0.0));
expect(painter, paints..rotate(angle: math.PI / 2.0)..circle(color: const Color(0x0A00FF00))); expect(painter, paints..rotate(angle: math.pi / 2.0)..circle(color: const Color(0x0A00FF00)));
expect(painter, isNot(paints..circle()..circle())); expect(painter, isNot(paints..circle()..circle()));
await tester.pumpAndSettle(const Duration(seconds: 1)); await tester.pumpAndSettle(const Duration(seconds: 1));
@ -317,7 +317,7 @@ void main() {
); );
painter = tester.renderObject(find.byType(CustomPaint)); painter = tester.renderObject(find.byType(CustomPaint));
await slowDrag(tester, const Offset(200.0, 200.0), const Offset(5.0, 0.0)); await slowDrag(tester, const Offset(200.0, 200.0), const Offset(5.0, 0.0));
expect(painter, paints..rotate(angle: math.PI / 2.0)..circle(color: const Color(0x0A0000FF))..saveRestore()); expect(painter, paints..rotate(angle: math.pi / 2.0)..circle(color: const Color(0x0A0000FF))..saveRestore());
expect(painter, isNot(paints..circle()..circle())); expect(painter, isNot(paints..circle()..circle()));
}); });
} }

View File

@ -28,8 +28,8 @@ void main() {
expect(e.height, 2.0); expect(e.height, 2.0);
const SizedBox f = const SizedBox.expand(); const SizedBox f = const SizedBox.expand();
expect(f.width, double.INFINITY); expect(f.width, double.infinity);
expect(f.height, double.INFINITY); expect(f.height, double.infinity);
}); });
testWidgets('SizedBox - no child', (WidgetTester tester) async { testWidgets('SizedBox - no child', (WidgetTester tester) async {

View File

@ -259,7 +259,7 @@ void main() {
testWidgets('Transform.rotate', (WidgetTester tester) async { testWidgets('Transform.rotate', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new Transform.rotate( new Transform.rotate(
angle: math.PI / 2.0, angle: math.pi / 2.0,
child: new Opacity(opacity: 0.5, child: new Container()), child: new Opacity(opacity: 0.5, child: new Container()),
), ),
); );

View File

@ -416,9 +416,9 @@ void main() {
service.disposeAllGroups(); service.disposeAllGroups();
final Element elementB = find.text('b').evaluate().first; final Element elementB = find.text('b').evaluate().first;
final String bId = service.toId(elementB, group); final String bId = service.toId(elementB, group);
final Object json = JSON.decode(service.getParentChain(bId, group)); final Object jsonList = json.decode(service.getParentChain(bId, group));
expect(json, isList); expect(jsonList, isList);
final List<Object> chainElements = json; final List<Object> chainElements = jsonList;
final List<Element> expectedChain = elementB.debugGetDiagnosticChain()?.reversed?.toList(); final List<Element> expectedChain = elementB.debugGetDiagnosticChain()?.reversed?.toList();
// Sanity check that the chain goes back to the root. // Sanity check that the chain goes back to the root.
expect(expectedChain.first, tester.binding.renderViewElement); expect(expectedChain.first, tester.binding.renderViewElement);
@ -458,7 +458,7 @@ void main() {
final WidgetInspectorService service = WidgetInspectorService.instance; final WidgetInspectorService service = WidgetInspectorService.instance;
service.disposeAllGroups(); service.disposeAllGroups();
final String id = service.toId(diagnostic, group); final String id = service.toId(diagnostic, group);
final List<Object> propertiesJson = JSON.decode(service.getProperties(id, group)); final List<Object> propertiesJson = json.decode(service.getProperties(id, group));
final List<DiagnosticsNode> properties = diagnostic.getProperties(); final List<DiagnosticsNode> properties = diagnostic.getProperties();
expect(properties, isNotEmpty); expect(properties, isNotEmpty);
expect(propertiesJson.length, equals(properties.length)); expect(propertiesJson.length, equals(properties.length));
@ -488,7 +488,7 @@ void main() {
final WidgetInspectorService service = WidgetInspectorService.instance; final WidgetInspectorService service = WidgetInspectorService.instance;
service.disposeAllGroups(); service.disposeAllGroups();
final String id = service.toId(diagnostic, group); final String id = service.toId(diagnostic, group);
final List<Object> propertiesJson = JSON.decode(service.getChildren(id, group)); final List<Object> propertiesJson = json.decode(service.getChildren(id, group));
final List<DiagnosticsNode> children = diagnostic.getChildren(); final List<DiagnosticsNode> children = diagnostic.getChildren();
expect(children.length, equals(3)); expect(children.length, equals(3));
expect(propertiesJson.length, equals(children.length)); expect(propertiesJson.length, equals(children.length));
@ -520,7 +520,7 @@ void main() {
service.disposeAllGroups(); service.disposeAllGroups();
service.setPubRootDirectories(<Object>[]); service.setPubRootDirectories(<Object>[]);
service.setSelection(elementA, 'my-group'); service.setSelection(elementA, 'my-group');
final Map<String, Object> jsonA = JSON.decode(service.getSelectedWidget(null, 'my-group')); final Map<String, Object> jsonA = json.decode(service.getSelectedWidget(null, 'my-group'));
final Map<String, Object> creationLocationA = jsonA['creationLocation']; final Map<String, Object> creationLocationA = jsonA['creationLocation'];
expect(creationLocationA, isNotNull); expect(creationLocationA, isNotNull);
final String fileA = creationLocationA['file']; final String fileA = creationLocationA['file'];
@ -529,7 +529,7 @@ void main() {
final List<Object> parameterLocationsA = creationLocationA['parameterLocations']; final List<Object> parameterLocationsA = creationLocationA['parameterLocations'];
service.setSelection(elementB, 'my-group'); service.setSelection(elementB, 'my-group');
final Map<String, Object> jsonB = JSON.decode(service.getSelectedWidget(null, 'my-group')); final Map<String, Object> jsonB = json.decode(service.getSelectedWidget(null, 'my-group'));
final Map<String, Object> creationLocationB = jsonB['creationLocation']; final Map<String, Object> creationLocationB = jsonB['creationLocation'];
expect(creationLocationB, isNotNull); expect(creationLocationB, isNotNull);
final String fileB = creationLocationB['file']; final String fileB = creationLocationB['file'];
@ -581,12 +581,12 @@ void main() {
service.disposeAllGroups(); service.disposeAllGroups();
service.setPubRootDirectories(<Object>[]); service.setPubRootDirectories(<Object>[]);
service.setSelection(elementA, 'my-group'); service.setSelection(elementA, 'my-group');
Map<String, Object> json = JSON.decode(service.getSelectedWidget(null, 'my-group')); Map<String, Object> jsonObject = json.decode(service.getSelectedWidget(null, 'my-group'));
Map<String, Object> creationLocation = json['creationLocation']; Map<String, Object> creationLocation = jsonObject['creationLocation'];
expect(creationLocation, isNotNull); expect(creationLocation, isNotNull);
final String fileA = creationLocation['file']; final String fileA = creationLocation['file'];
expect(fileA, endsWith('widget_inspector_test.dart')); expect(fileA, endsWith('widget_inspector_test.dart'));
expect(json, isNot(contains('createdByLocalProject'))); expect(jsonObject, isNot(contains('createdByLocalProject')));
final List<String> segments = Uri.parse(fileA).pathSegments; final List<String> segments = Uri.parse(fileA).pathSegments;
// Strip a couple subdirectories away to generate a plausible pub root // Strip a couple subdirectories away to generate a plausible pub root
// directory. // directory.
@ -594,22 +594,22 @@ void main() {
service.setPubRootDirectories(<Object>[pubRootTest]); service.setPubRootDirectories(<Object>[pubRootTest]);
service.setSelection(elementA, 'my-group'); service.setSelection(elementA, 'my-group');
expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject'));
service.setPubRootDirectories(<Object>['/invalid/$pubRootTest']); service.setPubRootDirectories(<Object>['/invalid/$pubRootTest']);
expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), isNot(contains('createdByLocalProject'))); expect(json.decode(service.getSelectedWidget(null, 'my-group')), isNot(contains('createdByLocalProject')));
service.setPubRootDirectories(<Object>['file://$pubRootTest']); service.setPubRootDirectories(<Object>['file://$pubRootTest']);
expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject'));
service.setPubRootDirectories(<Object>['$pubRootTest/different']); service.setPubRootDirectories(<Object>['$pubRootTest/different']);
expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), isNot(contains('createdByLocalProject'))); expect(json.decode(service.getSelectedWidget(null, 'my-group')), isNot(contains('createdByLocalProject')));
service.setPubRootDirectories(<Object>[ service.setPubRootDirectories(<Object>[
'/invalid/$pubRootTest', '/invalid/$pubRootTest',
pubRootTest, pubRootTest,
]); ]);
expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject'));
// The RichText child of the Text widget is created by the core framework // The RichText child of the Text widget is created by the core framework
// not the current package. // not the current package.
@ -619,9 +619,9 @@ void main() {
).evaluate().first; ).evaluate().first;
service.setSelection(richText, 'my-group'); service.setSelection(richText, 'my-group');
service.setPubRootDirectories(<Object>[pubRootTest]); service.setPubRootDirectories(<Object>[pubRootTest]);
json = JSON.decode(service.getSelectedWidget(null, 'my-group')); jsonObject = json.decode(service.getSelectedWidget(null, 'my-group'));
expect(json, isNot(contains('createdByLocalProject'))); expect(jsonObject, isNot(contains('createdByLocalProject')));
creationLocation = json['creationLocation']; creationLocation = jsonObject['creationLocation'];
expect(creationLocation, isNotNull); expect(creationLocation, isNotNull);
// This RichText widget is created by the build method of the Text widget // This RichText widget is created by the build method of the Text widget
// thus the creation location is in text.dart not basic.dart // thus the creation location is in text.dart not basic.dart
@ -631,14 +631,14 @@ void main() {
// Strip off /src/widgets/text.dart. // Strip off /src/widgets/text.dart.
final String pubRootFramework = '/' + pathSegmentsFramework.take(pathSegmentsFramework.length - 3).join('/'); final String pubRootFramework = '/' + pathSegmentsFramework.take(pathSegmentsFramework.length - 3).join('/');
service.setPubRootDirectories(<Object>[pubRootFramework]); service.setPubRootDirectories(<Object>[pubRootFramework]);
expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject'));
service.setSelection(elementA, 'my-group'); service.setSelection(elementA, 'my-group');
expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), isNot(contains('createdByLocalProject'))); expect(json.decode(service.getSelectedWidget(null, 'my-group')), isNot(contains('createdByLocalProject')));
service.setPubRootDirectories(<Object>[pubRootFramework, pubRootTest]); service.setPubRootDirectories(<Object>[pubRootFramework, pubRootTest]);
service.setSelection(elementA, 'my-group'); service.setSelection(elementA, 'my-group');
expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject'));
service.setSelection(richText, 'my-group'); service.setSelection(richText, 'my-group');
expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject'));
}, skip: !WidgetInspectorService.instance.isWidgetCreationTracked()); // Test requires --track-widget-creation flag. }, skip: !WidgetInspectorService.instance.isWidgetCreationTracked()); // Test requires --track-widget-creation flag.
} }

View File

@ -530,7 +530,7 @@ class FlutterDriver {
await new Future<Null>.delayed(const Duration(seconds: 2)); await new Future<Null>.delayed(const Duration(seconds: 2));
final Map<String, dynamic> result = await _peer.sendRequest('_flutter.screenshot').timeout(timeout); final Map<String, dynamic> result = await _peer.sendRequest('_flutter.screenshot').timeout(timeout);
return BASE64.decode(result['screenshot']); return base64.decode(result['screenshot']);
} }
/// Returns the Flags set in the Dart VM as JSON. /// Returns the Flags set in the Dart VM as JSON.

View File

@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:convert' show JSON, JsonEncoder; import 'dart:convert' show json, JsonEncoder;
import 'dart:math' as math; import 'dart:math' as math;
import 'package:file/file.dart'; import 'package:file/file.dart';
@ -112,10 +112,10 @@ class TimelineSummary {
await file.writeAsString(_encodeJson(summaryJson, pretty)); await file.writeAsString(_encodeJson(summaryJson, pretty));
} }
String _encodeJson(Map<String, dynamic> json, bool pretty) { String _encodeJson(Map<String, dynamic> jsonObject, bool pretty) {
return pretty return pretty
? _prettyEncoder.convert(json) ? _prettyEncoder.convert(jsonObject)
: JSON.encode(json); : json.encode(jsonObject);
} }
List<TimelineEvent> _extractNamedEvents(String name) { List<TimelineEvent> _extractNamedEvents(String name) {

View File

@ -298,7 +298,7 @@ class FlutterDriverExtension {
Future<ScrollResult> _scroll(Command command) async { Future<ScrollResult> _scroll(Command command) async {
final Scroll scrollCommand = command; final Scroll scrollCommand = command;
final Finder target = await _waitForElement(_createFinder(scrollCommand.finder)); final Finder target = await _waitForElement(_createFinder(scrollCommand.finder));
final int totalMoves = scrollCommand.duration.inMicroseconds * scrollCommand.frequency ~/ Duration.MICROSECONDS_PER_SECOND; final int totalMoves = scrollCommand.duration.inMicroseconds * scrollCommand.frequency ~/ Duration.microsecondsPerSecond;
final Offset delta = new Offset(scrollCommand.dx, scrollCommand.dy) / totalMoves.toDouble(); final Offset delta = new Offset(scrollCommand.dx, scrollCommand.dy) / totalMoves.toDouble();
final Duration pause = scrollCommand.duration ~/ totalMoves; final Duration pause = scrollCommand.duration ~/ totalMoves;
final Offset startLocation = _prober.getCenter(target); final Offset startLocation = _prober.getCenter(target);

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:convert' show JSON; import 'dart:convert' show json;
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'package:flutter_driver/flutter_driver.dart'; import 'package:flutter_driver/flutter_driver.dart';
@ -245,7 +245,7 @@ void main() {
]).writeSummaryToFile('test', destinationDirectory: tempDir.path); ]).writeSummaryToFile('test', destinationDirectory: tempDir.path);
final String written = final String written =
await fs.file(path.join(tempDir.path, 'test.timeline_summary.json')).readAsString(); await fs.file(path.join(tempDir.path, 'test.timeline_summary.json')).readAsString();
expect(JSON.decode(written), <String, dynamic>{ expect(json.decode(written), <String, dynamic>{
'average_frame_build_time_millis': 7.0, 'average_frame_build_time_millis': 7.0,
'worst_frame_build_time_millis': 11.0, 'worst_frame_build_time_millis': 11.0,
'missed_frame_build_budget_count': 2, 'missed_frame_build_budget_count': 2,

View File

@ -14,9 +14,9 @@ void main() {
DateTime initialDate; DateTime initialDate;
setUp(() { setUp(() {
firstDate = new DateTime(2001, DateTime.JANUARY, 1); firstDate = new DateTime(2001, DateTime.january, 1);
lastDate = new DateTime(2031, DateTime.DECEMBER, 31); lastDate = new DateTime(2031, DateTime.december, 31);
initialDate = new DateTime(2016, DateTime.JANUARY, 15); initialDate = new DateTime(2016, DateTime.january, 15);
}); });
group(DayPicker, () { group(DayPicker, () {

View File

@ -80,12 +80,12 @@ class AndroidDevice extends Device {
printTrace(propCommand.join(' ')); printTrace(propCommand.join(' '));
try { try {
// We pass an encoding of LATIN1 so that we don't try and interpret the // We pass an encoding of latin1 so that we don't try and interpret the
// `adb shell getprop` result as UTF8. // `adb shell getprop` result as UTF8.
final ProcessResult result = await processManager.run( final ProcessResult result = await processManager.run(
propCommand, propCommand,
stdoutEncoding: LATIN1, stdoutEncoding: latin1,
stderrEncoding: LATIN1, stderrEncoding: latin1,
).timeout(const Duration(seconds: 5)); ).timeout(const Duration(seconds: 5));
if (result.exitCode == 0) { if (result.exitCode == 0) {
_properties = parseAdbDeviceProperties(result.stdout); _properties = parseAdbDeviceProperties(result.stdout);
@ -522,7 +522,7 @@ class AndroidDevice extends Device {
final StreamSubscription<String> logs = getLogReader().logLines.listen((String line) { final StreamSubscription<String> logs = getLogReader().logLines.listen((String line) {
final Match match = discoverExp.firstMatch(line); final Match match = discoverExp.firstMatch(line);
if (match != null) { if (match != null) {
final Map<String, dynamic> app = JSON.decode(match.group(1)); final Map<String, dynamic> app = json.decode(match.group(1));
result.add(new DiscoveredApp(app['id'], app['observatoryPort'])); result.add(new DiscoveredApp(app['id'], app['observatoryPort']));
} }
}); });

Some files were not shown because too many files have changed in this diff Show More