Use Dart 2 camel case constants (#15360)
This commit is contained in:
parent
33f9afd99c
commit
466d15433f
@ -398,7 +398,7 @@ class _SnappingScrollPhysics extends ClampingScrollPhysics {
|
||||
// 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
|
||||
// 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)
|
||||
return simulation;
|
||||
if (dragVelocity > 0.0)
|
||||
|
@ -38,7 +38,7 @@ ui.Picture paint(ui.Rect paintBounds) {
|
||||
|
||||
canvas.translate(mid.dx, mid.dy);
|
||||
paint.color = const ui.Color.fromARGB(128, 255, 0, 255);
|
||||
canvas.rotate(math.PI/4.0);
|
||||
canvas.rotate(math.pi/4.0);
|
||||
|
||||
final ui.Gradient yellowBlue = new ui.Gradient.linear(
|
||||
new ui.Offset(-radius, -radius),
|
||||
|
@ -26,8 +26,8 @@ void beginFrame(Duration timeStamp) {
|
||||
|
||||
// Here we determine the rotation according to the timeStamp given to us by
|
||||
// the engine.
|
||||
final double t = timeStamp.inMicroseconds / Duration.MICROSECONDS_PER_MILLISECOND / 1800.0;
|
||||
canvas.rotate(math.PI * (t % 1.0));
|
||||
final double t = timeStamp.inMicroseconds / Duration.microsecondsPerMillisecond / 1800.0;
|
||||
canvas.rotate(math.pi * (t % 1.0));
|
||||
|
||||
canvas.drawRect(new ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
|
||||
new ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0));
|
||||
|
@ -52,9 +52,9 @@ void main() {
|
||||
vsync: const NonStopVSync(),
|
||||
)..repeat();
|
||||
// The animation will produce a value between 0.0 and 1.0 each frame, but we
|
||||
// want to rotate the square using a value between 0.0 and math.PI. To change
|
||||
// want to rotate the square using a value between 0.0 and math.pi. To change
|
||||
// the range of the animation, we use a Tween.
|
||||
final Tween<double> tween = new Tween<double>(begin: 0.0, end: math.PI);
|
||||
final Tween<double> tween = new Tween<double>(begin: 0.0, end: math.pi);
|
||||
// We add a listener to the animation, which will be called every time the
|
||||
// animation ticks.
|
||||
animation.addListener(() {
|
||||
|
@ -7,12 +7,12 @@ import 'dart:math' as math;
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
|
||||
const double kTwoPi = 2 * math.PI;
|
||||
const double kTwoPi = 2 * math.pi;
|
||||
|
||||
class SectorConstraints extends Constraints {
|
||||
const SectorConstraints({
|
||||
this.minDeltaRadius: 0.0,
|
||||
this.maxDeltaRadius: double.INFINITY,
|
||||
this.maxDeltaRadius: double.infinity,
|
||||
this.minDeltaTheta: 0.0,
|
||||
this.maxDeltaTheta: kTwoPi
|
||||
}) : assert(maxDeltaRadius >= minDeltaRadius),
|
||||
@ -99,9 +99,9 @@ abstract class RenderSector extends RenderObject {
|
||||
void debugAssertDoesMeetConstraints() {
|
||||
assert(constraints != null);
|
||||
assert(deltaRadius != null);
|
||||
assert(deltaRadius < double.INFINITY);
|
||||
assert(deltaRadius < double.infinity);
|
||||
assert(deltaTheta != null);
|
||||
assert(deltaTheta < double.INFINITY);
|
||||
assert(deltaTheta < double.infinity);
|
||||
assert(constraints.minDeltaRadius <= deltaRadius);
|
||||
assert(deltaRadius <= math.max(constraints.minDeltaRadius, constraints.maxDeltaRadius));
|
||||
assert(constraints.minDeltaTheta <= deltaTheta);
|
||||
@ -215,7 +215,7 @@ class RenderSectorRing extends RenderSectorWithChildren {
|
||||
|
||||
RenderSectorRing({
|
||||
BoxDecoration decoration,
|
||||
double deltaRadius: double.INFINITY,
|
||||
double deltaRadius: double.infinity,
|
||||
double padding: 0.0
|
||||
}) : _padding = padding,
|
||||
assert(deltaRadius >= 0.0),
|
||||
@ -284,7 +284,7 @@ class RenderSectorRing extends RenderSectorWithChildren {
|
||||
void performLayout() {
|
||||
assert(parentData is SectorParentData);
|
||||
deltaRadius = constraints.constrainDeltaRadius(desiredDeltaRadius);
|
||||
assert(deltaRadius < double.INFINITY);
|
||||
assert(deltaRadius < double.infinity);
|
||||
final double innerDeltaRadius = deltaRadius - padding * 2.0;
|
||||
final double childRadius = parentData.radius + padding;
|
||||
final double paddingTheta = math.atan(padding / (parentData.radius + deltaRadius));
|
||||
@ -487,8 +487,8 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
|
||||
}
|
||||
|
||||
Size getIntrinsicDimensions({
|
||||
double width: double.INFINITY,
|
||||
double height: double.INFINITY
|
||||
double width: double.infinity,
|
||||
double height: double.infinity
|
||||
}) {
|
||||
assert(child is RenderSector);
|
||||
assert(child.parentData is SectorParentData);
|
||||
@ -539,7 +539,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
|
||||
y -= size.height / 2.0;
|
||||
// convert to radius/theta
|
||||
final double radius = math.sqrt(x * x + y * y);
|
||||
final double theta = (math.atan2(x, -y) - math.PI / 2.0) % kTwoPi;
|
||||
final double theta = (math.atan2(x, -y) - math.pi / 2.0) % kTwoPi;
|
||||
if (radius < innerRadius)
|
||||
return false;
|
||||
if (radius >= innerRadius + child.deltaRadius)
|
||||
@ -555,7 +555,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
|
||||
|
||||
class RenderSolidColor extends RenderDecoratedSector {
|
||||
RenderSolidColor(this.backgroundColor, {
|
||||
this.desiredDeltaRadius: double.INFINITY,
|
||||
this.desiredDeltaRadius: double.infinity,
|
||||
this.desiredDeltaTheta: kTwoPi
|
||||
}) : super(new BoxDecoration(color: backgroundColor));
|
||||
|
||||
|
@ -14,22 +14,22 @@ class RenderSolidColorBox extends RenderDecoratedBox {
|
||||
|
||||
@override
|
||||
double computeMinIntrinsicWidth(double height) {
|
||||
return desiredSize.width == double.INFINITY ? 0.0 : desiredSize.width;
|
||||
return desiredSize.width == double.infinity ? 0.0 : desiredSize.width;
|
||||
}
|
||||
|
||||
@override
|
||||
double computeMaxIntrinsicWidth(double height) {
|
||||
return desiredSize.width == double.INFINITY ? 0.0 : desiredSize.width;
|
||||
return desiredSize.width == double.infinity ? 0.0 : desiredSize.width;
|
||||
}
|
||||
|
||||
@override
|
||||
double computeMinIntrinsicHeight(double width) {
|
||||
return desiredSize.height == double.INFINITY ? 0.0 : desiredSize.height;
|
||||
return desiredSize.height == double.infinity ? 0.0 : desiredSize.height;
|
||||
}
|
||||
|
||||
@override
|
||||
double computeMaxIntrinsicHeight(double width) {
|
||||
return desiredSize.height == double.INFINITY ? 0.0 : desiredSize.height;
|
||||
return desiredSize.height == double.infinity ? 0.0 : desiredSize.height;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -120,7 +120,7 @@ class CalculationManager {
|
||||
if (isRunning) {
|
||||
_state = CalculationState.idle;
|
||||
if (_isolate != null) {
|
||||
_isolate.kill(priority: Isolate.IMMEDIATE);
|
||||
_isolate.kill(priority: Isolate.immediate);
|
||||
_isolate = null;
|
||||
_completed = 0.0;
|
||||
_total = 1.0;
|
||||
@ -144,7 +144,7 @@ class CalculationManager {
|
||||
// is synchronous, so if done in the main isolate, the UI would block.
|
||||
Isolate.spawn(_calculate, message).then<Null>((Isolate isolate) {
|
||||
if (!isRunning) {
|
||||
isolate.kill(priority: Isolate.IMMEDIATE);
|
||||
isolate.kill(priority: Isolate.immediate);
|
||||
} else {
|
||||
_state = CalculationState.calculating;
|
||||
_isolate = isolate;
|
||||
|
@ -34,10 +34,10 @@ class SectorAppState extends State<SectorApp> {
|
||||
final double currentTheta = this.currentTheta;
|
||||
if (currentTheta < kTwoPi) {
|
||||
double deltaTheta;
|
||||
if (currentTheta >= kTwoPi - (math.PI * 0.2 + 0.05))
|
||||
if (currentTheta >= kTwoPi - (math.pi * 0.2 + 0.05))
|
||||
deltaTheta = kTwoPi - currentTheta;
|
||||
else
|
||||
deltaTheta = math.PI * rand.nextDouble() / 5.0 + 0.05;
|
||||
deltaTheta = math.pi * rand.nextDouble() / 5.0 + 0.05;
|
||||
wantedSectorSizes.add(deltaTheta);
|
||||
updateEnabledState();
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ RenderTransform transformBox;
|
||||
|
||||
void rotate(Duration timeStamp) {
|
||||
timeBase ??= timeStamp;
|
||||
final double delta = (timeStamp - timeBase).inMicroseconds.toDouble() / Duration.MICROSECONDS_PER_SECOND; // radians
|
||||
final double delta = (timeStamp - timeBase).inMicroseconds.toDouble() / Duration.microsecondsPerSecond; // radians
|
||||
|
||||
transformBox.setIdentity();
|
||||
transformBox.rotateZ(delta);
|
||||
|
@ -17,7 +17,7 @@ class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProvid
|
||||
super.initState();
|
||||
// We use 3600 milliseconds instead of 1800 milliseconds because 0.0 -> 1.0
|
||||
// represents an entire turn of the square whereas in the other examples
|
||||
// we used 0.0 -> math.PI, which is only half a turn.
|
||||
// we used 0.0 -> math.pi, which is only half a turn.
|
||||
_animation = new AnimationController(
|
||||
duration: const Duration(milliseconds: 3600),
|
||||
vsync: this,
|
||||
|
@ -34,7 +34,7 @@ final SpringDescription _kFlingSpringDescription = new SpringDescription.withDam
|
||||
);
|
||||
|
||||
const Tolerance _kFlingTolerance = const Tolerance(
|
||||
velocity: double.INFINITY,
|
||||
velocity: double.infinity,
|
||||
distance: 0.01,
|
||||
);
|
||||
|
||||
@ -153,8 +153,8 @@ class AnimationController extends Animation<double>
|
||||
@required TickerProvider vsync,
|
||||
}) : assert(value != null),
|
||||
assert(vsync != null),
|
||||
lowerBound = double.NEGATIVE_INFINITY,
|
||||
upperBound = double.INFINITY,
|
||||
lowerBound = double.negativeInfinity,
|
||||
upperBound = double.infinity,
|
||||
_direction = _AnimationDirection.forward {
|
||||
_ticker = vsync.createTicker(_tick);
|
||||
_internalSetValue(value);
|
||||
@ -253,7 +253,7 @@ class AnimationController extends Animation<double>
|
||||
double get velocity {
|
||||
if (!isAnimating)
|
||||
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) {
|
||||
@ -382,10 +382,10 @@ class AnimationController extends Animation<double>
|
||||
simulationDuration = this.duration * remainingFraction;
|
||||
} else if (target == value) {
|
||||
// Already at target, don't animate.
|
||||
simulationDuration = Duration.ZERO;
|
||||
simulationDuration = Duration.zero;
|
||||
}
|
||||
stop();
|
||||
if (simulationDuration == Duration.ZERO) {
|
||||
if (simulationDuration == Duration.zero) {
|
||||
if (value != target) {
|
||||
_value = target.clamp(lowerBound, upperBound);
|
||||
notifyListeners();
|
||||
@ -396,7 +396,7 @@ class AnimationController extends Animation<double>
|
||||
_checkStatusChanged();
|
||||
return new TickerFuture.complete();
|
||||
}
|
||||
assert(simulationDuration > Duration.ZERO);
|
||||
assert(simulationDuration > Duration.zero);
|
||||
assert(!isAnimating);
|
||||
return _startSimulation(new _InterpolationSimulation(_value, target, simulationDuration, curve));
|
||||
}
|
||||
@ -466,7 +466,7 @@ class AnimationController extends Animation<double>
|
||||
assert(simulation != null);
|
||||
assert(!isAnimating);
|
||||
_simulation = simulation;
|
||||
_lastElapsedDuration = Duration.ZERO;
|
||||
_lastElapsedDuration = Duration.zero;
|
||||
_value = simulation.x(0.0).clamp(lowerBound, upperBound);
|
||||
final Future<Null> result = _ticker.start();
|
||||
_status = (_direction == _AnimationDirection.forward) ?
|
||||
@ -534,7 +534,7 @@ class AnimationController extends Animation<double>
|
||||
|
||||
void _tick(Duration 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);
|
||||
_value = _simulation.x(elapsedInSeconds).clamp(lowerBound, upperBound);
|
||||
if (_simulation.isDone(elapsedInSeconds)) {
|
||||
@ -562,7 +562,7 @@ class _InterpolationSimulation extends Simulation {
|
||||
: assert(_begin != null),
|
||||
assert(_end != null),
|
||||
assert(duration != null && duration.inMicroseconds > 0),
|
||||
_durationInSeconds = duration.inMicroseconds / Duration.MICROSECONDS_PER_SECOND;
|
||||
_durationInSeconds = duration.inMicroseconds / Duration.microsecondsPerSecond;
|
||||
|
||||
final double _durationInSeconds;
|
||||
final double _begin;
|
||||
@ -592,7 +592,7 @@ class _InterpolationSimulation extends Simulation {
|
||||
|
||||
class _RepeatingSimulation extends Simulation {
|
||||
_RepeatingSimulation(this.min, this.max, Duration period)
|
||||
: _periodInSeconds = period.inMicroseconds / Duration.MICROSECONDS_PER_SECOND {
|
||||
: _periodInSeconds = period.inMicroseconds / Duration.microsecondsPerSecond {
|
||||
assert(_periodInSeconds > 0.0);
|
||||
}
|
||||
|
||||
|
@ -376,7 +376,7 @@ class ElasticInCurve extends Curve {
|
||||
assert(t >= 0.0 && t <= 1.0);
|
||||
final double s = period / 4.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
|
||||
@ -404,7 +404,7 @@ class ElasticOutCurve extends Curve {
|
||||
double transform(double t) {
|
||||
assert(t >= 0.0 && t <= 1.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
|
||||
@ -435,9 +435,9 @@ class ElasticInOutCurve extends Curve {
|
||||
final double s = period / 4.0;
|
||||
t = 2.0 * t - 1.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
|
||||
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
|
||||
|
@ -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 _kHalfTickCount = _kTickCount ~/ 2;
|
||||
const Color _kTickColor = CupertinoColors.lightBackgroundGray;
|
||||
|
@ -500,7 +500,7 @@ class _CupertinoLargeTitleNavigationBarSliverDelegate
|
||||
// and behind the persistent bar.
|
||||
child: new OverflowBox(
|
||||
minHeight: 0.0,
|
||||
maxHeight: double.INFINITY,
|
||||
maxHeight: double.infinity,
|
||||
alignment: AlignmentDirectional.bottomStart,
|
||||
child: new Padding(
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
|
@ -274,7 +274,7 @@ class _CupertinoTextSelectionControls extends TextSelectionControls {
|
||||
switch (type) {
|
||||
case TextSelectionHandleType.left: // The left handle is upside down on iOS.
|
||||
return new Transform(
|
||||
transform: new Matrix4.rotationZ(math.PI)
|
||||
transform: new Matrix4.rotationZ(math.pi)
|
||||
..translate(-_kHandlesPadding, -_kHandlesPadding),
|
||||
child: handle
|
||||
);
|
||||
|
@ -3,7 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert' show JSON;
|
||||
import 'dart:convert' show json;
|
||||
import 'dart:developer' as developer;
|
||||
import 'dart:io' show exit;
|
||||
|
||||
@ -348,7 +348,7 @@ abstract class BindingBase {
|
||||
/// extension method is called. The callback must return a [Future]
|
||||
/// that either eventually completes to a return value in the form
|
||||
/// 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
|
||||
/// logs.
|
||||
///
|
||||
@ -375,7 +375,7 @@ abstract class BindingBase {
|
||||
if (caughtException == null) {
|
||||
result['type'] = '_extensionType';
|
||||
result['method'] = method;
|
||||
return new developer.ServiceExtensionResponse.result(JSON.encode(result));
|
||||
return new developer.ServiceExtensionResponse.result(json.encode(result));
|
||||
} else {
|
||||
FlutterError.reportError(new FlutterErrorDetails(
|
||||
exception: caughtException,
|
||||
@ -384,7 +384,7 @@ abstract class BindingBase {
|
||||
));
|
||||
return new developer.ServiceExtensionResponse.error(
|
||||
developer.ServiceExtensionResponse.extensionError,
|
||||
JSON.encode(<String, String>{
|
||||
json.encode(<String, String>{
|
||||
'exception': caughtException.toString(),
|
||||
'stack': caughtStack.toString(),
|
||||
'method': method,
|
||||
|
@ -2238,9 +2238,9 @@ abstract class Diagnosticable {
|
||||
/// // default value so is not relevant.
|
||||
/// 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.,
|
||||
/// 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
|
||||
/// // percentage makes the meaning clear enough that the name can be
|
||||
|
@ -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
|
||||
/// in [NoSuchMethodError]s being thrown.
|
||||
///
|
||||
/// The byte order used is [Endianness.HOST_ENDIAN] throughout.
|
||||
/// The byte order used is [Endian.host] throughout.
|
||||
class WriteBuffer {
|
||||
/// Creates an interface for incrementally building a [ByteData] instance.
|
||||
WriteBuffer() {
|
||||
@ -31,32 +31,32 @@ class WriteBuffer {
|
||||
|
||||
/// Write a Uint16 into the buffer.
|
||||
void putUint16(int value) {
|
||||
_eightBytes.setUint16(0, value, Endianness.HOST_ENDIAN);
|
||||
_eightBytes.setUint16(0, value, Endian.host);
|
||||
_buffer.addAll(_eightBytesAsList, 0, 2);
|
||||
}
|
||||
|
||||
/// Write a Uint32 into the buffer.
|
||||
void putUint32(int value) {
|
||||
_eightBytes.setUint32(0, value, Endianness.HOST_ENDIAN);
|
||||
_eightBytes.setUint32(0, value, Endian.host);
|
||||
_buffer.addAll(_eightBytesAsList, 0, 4);
|
||||
}
|
||||
|
||||
/// Write an Int32 into the buffer.
|
||||
void putInt32(int value) {
|
||||
_eightBytes.setInt32(0, value, Endianness.HOST_ENDIAN);
|
||||
_eightBytes.setInt32(0, value, Endian.host);
|
||||
_buffer.addAll(_eightBytesAsList, 0, 4);
|
||||
}
|
||||
|
||||
/// Write an Int64 into the buffer.
|
||||
void putInt64(int value) {
|
||||
_eightBytes.setInt64(0, value, Endianness.HOST_ENDIAN);
|
||||
_eightBytes.setInt64(0, value, Endian.host);
|
||||
_buffer.addAll(_eightBytesAsList, 0, 8);
|
||||
}
|
||||
|
||||
/// Write an Float64 into the buffer.
|
||||
void putFloat64(double value) {
|
||||
_alignTo(8);
|
||||
_eightBytes.setFloat64(0, value, Endianness.HOST_ENDIAN);
|
||||
_eightBytes.setFloat64(0, value, Endian.host);
|
||||
_buffer.addAll(_eightBytesAsList);
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ class WriteBuffer {
|
||||
|
||||
/// 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 {
|
||||
/// Creates a [ReadBuffer] for reading from the specified [data].
|
||||
ReadBuffer(this.data)
|
||||
@ -123,28 +123,28 @@ class ReadBuffer {
|
||||
|
||||
/// Reads a Uint16 from the buffer.
|
||||
int getUint16() {
|
||||
final int value = data.getUint16(_position, Endianness.HOST_ENDIAN);
|
||||
final int value = data.getUint16(_position, Endian.host);
|
||||
_position += 2;
|
||||
return value;
|
||||
}
|
||||
|
||||
/// Reads a Uint32 from the buffer.
|
||||
int getUint32() {
|
||||
final int value = data.getUint32(_position, Endianness.HOST_ENDIAN);
|
||||
final int value = data.getUint32(_position, Endian.host);
|
||||
_position += 4;
|
||||
return value;
|
||||
}
|
||||
|
||||
/// Reads an Int32 from the buffer.
|
||||
int getInt32() {
|
||||
final int value = data.getInt32(_position, Endianness.HOST_ENDIAN);
|
||||
final int value = data.getInt32(_position, Endian.host);
|
||||
_position += 4;
|
||||
return value;
|
||||
}
|
||||
|
||||
/// Reads an Int64 from the buffer.
|
||||
int getInt64() {
|
||||
final int value = data.getInt64(_position, Endianness.HOST_ENDIAN);
|
||||
final int value = data.getInt64(_position, Endian.host);
|
||||
_position += 8;
|
||||
return value;
|
||||
}
|
||||
@ -152,7 +152,7 @@ class ReadBuffer {
|
||||
/// Reads a Float64 from the buffer.
|
||||
double getFloat64() {
|
||||
_alignTo(8);
|
||||
final double value = data.getFloat64(_position, Endianness.HOST_ENDIAN);
|
||||
final double value = data.getFloat64(_position, Endian.host);
|
||||
_position += 8;
|
||||
return value;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ abstract class PointerEvent {
|
||||
/// Abstract const constructor. This constructor enables subclasses to provide
|
||||
/// const constructors so that they can be used in const expressions.
|
||||
const PointerEvent({
|
||||
this.timeStamp: Duration.ZERO,
|
||||
this.timeStamp: Duration.zero,
|
||||
this.pointer: 0,
|
||||
this.kind: PointerDeviceKind.touch,
|
||||
this.device: 0,
|
||||
@ -289,7 +289,7 @@ class PointerAddedEvent extends PointerEvent {
|
||||
///
|
||||
/// All of the argument must be non-null.
|
||||
const PointerAddedEvent({
|
||||
Duration timeStamp: Duration.ZERO,
|
||||
Duration timeStamp: Duration.zero,
|
||||
PointerDeviceKind kind: PointerDeviceKind.touch,
|
||||
int device: 0,
|
||||
Offset position: Offset.zero,
|
||||
@ -328,7 +328,7 @@ class PointerRemovedEvent extends PointerEvent {
|
||||
///
|
||||
/// All of the argument must be non-null.
|
||||
const PointerRemovedEvent({
|
||||
Duration timeStamp: Duration.ZERO,
|
||||
Duration timeStamp: Duration.zero,
|
||||
PointerDeviceKind kind: PointerDeviceKind.touch,
|
||||
int device: 0,
|
||||
bool obscured: false,
|
||||
@ -363,7 +363,7 @@ class PointerHoverEvent extends PointerEvent {
|
||||
///
|
||||
/// All of the argument must be non-null.
|
||||
const PointerHoverEvent({
|
||||
Duration timeStamp: Duration.ZERO,
|
||||
Duration timeStamp: Duration.zero,
|
||||
PointerDeviceKind kind: PointerDeviceKind.touch,
|
||||
int device: 0,
|
||||
Offset position: Offset.zero,
|
||||
@ -410,7 +410,7 @@ class PointerDownEvent extends PointerEvent {
|
||||
///
|
||||
/// All of the argument must be non-null.
|
||||
const PointerDownEvent({
|
||||
Duration timeStamp: Duration.ZERO,
|
||||
Duration timeStamp: Duration.zero,
|
||||
int pointer: 0,
|
||||
PointerDeviceKind kind: PointerDeviceKind.touch,
|
||||
int device: 0,
|
||||
@ -462,7 +462,7 @@ class PointerMoveEvent extends PointerEvent {
|
||||
///
|
||||
/// All of the argument must be non-null.
|
||||
const PointerMoveEvent({
|
||||
Duration timeStamp: Duration.ZERO,
|
||||
Duration timeStamp: Duration.zero,
|
||||
int pointer: 0,
|
||||
PointerDeviceKind kind: PointerDeviceKind.touch,
|
||||
int device: 0,
|
||||
@ -512,7 +512,7 @@ class PointerUpEvent extends PointerEvent {
|
||||
///
|
||||
/// All of the argument must be non-null.
|
||||
const PointerUpEvent({
|
||||
Duration timeStamp: Duration.ZERO,
|
||||
Duration timeStamp: Duration.zero,
|
||||
int pointer: 0,
|
||||
PointerDeviceKind kind: PointerDeviceKind.touch,
|
||||
int device: 0,
|
||||
@ -553,7 +553,7 @@ class PointerCancelEvent extends PointerEvent {
|
||||
///
|
||||
/// All of the argument must be non-null.
|
||||
const PointerCancelEvent({
|
||||
Duration timeStamp: Duration.ZERO,
|
||||
Duration timeStamp: Duration.zero,
|
||||
int pointer: 0,
|
||||
PointerDeviceKind kind: PointerDeviceKind.touch,
|
||||
int device: 0,
|
||||
|
@ -237,7 +237,7 @@ class _TapGesture extends _TapTracker {
|
||||
entry: GestureBinding.instance.gestureArena.add(event.pointer, gestureRecognizer)
|
||||
) {
|
||||
startTrackingPointer(handleEvent);
|
||||
if (longTapDelay > Duration.ZERO) {
|
||||
if (longTapDelay > Duration.zero) {
|
||||
_timer = new Timer(longTapDelay, () {
|
||||
_timer = null;
|
||||
gestureRecognizer._dispatchLongTap(event.pointer, _lastPosition);
|
||||
@ -313,10 +313,10 @@ class _TapGesture extends _TapTracker {
|
||||
class MultiTapGestureRecognizer extends GestureRecognizer {
|
||||
/// 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].
|
||||
MultiTapGestureRecognizer({
|
||||
this.longTapDelay: Duration.ZERO,
|
||||
this.longTapDelay: Duration.zero,
|
||||
Object debugOwner,
|
||||
}) : super(debugOwner: debugOwner);
|
||||
|
||||
|
@ -62,17 +62,17 @@ class MaterialPointArcTween extends Tween<Offset> {
|
||||
_beginAngle = sweepAngle() * (begin.dy - end.dy).sign;
|
||||
_endAngle = 0.0;
|
||||
} else {
|
||||
_beginAngle = math.PI + sweepAngle() * (end.dy - begin.dy).sign;
|
||||
_endAngle = math.PI;
|
||||
_beginAngle = math.pi + sweepAngle() * (end.dy - begin.dy).sign;
|
||||
_endAngle = math.pi;
|
||||
}
|
||||
} else {
|
||||
_radius = distanceFromAtoB * distanceFromAtoB / (c - end).distance / 2.0;
|
||||
_center = new Offset(begin.dx, begin.dy + (end.dy - begin.dy).sign * _radius);
|
||||
if (begin.dy < end.dy) {
|
||||
_beginAngle = -math.PI / 2.0;
|
||||
_beginAngle = -math.pi / 2.0;
|
||||
_endAngle = _beginAngle + sweepAngle() * (end.dx - begin.dx).sign;
|
||||
} else {
|
||||
_beginAngle = math.PI / 2.0;
|
||||
_beginAngle = math.pi / 2.0;
|
||||
_endAngle = _beginAngle + sweepAngle() * (begin.dx - end.dx).sign;
|
||||
}
|
||||
}
|
||||
|
@ -705,7 +705,7 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin {
|
||||
_opacityController.value = widget.visible ? 1.0 : 0.0;
|
||||
_orientationAnimation = new Tween<double>(
|
||||
begin: 0.0,
|
||||
end: math.PI,
|
||||
end: math.pi,
|
||||
).animate(new CurvedAnimation(
|
||||
parent: _orientationController = new AnimationController(
|
||||
duration: widget.duration,
|
||||
@ -716,7 +716,7 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin {
|
||||
..addListener(_rebuild)
|
||||
..addStatusListener(_resetOrientationAnimation);
|
||||
if (widget.visible)
|
||||
_orientationOffset = widget.down ? 0.0 : math.PI;
|
||||
_orientationOffset = widget.down ? 0.0 : math.pi;
|
||||
}
|
||||
|
||||
void _rebuild() {
|
||||
@ -727,8 +727,8 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin {
|
||||
|
||||
void _resetOrientationAnimation(AnimationStatus status) {
|
||||
if (status == AnimationStatus.completed) {
|
||||
assert(_orientationAnimation.value == math.PI);
|
||||
_orientationOffset += math.PI;
|
||||
assert(_orientationAnimation.value == math.pi);
|
||||
_orientationOffset += math.pi;
|
||||
_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)) {
|
||||
_orientationController.stop();
|
||||
_orientationController.value = 0.0;
|
||||
_orientationOffset = newDown ? 0.0 : math.PI;
|
||||
_orientationOffset = newDown ? 0.0 : math.pi;
|
||||
skipArrow = true;
|
||||
}
|
||||
if (widget.visible) {
|
||||
|
@ -204,7 +204,7 @@ class _DayPickerGridDelegate extends SliverGridDelegate {
|
||||
|
||||
@override
|
||||
SliverGridLayout getLayout(SliverConstraints constraints) {
|
||||
final int columnCount = DateTime.DAYS_PER_WEEK;
|
||||
final int columnCount = DateTime.daysPerWeek;
|
||||
final double tileWidth = constraints.crossAxisExtent / columnCount;
|
||||
final double tileHeight = math.min(_kDayPickerRowHeight, constraints.viewportMainAxisExtent / (_kMaxDayPickerRowCount + 1));
|
||||
return new SliverGridRegularTileLayout(
|
||||
@ -319,7 +319,7 @@ class DayPicker extends StatelessWidget {
|
||||
/// 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.
|
||||
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);
|
||||
if (isLeapYear)
|
||||
return 29;
|
||||
|
@ -365,19 +365,19 @@ class OutlineInputBorder extends InputBorder {
|
||||
center.blRadiusY * 2.0,
|
||||
);
|
||||
|
||||
final double cornerArcSweep = math.PI / 2.0;
|
||||
final double cornerArcSweep = math.pi / 2.0;
|
||||
final double tlCornerArcSweep = start < center.tlRadiusX
|
||||
? math.asin(start / center.tlRadiusX)
|
||||
: math.PI / 2.0;
|
||||
: math.pi / 2.0;
|
||||
|
||||
final Path path = new Path()
|
||||
..addArc(tlCorner, math.PI, tlCornerArcSweep)
|
||||
..addArc(tlCorner, math.pi, tlCornerArcSweep)
|
||||
..moveTo(center.left + center.tlRadiusX, center.top);
|
||||
|
||||
if (start > center.tlRadiusX)
|
||||
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;
|
||||
if (start + extent < center.width - center.trRadiusX) {
|
||||
path
|
||||
@ -395,7 +395,7 @@ class OutlineInputBorder extends InputBorder {
|
||||
..lineTo(center.right, center.bottom - center.brRadiusY)
|
||||
..addArc(brCorner, 0.0, cornerArcSweep)
|
||||
..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);
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
|
||||
/// function, rather than constructing this class directly.
|
||||
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>[
|
||||
'Mon',
|
||||
'Tue',
|
||||
@ -316,7 +316,7 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
|
||||
'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>[
|
||||
'Monday',
|
||||
'Tuesday',
|
||||
@ -402,21 +402,21 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
|
||||
|
||||
@override
|
||||
String formatMediumDate(DateTime date) {
|
||||
final String day = _shortWeekdays[date.weekday - DateTime.MONDAY];
|
||||
final String month = _shortMonths[date.month - DateTime.JANUARY];
|
||||
final String day = _shortWeekdays[date.weekday - DateTime.monday];
|
||||
final String month = _shortMonths[date.month - DateTime.january];
|
||||
return '$day, $month ${date.day}';
|
||||
}
|
||||
|
||||
@override
|
||||
String formatFullDate(DateTime date) {
|
||||
final String month = _months[date.month - DateTime.JANUARY];
|
||||
return '${_weekdays[date.weekday - DateTime.MONDAY]}, $month ${date.day}, ${date.year}';
|
||||
final String month = _months[date.month - DateTime.january];
|
||||
return '${_weekdays[date.weekday - DateTime.monday]}, $month ${date.day}, ${date.year}';
|
||||
}
|
||||
|
||||
@override
|
||||
String formatMonthYear(DateTime 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';
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ class _LinearProgressIndicatorState extends State<LinearProgressIndicator> with
|
||||
Widget _buildIndicator(BuildContext context, double animationValue, TextDirection textDirection) {
|
||||
return new Container(
|
||||
constraints: const BoxConstraints.tightFor(
|
||||
width: double.INFINITY,
|
||||
width: double.infinity,
|
||||
height: _kLinearProgressIndicatorHeight,
|
||||
),
|
||||
child: new CustomPaint(
|
||||
@ -236,11 +236,11 @@ class _LinearProgressIndicatorState extends State<LinearProgressIndicator> with
|
||||
}
|
||||
|
||||
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;
|
||||
// Canvas.drawArc(r, 0, 2*PI) doesn't draw anything, so just get close.
|
||||
static const double _kSweep = _kTwoPI - _kEpsilon;
|
||||
static const double _kStartAngle = -math.PI / 2.0;
|
||||
static const double _kStartAngle = -math.pi / 2.0;
|
||||
|
||||
_CircularProgressIndicatorPainter({
|
||||
this.valueColor,
|
||||
@ -252,10 +252,10 @@ class _CircularProgressIndicatorPainter extends CustomPainter {
|
||||
this.strokeWidth,
|
||||
}) : arcStart = value != null
|
||||
? _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
|
||||
? 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 double value;
|
||||
|
@ -169,14 +169,14 @@ class _MaterialTextSelectionControls extends TextSelectionControls {
|
||||
switch (type) {
|
||||
case TextSelectionHandleType.left: // points up-right
|
||||
return new Transform(
|
||||
transform: new Matrix4.rotationZ(math.PI / 2.0),
|
||||
transform: new Matrix4.rotationZ(math.pi / 2.0),
|
||||
child: handle
|
||||
);
|
||||
case TextSelectionHandleType.right: // points up-left
|
||||
return handle;
|
||||
case TextSelectionHandleType.collapsed: // points up
|
||||
return new Transform(
|
||||
transform: new Matrix4.rotationZ(math.PI / 4.0),
|
||||
transform: new Matrix4.rotationZ(math.pi / 4.0),
|
||||
child: handle
|
||||
);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ import 'time.dart';
|
||||
import 'typography.dart';
|
||||
|
||||
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);
|
||||
|
||||
enum _TimePickerMode { hour, minute }
|
||||
@ -861,7 +861,7 @@ class _DialPainter extends CustomPainter {
|
||||
if (labels == null)
|
||||
return;
|
||||
final double labelThetaIncrement = -_kTwoPi / labels.length;
|
||||
double labelTheta = math.PI / 2.0;
|
||||
double labelTheta = math.pi / 2.0;
|
||||
|
||||
for (_TappableLabel label in labels) {
|
||||
final TextPainter labelPainter = label.painter;
|
||||
@ -931,7 +931,7 @@ class _DialPainter extends CustomPainter {
|
||||
if (labels == null)
|
||||
return;
|
||||
final double labelThetaIncrement = -_kTwoPi / labels.length;
|
||||
double labelTheta = math.PI / 2.0;
|
||||
double labelTheta = math.pi / 2.0;
|
||||
|
||||
for (_TappableLabel label in labels) {
|
||||
final TextPainter labelPainter = label.painter;
|
||||
@ -1078,7 +1078,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
|
||||
final double fraction = widget.mode == _TimePickerMode.hour
|
||||
? (time.hour / TimeOfDay.hoursPerPeriod) % TimeOfDay.hoursPerPeriod
|
||||
: (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) {
|
||||
@ -1115,7 +1115,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
|
||||
void _updateThetaForPan() {
|
||||
setState(() {
|
||||
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
|
||||
..begin = angle
|
||||
..end = angle; // The controller doesn't animate during the pan gesture.
|
||||
|
@ -210,11 +210,11 @@ class AssetImage extends AssetBundleImageProvider {
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
static Future<Map<String, List<String>>> _manifestParser(String json) {
|
||||
if (json == null)
|
||||
static Future<Map<String, List<String>>> _manifestParser(String jsonData) {
|
||||
if (jsonData == null)
|
||||
return null;
|
||||
// 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 Map<String, List<String>> parsedManifest =
|
||||
new Map<String, List<String>>.fromIterables(keys,
|
||||
|
@ -228,7 +228,7 @@ class TextPainter {
|
||||
builder.pushStyle(text.style.getTextStyle(textScaleFactor: textScaleFactor));
|
||||
builder.addText(_kZeroWidthSpace);
|
||||
_layoutTemplate = builder.build()
|
||||
..layout(new ui.ParagraphConstraints(width: double.INFINITY));
|
||||
..layout(new ui.ParagraphConstraints(width: double.infinity));
|
||||
}
|
||||
return _layoutTemplate.height;
|
||||
}
|
||||
@ -297,7 +297,7 @@ class TextPainter {
|
||||
builder.pushStyle(text.style.getTextStyle(textScaleFactor: textScaleFactor));
|
||||
builder.addText(_kZeroWidthSpace);
|
||||
final ui.Paragraph paragraph = builder.build()
|
||||
..layout(new ui.ParagraphConstraints(width: double.INFINITY));
|
||||
..layout(new ui.ParagraphConstraints(width: double.infinity));
|
||||
|
||||
switch (baseline) {
|
||||
case TextBaseline.alphabetic:
|
||||
@ -351,7 +351,7 @@ class TextPainter {
|
||||
///
|
||||
/// The [text] and [textDirection] properties must be non-null before this is
|
||||
/// 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(textDirection != null, 'TextPainter.textDirection must be set to a non-null value before using the TextPainter.');
|
||||
if (!_needsLayout && minWidth == _lastMinWidth && maxWidth == _lastMaxWidth)
|
||||
|
@ -22,10 +22,10 @@ class ClampedSimulation extends Simulation {
|
||||
/// The named arguments specify the ranges for the clamping behavior, as
|
||||
/// applied to [x] and [dx].
|
||||
ClampedSimulation(this.simulation, {
|
||||
this.xMin: double.NEGATIVE_INFINITY,
|
||||
this.xMax: double.INFINITY,
|
||||
this.dxMin: double.NEGATIVE_INFINITY,
|
||||
this.dxMax: double.INFINITY
|
||||
this.xMin: double.negativeInfinity,
|
||||
this.xMax: double.infinity,
|
||||
this.dxMin: double.negativeInfinity,
|
||||
this.dxMax: double.infinity
|
||||
}) : assert(simulation != null),
|
||||
assert(xMax >= xMin),
|
||||
assert(dxMax >= dxMin);
|
||||
|
@ -62,7 +62,7 @@ class FrictionSimulation extends Simulation {
|
||||
// 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
|
||||
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
|
||||
@ -71,17 +71,17 @@ class FrictionSimulation extends Simulation {
|
||||
@override
|
||||
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;
|
||||
|
||||
/// 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) {
|
||||
if (x == _x)
|
||||
return 0.0;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -191,12 +191,12 @@ class _CriticalSolution implements _SpringSolution {
|
||||
|
||||
@override
|
||||
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
|
||||
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;
|
||||
}
|
||||
|
||||
@ -228,14 +228,14 @@ class _OverdampedSolution implements _SpringSolution {
|
||||
|
||||
@override
|
||||
double x(double time) {
|
||||
return _c1 * math.pow(math.E, _r1 * time) +
|
||||
_c2 * math.pow(math.E, _r2 * time);
|
||||
return _c1 * math.pow(math.e, _r1 * time) +
|
||||
_c2 * math.pow(math.e, _r2 * time);
|
||||
}
|
||||
|
||||
@override
|
||||
double dx(double time) {
|
||||
return _c1 * _r1 * math.pow(math.E, _r1 * time) +
|
||||
_c2 * _r2 * math.pow(math.E, _r2 * time);
|
||||
return _c1 * _r1 * math.pow(math.e, _r1 * time) +
|
||||
_c2 * _r2 * math.pow(math.e, _r2 * time);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -266,13 +266,13 @@ class _UnderdampedSolution implements _SpringSolution {
|
||||
|
||||
@override
|
||||
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));
|
||||
}
|
||||
|
||||
@override
|
||||
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 sine = math.sin(_w * time);
|
||||
return power * (_c2 * _w * cosine - _c1 * _w * sine) +
|
||||
|
@ -30,10 +30,10 @@ class _DebugSize extends Size {
|
||||
///
|
||||
/// The constraints themselves must satisfy these relations:
|
||||
///
|
||||
/// * 0.0 <= [minWidth] <= [maxWidth] <= [double.INFINITY]
|
||||
/// * 0.0 <= [minHeight] <= [maxHeight] <= [double.INFINITY]
|
||||
/// * 0.0 <= [minWidth] <= [maxWidth] <= [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
|
||||
///
|
||||
@ -83,9 +83,9 @@ class BoxConstraints extends Constraints {
|
||||
/// Creates box constraints with the given constraints.
|
||||
const BoxConstraints({
|
||||
this.minWidth: 0.0,
|
||||
this.maxWidth: double.INFINITY,
|
||||
this.maxWidth: double.infinity,
|
||||
this.minHeight: 0.0,
|
||||
this.maxHeight: double.INFINITY
|
||||
this.maxHeight: double.infinity
|
||||
});
|
||||
|
||||
/// The minimum width that satisfies the constraints.
|
||||
@ -93,7 +93,7 @@ class BoxConstraints extends Constraints {
|
||||
|
||||
/// The maximum width that satisfies the constraints.
|
||||
///
|
||||
/// Might be [double.INFINITY].
|
||||
/// Might be [double.infinity].
|
||||
final double maxWidth;
|
||||
|
||||
/// The minimum height that satisfies the constraints.
|
||||
@ -101,7 +101,7 @@ class BoxConstraints extends Constraints {
|
||||
|
||||
/// The maximum height that satisfies the constraints.
|
||||
///
|
||||
/// Might be [double.INFINITY].
|
||||
/// Might be [double.infinity].
|
||||
final double maxHeight;
|
||||
|
||||
/// Creates box constraints that is respected only by the given size.
|
||||
@ -122,9 +122,9 @@ class BoxConstraints extends Constraints {
|
||||
double width,
|
||||
double height
|
||||
}): minWidth = width != null ? width : 0.0,
|
||||
maxWidth = width != null ? width : double.INFINITY,
|
||||
maxWidth = width != null ? width : double.infinity,
|
||||
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
|
||||
/// they are infinite.
|
||||
@ -134,12 +134,12 @@ class BoxConstraints extends Constraints {
|
||||
/// * [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.
|
||||
const BoxConstraints.tightForFinite({
|
||||
double width: double.INFINITY,
|
||||
double height: double.INFINITY
|
||||
}): minWidth = width != double.INFINITY ? width : 0.0,
|
||||
maxWidth = width != double.INFINITY ? width : double.INFINITY,
|
||||
minHeight = height != double.INFINITY ? height : 0.0,
|
||||
maxHeight = height != double.INFINITY ? height : double.INFINITY;
|
||||
double width: double.infinity,
|
||||
double height: double.infinity
|
||||
}): minWidth = width != double.infinity ? width : 0.0,
|
||||
maxWidth = width != double.infinity ? width : double.infinity,
|
||||
minHeight = height != double.infinity ? height : 0.0,
|
||||
maxHeight = height != double.infinity ? height : double.infinity;
|
||||
|
||||
/// Creates box constraints that forbid sizes larger than the given size.
|
||||
BoxConstraints.loose(Size size)
|
||||
@ -155,10 +155,10 @@ class BoxConstraints extends Constraints {
|
||||
const BoxConstraints.expand({
|
||||
double width,
|
||||
double height
|
||||
}): minWidth = width != null ? width : double.INFINITY,
|
||||
maxWidth = width != null ? width : double.INFINITY,
|
||||
minHeight = height != null ? height : double.INFINITY,
|
||||
maxHeight = height != null ? height : double.INFINITY;
|
||||
}): minWidth = width != null ? width : double.infinity,
|
||||
maxWidth = width != null ? width : double.infinity,
|
||||
minHeight = 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.
|
||||
BoxConstraints copyWith({
|
||||
@ -243,14 +243,14 @@ class BoxConstraints extends Constraints {
|
||||
|
||||
/// Returns the width that both satisfies the constraints and is as close as
|
||||
/// possible to the given width.
|
||||
double constrainWidth([double width = double.INFINITY]) {
|
||||
double constrainWidth([double width = double.infinity]) {
|
||||
assert(debugAssertIsValid());
|
||||
return width.clamp(minWidth, maxWidth);
|
||||
}
|
||||
|
||||
/// Returns the height that both satisfies the constraints and is as close as
|
||||
/// possible to the given height.
|
||||
double constrainHeight([double height = double.INFINITY]) {
|
||||
double constrainHeight([double height = double.infinity]) {
|
||||
assert(debugAssertIsValid());
|
||||
return height.clamp(minHeight, maxHeight);
|
||||
}
|
||||
@ -346,10 +346,10 @@ class BoxConstraints extends Constraints {
|
||||
bool get isTight => hasTightWidth && hasTightHeight;
|
||||
|
||||
/// 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.
|
||||
bool get hasBoundedHeight => maxHeight < double.INFINITY;
|
||||
bool get hasBoundedHeight => maxHeight < double.infinity;
|
||||
|
||||
/// Whether the given size satisfies the constraints.
|
||||
bool isSatisfiedBy(Size size) {
|
||||
@ -424,15 +424,15 @@ class BoxConstraints extends Constraints {
|
||||
return a * (1.0 - t);
|
||||
assert(a.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.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.maxHeight.isFinite && b.maxHeight.isFinite) || (a.maxHeight == double.INFINITY && b.maxHeight == 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.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.');
|
||||
return new BoxConstraints(
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
);
|
||||
}
|
||||
|
||||
@ -557,10 +557,10 @@ class BoxConstraints extends Constraints {
|
||||
@override
|
||||
String toString() {
|
||||
final String annotation = isNormalized ? '' : '; NOT NORMALIZED';
|
||||
if (minWidth == double.INFINITY && minHeight == double.INFINITY)
|
||||
if (minWidth == double.infinity && minHeight == double.infinity)
|
||||
return 'BoxConstraints(biggest$annotation)';
|
||||
if (minWidth == 0 && maxWidth == double.INFINITY &&
|
||||
minHeight == 0 && maxHeight == double.INFINITY)
|
||||
if (minWidth == 0 && maxWidth == double.infinity &&
|
||||
minHeight == 0 && maxHeight == double.infinity)
|
||||
return 'BoxConstraints(unconstrained$annotation)';
|
||||
String describe(double min, double max, String dim) {
|
||||
if (min == max)
|
||||
@ -1089,7 +1089,7 @@ abstract class RenderBox extends RenderObject {
|
||||
throw new FlutterError(
|
||||
'The height argument to getMinIntrinsicWidth was null.\n'
|
||||
'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) {
|
||||
@ -1228,7 +1228,7 @@ abstract class RenderBox extends RenderObject {
|
||||
throw new FlutterError(
|
||||
'The height argument to getMaxIntrinsicWidth was null.\n'
|
||||
'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) {
|
||||
@ -1304,7 +1304,7 @@ abstract class RenderBox extends RenderObject {
|
||||
throw new FlutterError(
|
||||
'The width argument to getMinIntrinsicHeight was null.\n'
|
||||
'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) {
|
||||
@ -1377,7 +1377,7 @@ abstract class RenderBox extends RenderObject {
|
||||
throw new FlutterError(
|
||||
'The width argument to getMaxIntrinsicHeight was null.\n'
|
||||
'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) {
|
||||
@ -1747,8 +1747,8 @@ abstract class RenderBox extends RenderObject {
|
||||
}
|
||||
}
|
||||
|
||||
testIntrinsicsForValues(getMinIntrinsicWidth, getMaxIntrinsicWidth, 'Width', double.INFINITY);
|
||||
testIntrinsicsForValues(getMinIntrinsicHeight, getMaxIntrinsicHeight, 'Height', double.INFINITY);
|
||||
testIntrinsicsForValues(getMinIntrinsicWidth, getMaxIntrinsicWidth, 'Width', double.infinity);
|
||||
testIntrinsicsForValues(getMinIntrinsicHeight, getMaxIntrinsicHeight, 'Height', double.infinity);
|
||||
if (constraints.hasBoundedWidth)
|
||||
testIntrinsicsForValues(getMinIntrinsicWidth, getMaxIntrinsicWidth, 'Width', constraints.maxWidth);
|
||||
if (constraints.hasBoundedHeight)
|
||||
|
@ -148,7 +148,7 @@ abstract class DebugOverflowIndicatorMixin extends RenderObject {
|
||||
label: 'LEFT OVERFLOWED BY ${_formatPixels(overflow.left)} PIXELS',
|
||||
labelOffset: markerRect.centerLeft +
|
||||
const Offset(_indicatorFontSizePixels + _indicatorLabelPaddingPixels, 0.0),
|
||||
rotation: math.PI / 2.0,
|
||||
rotation: math.pi / 2.0,
|
||||
side: _OverflowSide.left,
|
||||
));
|
||||
}
|
||||
@ -164,7 +164,7 @@ abstract class DebugOverflowIndicatorMixin extends RenderObject {
|
||||
label: 'RIGHT OVERFLOWED BY ${_formatPixels(overflow.right)} PIXELS',
|
||||
labelOffset: markerRect.centerRight -
|
||||
const Offset(_indicatorFontSizePixels + _indicatorLabelPaddingPixels, 0.0),
|
||||
rotation: -math.PI / 2.0,
|
||||
rotation: -math.pi / 2.0,
|
||||
side: _OverflowSide.right,
|
||||
));
|
||||
}
|
||||
|
@ -512,13 +512,13 @@ class RenderEditable extends RenderBox {
|
||||
|
||||
@override
|
||||
double computeMinIntrinsicWidth(double height) {
|
||||
_layoutText(double.INFINITY);
|
||||
_layoutText(double.infinity);
|
||||
return _textPainter.minIntrinsicWidth;
|
||||
}
|
||||
|
||||
@override
|
||||
double computeMaxIntrinsicWidth(double height) {
|
||||
_layoutText(double.INFINITY);
|
||||
_layoutText(double.infinity);
|
||||
return _textPainter.maxIntrinsicWidth;
|
||||
}
|
||||
|
||||
@ -529,7 +529,7 @@ class RenderEditable extends RenderBox {
|
||||
double _preferredHeight(double width) {
|
||||
if (maxLines != null)
|
||||
return preferredLineHeight * maxLines;
|
||||
if (width == double.INFINITY) {
|
||||
if (width == double.infinity) {
|
||||
final String text = _textPainter.text.toPlainText();
|
||||
int lines = 1;
|
||||
for (int index = 0; index < text.length; index += 1) {
|
||||
@ -646,7 +646,7 @@ class RenderEditable extends RenderBox {
|
||||
return;
|
||||
final double caretMargin = _kCaretGap + _kCaretWidth;
|
||||
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);
|
||||
_textLayoutLastWidth = constraintWidth;
|
||||
}
|
||||
|
@ -524,11 +524,11 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
if (flex == 0) {
|
||||
switch (_direction) {
|
||||
case Axis.horizontal:
|
||||
mainSize = child.getMaxIntrinsicWidth(double.INFINITY);
|
||||
mainSize = child.getMaxIntrinsicWidth(double.infinity);
|
||||
crossSize = childSize(child, mainSize);
|
||||
break;
|
||||
case Axis.vertical:
|
||||
mainSize = child.getMaxIntrinsicHeight(double.INFINITY);
|
||||
mainSize = child.getMaxIntrinsicHeight(double.infinity);
|
||||
crossSize = childSize(child, mainSize);
|
||||
break;
|
||||
}
|
||||
@ -639,7 +639,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
int totalChildren = 0;
|
||||
assert(constraints != null);
|
||||
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 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 maxBaselineDistance = 0.0;
|
||||
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;
|
||||
while (child != null) {
|
||||
final int flex = _getFlex(child);
|
||||
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;
|
||||
switch (_getFit(child)) {
|
||||
case FlexFit.tight:
|
||||
assert(maxChildExtent < double.INFINITY);
|
||||
assert(maxChildExtent < double.infinity);
|
||||
minChildExtent = maxChildExtent;
|
||||
break;
|
||||
case FlexFit.loose:
|
||||
|
@ -502,7 +502,7 @@ abstract class Constraints {
|
||||
/// This might involve checks more detailed than [isNormalized].
|
||||
///
|
||||
/// 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
|
||||
/// are enforced. This argument is set to true when checking constraints that
|
||||
|
@ -174,9 +174,9 @@ class RenderParagraph extends RenderBox {
|
||||
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;
|
||||
_textPainter.layout(minWidth: minWidth, maxWidth: widthMatters ? maxWidth : double.INFINITY);
|
||||
_textPainter.layout(minWidth: minWidth, maxWidth: widthMatters ? maxWidth : double.infinity);
|
||||
}
|
||||
|
||||
void _layoutTextWithConstraints(BoxConstraints constraints) {
|
||||
|
@ -162,7 +162,7 @@ class RenderPerformanceOverlay extends RenderBox {
|
||||
|
||||
@override
|
||||
void performResize() {
|
||||
size = constraints.constrain(new Size(double.INFINITY, _intrinsicHeight));
|
||||
size = constraints.constrain(new Size(double.infinity, _intrinsicHeight));
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -302,8 +302,8 @@ class RenderLimitedBox extends RenderProxyBox {
|
||||
/// non-negative.
|
||||
RenderLimitedBox({
|
||||
RenderBox child,
|
||||
double maxWidth: double.INFINITY,
|
||||
double maxHeight: double.INFINITY
|
||||
double maxWidth: double.infinity,
|
||||
double maxHeight: double.infinity
|
||||
}) : assert(maxWidth != null && maxWidth >= 0.0),
|
||||
assert(maxHeight != null && maxHeight >= 0.0),
|
||||
_maxWidth = maxWidth,
|
||||
@ -354,8 +354,8 @@ class RenderLimitedBox extends RenderProxyBox {
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder description) {
|
||||
super.debugFillProperties(description);
|
||||
description.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.INFINITY));
|
||||
description.add(new DoubleProperty('maxHeight', maxHeight, defaultValue: double.INFINITY));
|
||||
description.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.infinity));
|
||||
description.add(new DoubleProperty('maxHeight', maxHeight, defaultValue: double.infinity));
|
||||
}
|
||||
}
|
||||
|
||||
@ -591,7 +591,7 @@ class RenderIntrinsicWidth extends RenderProxyBox {
|
||||
if (child == null)
|
||||
return 0.0;
|
||||
if (!width.isFinite)
|
||||
width = computeMaxIntrinsicWidth(double.INFINITY);
|
||||
width = computeMaxIntrinsicWidth(double.infinity);
|
||||
assert(width.isFinite);
|
||||
final double height = child.getMinIntrinsicHeight(width);
|
||||
return _applyStep(height, _stepHeight);
|
||||
@ -602,7 +602,7 @@ class RenderIntrinsicWidth extends RenderProxyBox {
|
||||
if (child == null)
|
||||
return 0.0;
|
||||
if (!width.isFinite)
|
||||
width = computeMaxIntrinsicWidth(double.INFINITY);
|
||||
width = computeMaxIntrinsicWidth(double.infinity);
|
||||
assert(width.isFinite);
|
||||
final double height = child.getMaxIntrinsicHeight(width);
|
||||
return _applyStep(height, _stepHeight);
|
||||
@ -658,7 +658,7 @@ class RenderIntrinsicHeight extends RenderProxyBox {
|
||||
if (child == null)
|
||||
return 0.0;
|
||||
if (!height.isFinite)
|
||||
height = child.getMaxIntrinsicHeight(double.INFINITY);
|
||||
height = child.getMaxIntrinsicHeight(double.infinity);
|
||||
assert(height.isFinite);
|
||||
return child.getMinIntrinsicWidth(height);
|
||||
}
|
||||
@ -668,7 +668,7 @@ class RenderIntrinsicHeight extends RenderProxyBox {
|
||||
if (child == null)
|
||||
return 0.0;
|
||||
if (!height.isFinite)
|
||||
height = child.getMaxIntrinsicHeight(double.INFINITY);
|
||||
height = child.getMaxIntrinsicHeight(double.infinity);
|
||||
assert(height.isFinite);
|
||||
return child.getMaxIntrinsicWidth(height);
|
||||
}
|
||||
@ -4039,10 +4039,10 @@ class RenderFollowerLayer extends RenderProxyBox {
|
||||
Offset.zero,
|
||||
childPaintBounds: new Rect.fromLTRB(
|
||||
// We don't know where we'll end up, so we have no idea what our cull rect should be.
|
||||
double.NEGATIVE_INFINITY,
|
||||
double.NEGATIVE_INFINITY,
|
||||
double.INFINITY,
|
||||
double.INFINITY,
|
||||
double.negativeInfinity,
|
||||
double.negativeInfinity,
|
||||
double.infinity,
|
||||
double.infinity,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import 'package:vector_math/vector_math_64.dart';
|
||||
import 'box.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.
|
||||
///
|
||||
|
@ -149,7 +149,7 @@ class RenderPadding extends RenderShiftedBox {
|
||||
_resolve();
|
||||
final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right;
|
||||
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 totalHorizontalPadding;
|
||||
}
|
||||
@ -159,7 +159,7 @@ class RenderPadding extends RenderShiftedBox {
|
||||
_resolve();
|
||||
final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right;
|
||||
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 totalHorizontalPadding;
|
||||
}
|
||||
@ -169,7 +169,7 @@ class RenderPadding extends RenderShiftedBox {
|
||||
_resolve();
|
||||
final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right;
|
||||
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 totalVerticalPadding;
|
||||
}
|
||||
@ -179,7 +179,7 @@ class RenderPadding extends RenderShiftedBox {
|
||||
_resolve();
|
||||
final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right;
|
||||
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 totalVerticalPadding;
|
||||
}
|
||||
@ -374,17 +374,17 @@ class RenderPositionedBox extends RenderAligningShiftedBox {
|
||||
|
||||
@override
|
||||
void performLayout() {
|
||||
final bool shrinkWrapWidth = _widthFactor != null || constraints.maxWidth == double.INFINITY;
|
||||
final bool shrinkWrapHeight = _heightFactor != null || constraints.maxHeight == double.INFINITY;
|
||||
final bool shrinkWrapWidth = _widthFactor != null || constraints.maxWidth == double.infinity;
|
||||
final bool shrinkWrapHeight = _heightFactor != null || constraints.maxHeight == double.infinity;
|
||||
|
||||
if (child != null) {
|
||||
child.layout(constraints.loosen(), parentUsesSize: true);
|
||||
size = constraints.constrain(new Size(shrinkWrapWidth ? child.size.width * (_widthFactor ?? 1.0) : double.INFINITY,
|
||||
shrinkWrapHeight ? child.size.height * (_heightFactor ?? 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));
|
||||
alignChild();
|
||||
} else {
|
||||
size = constraints.constrain(new Size(shrinkWrapWidth ? 0.0 : double.INFINITY,
|
||||
shrinkWrapHeight ? 0.0 : double.INFINITY));
|
||||
size = constraints.constrain(new Size(shrinkWrapWidth ? 0.0 : double.infinity,
|
||||
shrinkWrapHeight ? 0.0 : double.infinity));
|
||||
}
|
||||
}
|
||||
|
||||
@ -870,7 +870,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox {
|
||||
double result;
|
||||
if (child == null) {
|
||||
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));
|
||||
}
|
||||
assert(result.isFinite);
|
||||
@ -882,7 +882,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox {
|
||||
double result;
|
||||
if (child == null) {
|
||||
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));
|
||||
}
|
||||
assert(result.isFinite);
|
||||
@ -894,7 +894,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox {
|
||||
double result;
|
||||
if (child == null) {
|
||||
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));
|
||||
}
|
||||
assert(result.isFinite);
|
||||
@ -906,7 +906,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox {
|
||||
double result;
|
||||
if (child == null) {
|
||||
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));
|
||||
}
|
||||
assert(result.isFinite);
|
||||
|
@ -296,7 +296,7 @@ class SliverConstraints extends Constraints {
|
||||
/// Useful for slivers that have [RenderBox] children.
|
||||
BoxConstraints asBoxConstraints({
|
||||
double minExtent: 0.0,
|
||||
double maxExtent: double.INFINITY,
|
||||
double maxExtent: double.infinity,
|
||||
double crossAxisExtent,
|
||||
}) {
|
||||
crossAxisExtent ??= this.crossAxisExtent;
|
||||
|
@ -97,7 +97,7 @@ class IntrinsicColumnWidth extends TableColumnWidth {
|
||||
double minIntrinsicWidth(Iterable<RenderBox> cells, double containerWidth) {
|
||||
double result = 0.0;
|
||||
for (RenderBox cell in cells)
|
||||
result = math.max(result, cell.getMinIntrinsicWidth(double.INFINITY));
|
||||
result = math.max(result, cell.getMinIntrinsicWidth(double.infinity));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ class IntrinsicColumnWidth extends TableColumnWidth {
|
||||
double maxIntrinsicWidth(Iterable<RenderBox> cells, double containerWidth) {
|
||||
double result = 0.0;
|
||||
for (RenderBox cell in cells)
|
||||
result = math.max(result, cell.getMaxIntrinsicWidth(double.INFINITY));
|
||||
result = math.max(result, cell.getMaxIntrinsicWidth(double.infinity));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -726,7 +726,7 @@ class RenderTable extends RenderBox {
|
||||
for (int x = 0; x < columns; x += 1) {
|
||||
final TableColumnWidth columnWidth = _columnWidths[x] ?? defaultColumnWidth;
|
||||
final Iterable<RenderBox> columnCells = column(x);
|
||||
totalMinWidth += columnWidth.minIntrinsicWidth(columnCells, double.INFINITY);
|
||||
totalMinWidth += columnWidth.minIntrinsicWidth(columnCells, double.infinity);
|
||||
}
|
||||
return totalMinWidth;
|
||||
}
|
||||
@ -738,7 +738,7 @@ class RenderTable extends RenderBox {
|
||||
for (int x = 0; x < columns; x += 1) {
|
||||
final TableColumnWidth columnWidth = _columnWidths[x] ?? defaultColumnWidth;
|
||||
final Iterable<RenderBox> columnCells = column(x);
|
||||
totalMaxWidth += columnWidth.maxIntrinsicWidth(columnCells, double.INFINITY);
|
||||
totalMaxWidth += columnWidth.maxIntrinsicWidth(columnCells, double.infinity);
|
||||
}
|
||||
return totalMaxWidth;
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
|
||||
int childCount = 0;
|
||||
RenderBox child = firstChild;
|
||||
while (child != null) {
|
||||
final double childWidth = child.getMaxIntrinsicWidth(double.INFINITY);
|
||||
final double childWidth = child.getMaxIntrinsicWidth(double.infinity);
|
||||
final double childHeight = child.getMaxIntrinsicHeight(childWidth);
|
||||
if (runWidth + childWidth > width) {
|
||||
height += runHeight;
|
||||
@ -422,7 +422,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
|
||||
int childCount = 0;
|
||||
RenderBox child = firstChild;
|
||||
while (child != null) {
|
||||
final double childHeight = child.getMaxIntrinsicHeight(double.INFINITY);
|
||||
final double childHeight = child.getMaxIntrinsicHeight(double.infinity);
|
||||
final double childWidth = child.getMaxIntrinsicWidth(childHeight);
|
||||
if (runHeight + childHeight > height) {
|
||||
width += runWidth;
|
||||
@ -452,7 +452,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
|
||||
double width = 0.0;
|
||||
RenderBox child = firstChild;
|
||||
while (child != null) {
|
||||
width = math.max(width, child.getMinIntrinsicWidth(double.INFINITY));
|
||||
width = math.max(width, child.getMinIntrinsicWidth(double.infinity));
|
||||
child = childAfter(child);
|
||||
}
|
||||
return width;
|
||||
@ -469,7 +469,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
|
||||
double width = 0.0;
|
||||
RenderBox child = firstChild;
|
||||
while (child != null) {
|
||||
width += child.getMaxIntrinsicWidth(double.INFINITY);
|
||||
width += child.getMaxIntrinsicWidth(double.infinity);
|
||||
child = childAfter(child);
|
||||
}
|
||||
return width;
|
||||
@ -488,7 +488,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
|
||||
double height = 0.0;
|
||||
RenderBox child = firstChild;
|
||||
while (child != null) {
|
||||
height = math.max(height, child.getMinIntrinsicHeight(double.INFINITY));
|
||||
height = math.max(height, child.getMinIntrinsicHeight(double.infinity));
|
||||
child = childAfter(child);
|
||||
}
|
||||
return height;
|
||||
@ -505,7 +505,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
|
||||
double height = 0.0;
|
||||
RenderBox child = firstChild;
|
||||
while (child != null) {
|
||||
height += child.getMaxIntrinsicHeight(double.INFINITY);
|
||||
height += child.getMaxIntrinsicHeight(double.infinity);
|
||||
child = childAfter(child);
|
||||
}
|
||||
return height;
|
||||
|
@ -772,8 +772,8 @@ abstract class SchedulerBinding extends BindingBase with ServicesBinding {
|
||||
}
|
||||
|
||||
Duration _firstRawTimeStampInEpoch;
|
||||
Duration _epochStart = Duration.ZERO;
|
||||
Duration _lastRawTimeStamp = Duration.ZERO;
|
||||
Duration _epochStart = Duration.zero;
|
||||
Duration _lastRawTimeStamp = Duration.zero;
|
||||
|
||||
/// Prepares the scheduler for a non-monotonic change to how time stamps are
|
||||
/// calculated.
|
||||
@ -806,7 +806,7 @@ abstract class SchedulerBinding extends BindingBase with ServicesBinding {
|
||||
/// These mechanisms together combine to ensure that the durations we give
|
||||
/// during frame callbacks are monotonically increasing.
|
||||
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);
|
||||
}
|
||||
|
||||
@ -965,13 +965,13 @@ abstract class SchedulerBinding extends BindingBase with ServicesBinding {
|
||||
if (timeStamp.inDays > 0)
|
||||
buffer.write('${timeStamp.inDays}d ');
|
||||
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)
|
||||
buffer.write('${timeStamp.inMinutes - timeStamp.inHours * Duration.MINUTES_PER_HOUR}m ');
|
||||
buffer.write('${timeStamp.inMinutes - timeStamp.inHours * Duration.minutesPerHour}m ');
|
||||
if (timeStamp.inSeconds > 0)
|
||||
buffer.write('${timeStamp.inSeconds - timeStamp.inMinutes * Duration.SECONDS_PER_MINUTE}s ');
|
||||
buffer.write('${timeStamp.inMilliseconds - timeStamp.inSeconds * Duration.MILLISECONDS_PER_SECOND}');
|
||||
final int microseconds = timeStamp.inMicroseconds - timeStamp.inMilliseconds * Duration.MICROSECONDS_PER_MILLISECOND;
|
||||
buffer.write('${timeStamp.inSeconds - timeStamp.inMinutes * Duration.secondsPerMinute}s ');
|
||||
buffer.write('${timeStamp.inMilliseconds - timeStamp.inSeconds * Duration.millisecondsPerSecond}');
|
||||
final int microseconds = timeStamp.inMicroseconds - timeStamp.inMilliseconds * Duration.microsecondsPerMillisecond;
|
||||
if (microseconds > 0)
|
||||
buffer.write('.${microseconds.toString().padLeft(3, "0")}');
|
||||
buffer.write('ms');
|
||||
|
@ -163,13 +163,13 @@ abstract class CachingAssetBundle extends AssetBundle {
|
||||
if (data.lengthInBytes < 10 * 1024) {
|
||||
// 10KB takes about 3ms to parse on a Pixel 2 XL.
|
||||
// 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"');
|
||||
}
|
||||
|
||||
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,
|
||||
@ -223,7 +223,7 @@ abstract class CachingAssetBundle extends AssetBundle {
|
||||
class PlatformAssetBundle extends CachingAssetBundle {
|
||||
@override
|
||||
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 =
|
||||
await BinaryMessages.send('flutter/assets', encoded.buffer.asByteData());
|
||||
if (asset == null)
|
||||
|
@ -37,14 +37,14 @@ class StringCodec implements MessageCodec<String> {
|
||||
String decodeMessage(ByteData message) {
|
||||
if (message == null)
|
||||
return null;
|
||||
return UTF8.decoder.convert(message.buffer.asUint8List());
|
||||
return utf8.decoder.convert(message.buffer.asUint8List());
|
||||
}
|
||||
|
||||
@override
|
||||
ByteData encodeMessage(String message) {
|
||||
if (message == null)
|
||||
return null;
|
||||
final Uint8List encoded = UTF8.encoder.convert(message);
|
||||
final Uint8List encoded = utf8.encoder.convert(message);
|
||||
return encoded.buffer.asByteData();
|
||||
}
|
||||
}
|
||||
@ -79,14 +79,14 @@ class JSONMessageCodec implements MessageCodec<dynamic> {
|
||||
ByteData encodeMessage(dynamic message) {
|
||||
if (message == null)
|
||||
return null;
|
||||
return const StringCodec().encodeMessage(JSON.encode(message));
|
||||
return const StringCodec().encodeMessage(json.encode(message));
|
||||
}
|
||||
|
||||
@override
|
||||
dynamic decodeMessage(ByteData message) {
|
||||
if (message == null)
|
||||
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);
|
||||
} else if (value is String) {
|
||||
buffer.putUint8(_kString);
|
||||
final List<int> bytes = UTF8.encoder.convert(value);
|
||||
final List<int> bytes = utf8.encoder.convert(value);
|
||||
_writeSize(buffer, bytes.length);
|
||||
buffer.putUint8List(bytes);
|
||||
} else if (value is Uint8List) {
|
||||
@ -380,7 +380,7 @@ class StandardMessageCodec implements MessageCodec<dynamic> {
|
||||
// 2018-01-09 and will be made unavailable.
|
||||
// TODO(mravn): remove this case once the APIs are unavailable.
|
||||
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);
|
||||
break;
|
||||
case _kFloat64:
|
||||
@ -388,7 +388,7 @@ class StandardMessageCodec implements MessageCodec<dynamic> {
|
||||
break;
|
||||
case _kString:
|
||||
final int length = _readSize(buffer);
|
||||
result = UTF8.decoder.convert(buffer.getUint8List(length));
|
||||
result = utf8.decoder.convert(buffer.getUint8List(length));
|
||||
break;
|
||||
case _kUint8List:
|
||||
final int length = _readSize(buffer);
|
||||
|
@ -204,20 +204,20 @@ class BannerPainter extends CustomPainter {
|
||||
switch (location) {
|
||||
case BannerLocation.bottomStart:
|
||||
case BannerLocation.topEnd:
|
||||
return -math.PI / 4.0;
|
||||
return -math.pi / 4.0;
|
||||
case BannerLocation.bottomEnd:
|
||||
case BannerLocation.topStart:
|
||||
return math.PI / 4.0;
|
||||
return math.pi / 4.0;
|
||||
}
|
||||
break;
|
||||
case TextDirection.ltr:
|
||||
switch (location) {
|
||||
case BannerLocation.bottomStart:
|
||||
case BannerLocation.topEnd:
|
||||
return math.PI / 4.0;
|
||||
return math.pi / 4.0;
|
||||
case BannerLocation.bottomEnd:
|
||||
case BannerLocation.topStart:
|
||||
return -math.PI / 4.0;
|
||||
return -math.pi / 4.0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -805,7 +805,7 @@ class PhysicalShape extends SingleChildRenderObjectWidget {
|
||||
/// color: Colors.black,
|
||||
/// child: new Transform(
|
||||
/// 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(
|
||||
/// padding: const EdgeInsets.all(8.0),
|
||||
/// color: const Color(0xFFE8581C),
|
||||
@ -848,7 +848,7 @@ class Transform extends SingleChildRenderObjectWidget {
|
||||
///
|
||||
/// ```dart
|
||||
/// new Transform.rotate(
|
||||
/// angle: -math.PI / 12.0,
|
||||
/// angle: -math.pi / 12.0,
|
||||
/// child: new Container(
|
||||
/// padding: const EdgeInsets.all(8.0),
|
||||
/// 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
|
||||
/// sizes itself to fit the parent. It is equivalent to setting [width] and
|
||||
/// [height] to [double.INFINITY].
|
||||
/// [height] to [double.infinity].
|
||||
///
|
||||
/// ## Sample code
|
||||
///
|
||||
@ -1586,8 +1586,8 @@ class SizedBox extends SingleChildRenderObjectWidget {
|
||||
|
||||
/// Creates a box that will become as large as its parent allows.
|
||||
const SizedBox.expand({ Key key, Widget child })
|
||||
: width = double.INFINITY,
|
||||
height = double.INFINITY,
|
||||
: width = double.infinity,
|
||||
height = double.infinity,
|
||||
super(key: key, child: child);
|
||||
|
||||
/// Creates a box with the specified size.
|
||||
@ -1620,7 +1620,7 @@ class SizedBox extends SingleChildRenderObjectWidget {
|
||||
|
||||
@override
|
||||
String toStringShort() {
|
||||
final String type = (width == double.INFINITY && height == double.INFINITY) ?
|
||||
final String type = (width == double.infinity && height == double.infinity) ?
|
||||
'$runtimeType.expand' : '$runtimeType';
|
||||
return key == null ? '$type' : '$type-$key';
|
||||
}
|
||||
@ -1628,7 +1628,7 @@ class SizedBox extends SingleChildRenderObjectWidget {
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder 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.info;
|
||||
description.add(new DoubleProperty('width', width, defaultValue: null, level: level));
|
||||
@ -1905,8 +1905,8 @@ class LimitedBox extends SingleChildRenderObjectWidget {
|
||||
/// negative.
|
||||
const LimitedBox({
|
||||
Key key,
|
||||
this.maxWidth: double.INFINITY,
|
||||
this.maxHeight: double.INFINITY,
|
||||
this.maxWidth: double.infinity,
|
||||
this.maxHeight: double.infinity,
|
||||
Widget child,
|
||||
}) : assert(maxWidth != null && maxWidth >= 0.0),
|
||||
assert(maxHeight != null && maxHeight >= 0.0),
|
||||
@ -1938,8 +1938,8 @@ class LimitedBox extends SingleChildRenderObjectWidget {
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder description) {
|
||||
super.debugFillProperties(description);
|
||||
description.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.INFINITY));
|
||||
description.add(new DoubleProperty('maxHeight', maxHeight, defaultValue: double.INFINITY));
|
||||
description.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.infinity));
|
||||
description.add(new DoubleProperty('maxHeight', maxHeight, defaultValue: double.infinity));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -971,9 +971,9 @@ class _NestedScrollPosition extends ScrollPosition implements ScrollActivityDele
|
||||
// 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
|
||||
// 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.
|
||||
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 newPixels = (pixels - delta).clamp(min, max);
|
||||
final double clampedDelta = newPixels - pixels;
|
||||
|
@ -308,7 +308,7 @@ class _GlowController extends ChangeNotifier {
|
||||
static const Duration _pullTime = const Duration(milliseconds: 167);
|
||||
static const Duration _pullHoldTime = const Duration(milliseconds: 167);
|
||||
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 _pullOpacityGlowFactor = 0.8;
|
||||
@ -479,7 +479,7 @@ class _GlowingOverscrollIndicatorPainter extends CustomPainter {
|
||||
/// The direction of the viewport.
|
||||
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) {
|
||||
if (controller == null)
|
||||
|
@ -107,7 +107,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
|
||||
AnimationController createAnimationController() {
|
||||
assert(!_transitionCompleter.isCompleted, 'Cannot reuse a $runtimeType after disposing it.');
|
||||
final Duration duration = transitionDuration;
|
||||
assert(duration != null && duration >= Duration.ZERO);
|
||||
assert(duration != null && duration >= Duration.zero);
|
||||
return new AnimationController(
|
||||
duration: duration,
|
||||
debugLabel: debugLabel,
|
||||
|
@ -574,7 +574,7 @@ class DrivenScrollActivity extends ScrollActivity {
|
||||
}) : assert(from != null),
|
||||
assert(to != null),
|
||||
assert(duration != null),
|
||||
assert(duration > Duration.ZERO),
|
||||
assert(duration > Duration.zero),
|
||||
assert(curve != null),
|
||||
super(delegate) {
|
||||
_completer = new Completer<Null>();
|
||||
|
@ -459,7 +459,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics {
|
||||
/// by just scrolling this position.
|
||||
Future<Null> ensureVisible(RenderObject object, {
|
||||
double alignment: 0.0,
|
||||
Duration duration: Duration.ZERO,
|
||||
Duration duration: Duration.zero,
|
||||
Curve curve: Curves.ease,
|
||||
}) {
|
||||
assert(object.attached);
|
||||
@ -471,7 +471,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics {
|
||||
if (target == pixels)
|
||||
return new Future<Null>.value();
|
||||
|
||||
if (duration == Duration.ZERO) {
|
||||
if (duration == Duration.zero) {
|
||||
jumpTo(target);
|
||||
return new Future<Null>.value();
|
||||
}
|
||||
|
@ -44,10 +44,10 @@ class BouncingScrollSimulation extends Simulation {
|
||||
super(tolerance: tolerance) {
|
||||
if (position < leadingExtent) {
|
||||
_springSimulation = _underscrollSimulation(position, velocity);
|
||||
_springTime = double.NEGATIVE_INFINITY;
|
||||
_springTime = double.negativeInfinity;
|
||||
} else if (position > trailingExtent) {
|
||||
_springSimulation = _overscrollSimulation(position, velocity);
|
||||
_springTime = double.NEGATIVE_INFINITY;
|
||||
_springTime = double.negativeInfinity;
|
||||
} else {
|
||||
_frictionSimulation = new FrictionSimulation(0.135, position, velocity);
|
||||
final double finalX = _frictionSimulation.finalX;
|
||||
@ -66,7 +66,7 @@ class BouncingScrollSimulation extends Simulation {
|
||||
);
|
||||
assert(_springTime.isFinite);
|
||||
} else {
|
||||
_springTime = double.INFINITY;
|
||||
_springTime = double.infinity;
|
||||
}
|
||||
}
|
||||
assert(_springTime != null);
|
||||
|
@ -193,7 +193,7 @@ class Scrollable extends StatefulWidget {
|
||||
/// given context visible.
|
||||
static Future<Null> ensureVisible(BuildContext context, {
|
||||
double alignment: 0.0,
|
||||
Duration duration: Duration.ZERO,
|
||||
Duration duration: Duration.zero,
|
||||
Curve curve: Curves.ease,
|
||||
}) {
|
||||
final List<Future<Null>> futures = <Future<Null>>[];
|
||||
@ -210,7 +210,7 @@ class Scrollable extends StatefulWidget {
|
||||
scrollable = Scrollable.of(context);
|
||||
}
|
||||
|
||||
if (futures.isEmpty || duration == Duration.ZERO)
|
||||
if (futures.isEmpty || duration == Duration.zero)
|
||||
return new Future<Null>.value();
|
||||
if (futures.length == 1)
|
||||
return futures.single;
|
||||
|
@ -773,7 +773,7 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
|
||||
) {
|
||||
final int childCount = this.childCount;
|
||||
if (childCount == null)
|
||||
return double.INFINITY;
|
||||
return double.infinity;
|
||||
if (lastIndex == childCount - 1)
|
||||
return trailingScrollOffset;
|
||||
final int reifiedCount = lastIndex - firstIndex + 1;
|
||||
|
@ -236,7 +236,7 @@ class RotationTransition extends AnimatedWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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(
|
||||
transform: transform,
|
||||
alignment: Alignment.center,
|
||||
@ -592,7 +592,7 @@ class AlignTransition extends AnimatedWidget {
|
||||
/// child: new Container(width: 200.0, height: 200.0, color: Colors.green),
|
||||
/// builder: (BuildContext context, Widget child) {
|
||||
/// return new Transform.rotate(
|
||||
/// angle: _controller.value * 2.0 * math.PI,
|
||||
/// angle: _controller.value * 2.0 * math.pi,
|
||||
/// child: child,
|
||||
/// );
|
||||
/// },
|
||||
|
@ -334,7 +334,7 @@ class WidgetInspectorService {
|
||||
else
|
||||
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) {
|
||||
@ -393,7 +393,7 @@ class WidgetInspectorService {
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -406,14 +406,14 @@ class WidgetInspectorService {
|
||||
/// object that `diagnosticsNodeId` references.
|
||||
String getProperties(String diagnosticsNodeId, String groupName) {
|
||||
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]
|
||||
/// object that `diagnosticsNodeId` references.
|
||||
String getChildren(String diagnosticsNodeId, String groupName) {
|
||||
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
|
||||
@ -614,7 +614,7 @@ class _WidgetInspectorState extends State<WidgetInspector>
|
||||
// Order matches by the size of the hit area.
|
||||
double _area(RenderObject object) {
|
||||
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)));
|
||||
final Set<RenderObject> hits = new LinkedHashSet<RenderObject>();
|
||||
@ -823,7 +823,7 @@ class _RenderInspectorOverlay extends RenderBox {
|
||||
|
||||
@override
|
||||
void performResize() {
|
||||
size = constraints.constrain(const Size(double.INFINITY, double.INFINITY));
|
||||
size = constraints.constrain(const Size(double.infinity, double.infinity));
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -234,14 +234,14 @@ void main() {
|
||||
// edges
|
||||
controller.forward();
|
||||
expect(controller.velocity, inInclusiveRange(0.4, 0.6));
|
||||
tick(Duration.ZERO);
|
||||
tick(Duration.zero);
|
||||
expect(controller.velocity, inInclusiveRange(0.4, 0.6));
|
||||
tick(const Duration(milliseconds: 5));
|
||||
expect(controller.velocity, inInclusiveRange(0.9, 1.1));
|
||||
|
||||
controller.forward(from: 0.5);
|
||||
expect(controller.velocity, inInclusiveRange(0.4, 0.6));
|
||||
tick(Duration.ZERO);
|
||||
tick(Duration.zero);
|
||||
expect(controller.velocity, inInclusiveRange(0.4, 0.6));
|
||||
tick(const Duration(milliseconds: 5));
|
||||
expect(controller.velocity, inInclusiveRange(0.9, 1.1));
|
||||
@ -249,13 +249,13 @@ void main() {
|
||||
// stopped
|
||||
controller.forward(from: 1.0);
|
||||
expect(controller.velocity, 0.0);
|
||||
tick(Duration.ZERO);
|
||||
tick(Duration.zero);
|
||||
expect(controller.velocity, 0.0);
|
||||
tick(const Duration(milliseconds: 500));
|
||||
expect(controller.velocity, 0.0);
|
||||
|
||||
controller.forward();
|
||||
tick(Duration.ZERO);
|
||||
tick(Duration.zero);
|
||||
tick(const Duration(milliseconds: 1000));
|
||||
expect(controller.velocity, 0.0);
|
||||
|
||||
@ -383,7 +383,7 @@ void main() {
|
||||
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(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
vsync: const TestVSync(),
|
||||
@ -391,7 +391,7 @@ void main() {
|
||||
|
||||
controller.forward(from: 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(controller.value, 1.0);
|
||||
});
|
||||
|
@ -13,7 +13,7 @@ void main() {
|
||||
tasks.add(1);
|
||||
|
||||
// Flush 0 microtasks.
|
||||
await new Future<Null>.delayed(Duration.ZERO);
|
||||
await new Future<Null>.delayed(Duration.zero);
|
||||
|
||||
scheduleMicrotask(() {
|
||||
tasks.add(3);
|
||||
@ -25,7 +25,7 @@ void main() {
|
||||
tasks.add(2);
|
||||
|
||||
// Flush 2 microtasks.
|
||||
await new Future<Null>.delayed(Duration.ZERO);
|
||||
await new Future<Null>.delayed(Duration.zero);
|
||||
|
||||
scheduleMicrotask(() {
|
||||
tasks.add(6);
|
||||
@ -40,7 +40,7 @@ void main() {
|
||||
tasks.add(5);
|
||||
|
||||
// Flush 3 microtasks.
|
||||
await new Future<Null>.delayed(Duration.ZERO);
|
||||
await new Future<Null>.delayed(Duration.zero);
|
||||
|
||||
tasks.add(9);
|
||||
|
||||
|
@ -51,7 +51,7 @@ enum ExampleEnum {
|
||||
/// Encode and decode to JSON to make sure all objects in the JSON for the
|
||||
/// [DiagnosticsNode] are valid JSON.
|
||||
Map<String, Object> simulateJsonSerialization(DiagnosticsNode node) {
|
||||
return JSON.decode(JSON.encode(node.toJsonMap()));
|
||||
return json.decode(json.encode(node.toJsonMap()));
|
||||
}
|
||||
|
||||
void validateNodeJsonSerialization(DiagnosticsNode node) {
|
||||
|
@ -64,7 +64,7 @@ void main() {
|
||||
expect(read.getInt64List(3), equals(integers));
|
||||
});
|
||||
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();
|
||||
write.putUint8(9);
|
||||
write.putFloat64List(doubles);
|
||||
|
@ -56,7 +56,7 @@ class TestServiceExtensionsBinding extends BindingBase
|
||||
Future<Null> doFrame() async {
|
||||
frameScheduled = false;
|
||||
if (ui.window.onBeginFrame != null)
|
||||
ui.window.onBeginFrame(Duration.ZERO);
|
||||
ui.window.onBeginFrame(Duration.zero);
|
||||
await flushMicrotasks();
|
||||
if (ui.window.onDrawFrame != null)
|
||||
ui.window.onDrawFrame();
|
||||
@ -303,7 +303,7 @@ void main() {
|
||||
|
||||
completed = false;
|
||||
BinaryMessages.setMockMessageHandler('flutter/assets', (ByteData message) async {
|
||||
expect(UTF8.decode(message.buffer.asUint8List()), 'test');
|
||||
expect(utf8.decode(message.buffer.asUint8List()), 'test');
|
||||
completed = true;
|
||||
return new ByteData(5); // 0x0000000000
|
||||
});
|
||||
|
@ -26,16 +26,16 @@ void _tests() {
|
||||
final Finder previousMonthIcon = find.byWidgetPredicate((Widget w) => w is IconButton && (w.tooltip?.startsWith('Previous month') ?? false));
|
||||
|
||||
setUp(() {
|
||||
firstDate = new DateTime(2001, DateTime.JANUARY, 1);
|
||||
lastDate = new DateTime(2031, DateTime.DECEMBER, 31);
|
||||
initialDate = new DateTime(2016, DateTime.JANUARY, 15);
|
||||
firstDate = new DateTime(2001, DateTime.january, 1);
|
||||
lastDate = new DateTime(2031, DateTime.december, 31);
|
||||
initialDate = new DateTime(2016, DateTime.january, 15);
|
||||
selectableDayPredicate = null;
|
||||
initialDatePickerMode = null;
|
||||
});
|
||||
|
||||
testWidgets('tap-select a day', (WidgetTester tester) async {
|
||||
final Key _datePickerKey = new UniqueKey();
|
||||
DateTime _selectedDate = new DateTime(2016, DateTime.JULY, 26);
|
||||
DateTime _selectedDate = new DateTime(2016, DateTime.july, 26);
|
||||
|
||||
await tester.pumpWidget(
|
||||
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.pumpAndSettle();
|
||||
@ -72,31 +72,31 @@ void _tests() {
|
||||
|
||||
await tester.tap(find.text('1'));
|
||||
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.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.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.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.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.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.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 {
|
||||
@ -112,7 +112,7 @@ void _tests() {
|
||||
firstDate: new DateTime(0),
|
||||
lastDate: new DateTime(9999),
|
||||
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 {
|
||||
await preparePicker(tester, (Future<DateTime> date) async {
|
||||
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 tester.tap(find.text('12'));
|
||||
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.tap(find.text('25'));
|
||||
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.tap(find.text('2018'));
|
||||
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(
|
||||
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.pump();
|
||||
await tester.tap(find.text('19'));
|
||||
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 {
|
||||
initialDate = new DateTime(2017, DateTime.JANUARY, 15);
|
||||
initialDate = new DateTime(2017, DateTime.january, 15);
|
||||
firstDate = initialDate;
|
||||
lastDate = initialDate;
|
||||
await preparePicker(tester, (Future<DateTime> date) async {
|
||||
@ -254,9 +254,9 @@ void _tests() {
|
||||
});
|
||||
|
||||
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;
|
||||
lastDate = new DateTime(2017, DateTime.FEBRUARY, 20);
|
||||
lastDate = new DateTime(2017, DateTime.february, 20);
|
||||
await preparePicker(tester, (Future<DateTime> date) async {
|
||||
await tester.tap(nextMonthIcon);
|
||||
await tester.pumpAndSettle(const Duration(seconds: 1));
|
||||
@ -266,8 +266,8 @@ void _tests() {
|
||||
});
|
||||
|
||||
testWidgets('Cannot select a month before first date', (WidgetTester tester) async {
|
||||
initialDate = new DateTime(2017, DateTime.JANUARY, 15);
|
||||
firstDate = new DateTime(2016, DateTime.DECEMBER, 10);
|
||||
initialDate = new DateTime(2017, DateTime.january, 15);
|
||||
firstDate = new DateTime(2016, DateTime.december, 10);
|
||||
lastDate = initialDate;
|
||||
await preparePicker(tester, (Future<DateTime> date) async {
|
||||
await tester.tap(previousMonthIcon);
|
||||
@ -278,21 +278,21 @@ void _tests() {
|
||||
});
|
||||
|
||||
testWidgets('Only predicate days are selectable', (WidgetTester tester) async {
|
||||
initialDate = new DateTime(2017, DateTime.JANUARY, 16);
|
||||
firstDate = new DateTime(2017, DateTime.JANUARY, 10);
|
||||
lastDate = new DateTime(2017, DateTime.JANUARY, 20);
|
||||
initialDate = new DateTime(2017, DateTime.january, 16);
|
||||
firstDate = new DateTime(2017, DateTime.january, 10);
|
||||
lastDate = new DateTime(2017, DateTime.january, 20);
|
||||
selectableDayPredicate = (DateTime day) => day.day.isEven;
|
||||
await preparePicker(tester, (Future<DateTime> date) async {
|
||||
await tester.tap(find.text('10')); // Even, works.
|
||||
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('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 {
|
||||
initialDate = new DateTime(2014, DateTime.JANUARY, 15);
|
||||
initialDate = new DateTime(2014, DateTime.january, 15);
|
||||
initialDatePickerMode = DatePickerMode.year;
|
||||
await preparePicker(tester, (Future<DateTime> date) async {
|
||||
await tester.pump();
|
||||
@ -300,7 +300,7 @@ void _tests() {
|
||||
// The initial current year is 2014.
|
||||
await tester.tap(find.text('2018'));
|
||||
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(() {
|
||||
feedback = new FeedbackTester();
|
||||
initialDate = new DateTime(2017, DateTime.JANUARY, 16);
|
||||
firstDate = new DateTime(2017, DateTime.JANUARY, 10);
|
||||
lastDate = new DateTime(2018, DateTime.JANUARY, 20);
|
||||
initialDate = new DateTime(2017, DateTime.january, 16);
|
||||
firstDate = new DateTime(2017, DateTime.january, 10);
|
||||
lastDate = new DateTime(2018, DateTime.january, 20);
|
||||
selectableDayPredicate = (DateTime date) => date.day.isEven;
|
||||
});
|
||||
|
||||
|
@ -403,7 +403,7 @@ bool pathDoesNotContainCircle(Path path, Rect circleBounds) {
|
||||
assert(circleBounds.width == circleBounds.height);
|
||||
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) {
|
||||
final double x = i * radius * math.cos(theta);
|
||||
final double y = i * radius * math.sin(theta);
|
||||
|
@ -670,8 +670,8 @@ void main() {
|
||||
child: const Material(
|
||||
child: const Center(
|
||||
child: const OverflowBox(
|
||||
maxWidth: double.INFINITY,
|
||||
maxHeight: double.INFINITY,
|
||||
maxWidth: double.infinity,
|
||||
maxHeight: double.infinity,
|
||||
child: const Slider(
|
||||
value: 0.5,
|
||||
onChanged: null,
|
||||
@ -706,8 +706,8 @@ void main() {
|
||||
),
|
||||
child: new Center(
|
||||
child: new OverflowBox(
|
||||
maxWidth: double.INFINITY,
|
||||
maxHeight: double.INFINITY,
|
||||
maxWidth: double.infinity,
|
||||
maxHeight: double.infinity,
|
||||
child: new Slider(
|
||||
key: sliderKey,
|
||||
min: 0.0,
|
||||
|
@ -25,8 +25,8 @@ void main() {
|
||||
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(-1.0), double.INFINITY);
|
||||
expect(friction.timeAtX(200.0), double.INFINITY);
|
||||
expect(friction.timeAtX(-1.0), double.infinity);
|
||||
expect(friction.timeAtX(200.0), double.infinity);
|
||||
});
|
||||
|
||||
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(2.0)), closeTo(2.0, _kEpsilon));
|
||||
|
||||
expect(friction.timeAtX(101.0), double.INFINITY);
|
||||
expect(friction.timeAtX(40.0), double.INFINITY);
|
||||
expect(friction.timeAtX(101.0), double.infinity);
|
||||
expect(friction.timeAtX(40.0), double.infinity);
|
||||
});
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ void main() {
|
||||
position: 100.0,
|
||||
velocity: 400.0,
|
||||
leadingExtent: 0.0,
|
||||
trailingExtent: double.INFINITY,
|
||||
trailingExtent: double.infinity,
|
||||
spring: spring,
|
||||
);
|
||||
scroll.tolerance = const Tolerance(velocity: 1.0);
|
||||
|
@ -23,10 +23,10 @@ void main() {
|
||||
expect(box.getMaxIntrinsicHeight(200.0), 100.0);
|
||||
expect(box.getMaxIntrinsicHeight(400.0), 200.0);
|
||||
|
||||
expect(box.getMinIntrinsicWidth(double.INFINITY), 0.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.INFINITY), 0.0);
|
||||
expect(box.getMinIntrinsicHeight(double.INFINITY), 0.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.INFINITY), 0.0);
|
||||
expect(box.getMinIntrinsicWidth(double.infinity), 0.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.infinity), 0.0);
|
||||
expect(box.getMinIntrinsicHeight(double.infinity), 0.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.infinity), 0.0);
|
||||
});
|
||||
|
||||
test('RenderAspectRatio: Intrinsic sizing 0.5', () {
|
||||
@ -44,10 +44,10 @@ void main() {
|
||||
expect(box.getMaxIntrinsicHeight(200.0), 400.0);
|
||||
expect(box.getMaxIntrinsicHeight(400.0), 800.0);
|
||||
|
||||
expect(box.getMinIntrinsicWidth(double.INFINITY), 0.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.INFINITY), 0.0);
|
||||
expect(box.getMinIntrinsicHeight(double.INFINITY), 0.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.INFINITY), 0.0);
|
||||
expect(box.getMinIntrinsicWidth(double.infinity), 0.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.infinity), 0.0);
|
||||
expect(box.getMinIntrinsicHeight(double.infinity), 0.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.infinity), 0.0);
|
||||
});
|
||||
|
||||
test('RenderAspectRatio: Intrinsic sizing 2.0', () {
|
||||
@ -68,10 +68,10 @@ void main() {
|
||||
expect(box.getMaxIntrinsicHeight(200.0), 100.0);
|
||||
expect(box.getMaxIntrinsicHeight(400.0), 200.0);
|
||||
|
||||
expect(box.getMinIntrinsicWidth(double.INFINITY), 90.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.INFINITY), 90.0);
|
||||
expect(box.getMinIntrinsicHeight(double.INFINITY), 70.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.INFINITY), 70.0);
|
||||
expect(box.getMinIntrinsicWidth(double.infinity), 90.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.infinity), 90.0);
|
||||
expect(box.getMinIntrinsicHeight(double.infinity), 70.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.infinity), 70.0);
|
||||
});
|
||||
|
||||
test('RenderAspectRatio: Intrinsic sizing 0.5', () {
|
||||
@ -92,10 +92,10 @@ void main() {
|
||||
expect(box.getMaxIntrinsicHeight(200.0), 400.0);
|
||||
expect(box.getMaxIntrinsicHeight(400.0), 800.0);
|
||||
|
||||
expect(box.getMinIntrinsicWidth(double.INFINITY), 90.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.INFINITY), 90.0);
|
||||
expect(box.getMinIntrinsicHeight(double.INFINITY), 70.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.INFINITY), 70.0);
|
||||
expect(box.getMinIntrinsicWidth(double.infinity), 90.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.infinity), 90.0);
|
||||
expect(box.getMinIntrinsicHeight(double.infinity), 70.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.infinity), 70.0);
|
||||
});
|
||||
|
||||
test('RenderAspectRatio: Unbounded', () {
|
||||
@ -105,8 +105,8 @@ void main() {
|
||||
hadError = true;
|
||||
};
|
||||
final RenderBox box = new RenderConstrainedOverflowBox(
|
||||
maxWidth: double.INFINITY,
|
||||
maxHeight: double.INFINITY,
|
||||
maxWidth: double.infinity,
|
||||
maxHeight: double.infinity,
|
||||
child: new RenderAspectRatio(
|
||||
aspectRatio: 0.5,
|
||||
child: new RenderSizedBox(const Size(90.0, 70.0))
|
||||
@ -139,13 +139,13 @@ void main() {
|
||||
pumpFrame();
|
||||
expect(inside.size, const Size(90.0, 90.0));
|
||||
|
||||
outside.maxWidth = double.INFINITY;
|
||||
outside.maxWidth = double.infinity;
|
||||
outside.maxHeight = 90.0;
|
||||
pumpFrame();
|
||||
expect(inside.size, const Size(90.0, 90.0));
|
||||
|
||||
outside.maxWidth = 90.0;
|
||||
outside.maxHeight = double.INFINITY;
|
||||
outside.maxHeight = double.infinity;
|
||||
pumpFrame();
|
||||
expect(inside.size, const Size(90.0, 90.0));
|
||||
|
||||
@ -161,13 +161,13 @@ void main() {
|
||||
pumpFrame();
|
||||
expect(inside.size, const Size(90.0, 45.0));
|
||||
|
||||
outside.maxWidth = double.INFINITY;
|
||||
outside.maxWidth = double.infinity;
|
||||
outside.maxHeight = 90.0;
|
||||
pumpFrame();
|
||||
expect(inside.size, const Size(180.0, 90.0));
|
||||
|
||||
outside.maxWidth = 90.0;
|
||||
outside.maxHeight = double.INFINITY;
|
||||
outside.maxHeight = double.infinity;
|
||||
pumpFrame();
|
||||
expect(inside.size, const Size(90.0, 45.0));
|
||||
|
||||
@ -184,13 +184,13 @@ void main() {
|
||||
pumpFrame();
|
||||
expect(inside.size, const Size(90.0, 80.0));
|
||||
|
||||
outside.maxWidth = double.INFINITY;
|
||||
outside.maxWidth = double.infinity;
|
||||
outside.maxHeight = 90.0;
|
||||
pumpFrame();
|
||||
expect(inside.size, const Size(180.0, 90.0));
|
||||
|
||||
outside.maxWidth = 90.0;
|
||||
outside.maxHeight = double.INFINITY;
|
||||
outside.maxHeight = double.infinity;
|
||||
pumpFrame();
|
||||
expect(inside.size, const Size(90.0, 80.0));
|
||||
});
|
||||
|
@ -92,20 +92,20 @@ void main() {
|
||||
|
||||
test('BoxConstraints lerp with unbounded width', () {
|
||||
const BoxConstraints constraints1 = const BoxConstraints(
|
||||
minWidth: double.INFINITY,
|
||||
maxWidth: double.INFINITY,
|
||||
minWidth: double.infinity,
|
||||
maxWidth: double.infinity,
|
||||
minHeight: 10.0,
|
||||
maxHeight: 20.0,
|
||||
);
|
||||
const BoxConstraints constraints2 = const BoxConstraints(
|
||||
minWidth: double.INFINITY,
|
||||
maxWidth: double.INFINITY,
|
||||
minWidth: double.infinity,
|
||||
maxWidth: double.infinity,
|
||||
minHeight: 20.0,
|
||||
maxHeight: 30.0,
|
||||
);
|
||||
const BoxConstraints constraints3 = const BoxConstraints(
|
||||
minWidth: double.INFINITY,
|
||||
maxWidth: double.INFINITY,
|
||||
minWidth: double.infinity,
|
||||
maxWidth: double.infinity,
|
||||
minHeight: 15.0,
|
||||
maxHeight: 25.0,
|
||||
);
|
||||
@ -116,40 +116,40 @@ void main() {
|
||||
const BoxConstraints constraints1 = const BoxConstraints(
|
||||
minWidth: 10.0,
|
||||
maxWidth: 20.0,
|
||||
minHeight: double.INFINITY,
|
||||
maxHeight: double.INFINITY,
|
||||
minHeight: double.infinity,
|
||||
maxHeight: double.infinity,
|
||||
);
|
||||
const BoxConstraints constraints2 = const BoxConstraints(
|
||||
minWidth: 20.0,
|
||||
maxWidth: 30.0,
|
||||
minHeight: double.INFINITY,
|
||||
maxHeight: double.INFINITY,
|
||||
minHeight: double.infinity,
|
||||
maxHeight: double.infinity,
|
||||
);
|
||||
const BoxConstraints constraints3 = const BoxConstraints(
|
||||
minWidth: 15.0,
|
||||
maxWidth: 25.0,
|
||||
minHeight: double.INFINITY,
|
||||
maxHeight: double.INFINITY,
|
||||
minHeight: double.infinity,
|
||||
maxHeight: double.infinity,
|
||||
);
|
||||
expect(BoxConstraints.lerp(constraints1, constraints2, 0.5), constraints3);
|
||||
});
|
||||
|
||||
test('BoxConstraints lerp from bounded to unbounded', () {
|
||||
const BoxConstraints constraints1 = const BoxConstraints(
|
||||
minWidth: double.INFINITY,
|
||||
maxWidth: double.INFINITY,
|
||||
minHeight: double.INFINITY,
|
||||
maxHeight: double.INFINITY,
|
||||
minWidth: double.infinity,
|
||||
maxWidth: double.infinity,
|
||||
minHeight: double.infinity,
|
||||
maxHeight: double.infinity,
|
||||
);
|
||||
const BoxConstraints constraints2 = const BoxConstraints(
|
||||
minWidth: 20.0,
|
||||
maxWidth: 30.0,
|
||||
minHeight: double.INFINITY,
|
||||
maxHeight: double.INFINITY,
|
||||
minHeight: double.infinity,
|
||||
maxHeight: double.infinity,
|
||||
);
|
||||
const BoxConstraints constraints3 = const BoxConstraints(
|
||||
minWidth: double.INFINITY,
|
||||
maxWidth: double.INFINITY,
|
||||
minWidth: double.infinity,
|
||||
maxWidth: double.infinity,
|
||||
minHeight: 20.0,
|
||||
maxHeight: 30.0,
|
||||
);
|
||||
|
@ -36,7 +36,7 @@ void main() {
|
||||
|
||||
result = 'no exception';
|
||||
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());
|
||||
} on FlutterError catch (e) {
|
||||
result = '$e';
|
||||
@ -49,7 +49,7 @@ void main() {
|
||||
|
||||
result = 'no exception';
|
||||
try {
|
||||
const BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN);
|
||||
const BoxConstraints constraints = const BoxConstraints(minHeight: double.nan);
|
||||
assert(constraints.debugAssertIsValid());
|
||||
} on FlutterError catch (e) {
|
||||
result = '$e';
|
||||
@ -62,7 +62,7 @@ void main() {
|
||||
|
||||
result = 'no exception';
|
||||
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());
|
||||
} on FlutterError catch (e) {
|
||||
result = '$e';
|
||||
|
@ -50,8 +50,8 @@ class RenderIntrinsicSize extends RenderProxyBox {
|
||||
void performLayout() {
|
||||
child.layout(constraints);
|
||||
size = new Size(
|
||||
child.getMinIntrinsicWidth(double.INFINITY),
|
||||
child.getMinIntrinsicHeight(double.INFINITY)
|
||||
child.getMinIntrinsicWidth(double.infinity),
|
||||
child.getMinIntrinsicHeight(double.infinity)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
offset: new ViewportOffset.zero(),
|
||||
);
|
||||
expect(editable.getMinIntrinsicWidth(double.INFINITY), 50.0);
|
||||
expect(editable.getMaxIntrinsicWidth(double.INFINITY), 50.0);
|
||||
expect(editable.getMinIntrinsicHeight(double.INFINITY), 10.0);
|
||||
expect(editable.getMaxIntrinsicHeight(double.INFINITY), 10.0);
|
||||
expect(editable.getMinIntrinsicWidth(double.infinity), 50.0);
|
||||
expect(editable.getMaxIntrinsicWidth(double.infinity), 50.0);
|
||||
expect(editable.getMinIntrinsicHeight(double.infinity), 10.0);
|
||||
expect(editable.getMaxIntrinsicHeight(double.infinity), 10.0);
|
||||
|
||||
expect(
|
||||
editable.toStringDeep(minLevel: DiagnosticLevel.info),
|
||||
|
@ -302,7 +302,7 @@ void main() {
|
||||
);
|
||||
final RenderConstrainedOverflowBox parent = new RenderConstrainedOverflowBox(
|
||||
minWidth: 0.0,
|
||||
maxWidth: double.INFINITY,
|
||||
maxWidth: double.infinity,
|
||||
minHeight: 0.0,
|
||||
maxHeight: 400.0,
|
||||
child: flex,
|
||||
@ -347,7 +347,7 @@ void main() {
|
||||
);
|
||||
final RenderConstrainedOverflowBox parent = new RenderConstrainedOverflowBox(
|
||||
minWidth: 0.0,
|
||||
maxWidth: double.INFINITY,
|
||||
maxWidth: double.infinity,
|
||||
minHeight: 0.0,
|
||||
maxHeight: 400.0,
|
||||
child: flex,
|
||||
@ -376,7 +376,7 @@ void main() {
|
||||
);
|
||||
final RenderConstrainedOverflowBox parent = new RenderConstrainedOverflowBox(
|
||||
minWidth: 0.0,
|
||||
maxWidth: double.INFINITY,
|
||||
maxWidth: double.infinity,
|
||||
minHeight: 0.0,
|
||||
maxHeight: 400.0,
|
||||
child: flex,
|
||||
|
@ -73,10 +73,10 @@ void main() {
|
||||
expect(parent.getMinIntrinsicHeight(80.0), equals(20.0));
|
||||
expect(parent.getMaxIntrinsicHeight(80.0), equals(200.0));
|
||||
|
||||
expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(100.0));
|
||||
expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(100.0));
|
||||
expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(20.0));
|
||||
expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(200.0));
|
||||
expect(parent.getMinIntrinsicWidth(double.infinity), equals(100.0));
|
||||
expect(parent.getMaxIntrinsicWidth(double.infinity), equals(100.0));
|
||||
expect(parent.getMinIntrinsicHeight(double.infinity), equals(20.0));
|
||||
expect(parent.getMaxIntrinsicHeight(double.infinity), equals(200.0));
|
||||
});
|
||||
|
||||
test('IntrinsicWidth without a child', () {
|
||||
@ -107,10 +107,10 @@ void main() {
|
||||
expect(parent.getMinIntrinsicHeight(80.0), equals(0.0));
|
||||
expect(parent.getMaxIntrinsicHeight(80.0), equals(0.0));
|
||||
|
||||
expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(0.0));
|
||||
expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(0.0));
|
||||
expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(0.0));
|
||||
expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(0.0));
|
||||
expect(parent.getMinIntrinsicWidth(double.infinity), equals(0.0));
|
||||
expect(parent.getMaxIntrinsicWidth(double.infinity), equals(0.0));
|
||||
expect(parent.getMinIntrinsicHeight(double.infinity), equals(0.0));
|
||||
expect(parent.getMaxIntrinsicHeight(double.infinity), equals(0.0));
|
||||
});
|
||||
|
||||
test('Shrink-wrapping width (stepped width)', () {
|
||||
@ -142,10 +142,10 @@ void main() {
|
||||
expect(parent.getMinIntrinsicHeight(80.0), equals(20.0));
|
||||
expect(parent.getMaxIntrinsicHeight(80.0), equals(200.0));
|
||||
|
||||
expect(parent.getMinIntrinsicWidth(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.getMaxIntrinsicHeight(double.INFINITY), equals(200.0));
|
||||
expect(parent.getMinIntrinsicWidth(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.getMaxIntrinsicHeight(double.infinity), equals(200.0));
|
||||
});
|
||||
|
||||
test('Shrink-wrapping width (stepped height)', () {
|
||||
@ -177,10 +177,10 @@ void main() {
|
||||
expect(parent.getMinIntrinsicHeight(80.0), equals(1.0 * 47.0));
|
||||
expect(parent.getMaxIntrinsicHeight(80.0), equals(5.0 * 47.0));
|
||||
|
||||
expect(parent.getMinIntrinsicWidth(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.getMaxIntrinsicHeight(double.INFINITY), equals(5.0 * 47.0));
|
||||
expect(parent.getMinIntrinsicWidth(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.getMaxIntrinsicHeight(double.infinity), equals(5.0 * 47.0));
|
||||
});
|
||||
|
||||
test('Shrink-wrapping width (stepped everything)', () {
|
||||
@ -212,10 +212,10 @@ void main() {
|
||||
expect(parent.getMinIntrinsicHeight(80.0), equals(1.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.getMaxIntrinsicWidth(double.INFINITY), equals(3.0 * 37.0));
|
||||
expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(1.0 * 47.0));
|
||||
expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(5.0 * 47.0));
|
||||
expect(parent.getMinIntrinsicWidth(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.getMaxIntrinsicHeight(double.infinity), equals(5.0 * 47.0));
|
||||
});
|
||||
|
||||
test('Shrink-wrapping height', () {
|
||||
@ -247,10 +247,10 @@ void main() {
|
||||
expect(parent.getMinIntrinsicHeight(80.0), equals(200.0));
|
||||
expect(parent.getMaxIntrinsicHeight(80.0), equals(200.0));
|
||||
|
||||
expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(10.0));
|
||||
expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(100.0));
|
||||
expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(200.0));
|
||||
expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(200.0));
|
||||
expect(parent.getMinIntrinsicWidth(double.infinity), equals(10.0));
|
||||
expect(parent.getMaxIntrinsicWidth(double.infinity), equals(100.0));
|
||||
expect(parent.getMinIntrinsicHeight(double.infinity), equals(200.0));
|
||||
expect(parent.getMaxIntrinsicHeight(double.infinity), equals(200.0));
|
||||
});
|
||||
|
||||
test('IntrinsicHeight without a child', () {
|
||||
@ -281,10 +281,10 @@ void main() {
|
||||
expect(parent.getMinIntrinsicHeight(80.0), equals(0.0));
|
||||
expect(parent.getMaxIntrinsicHeight(80.0), equals(0.0));
|
||||
|
||||
expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(0.0));
|
||||
expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(0.0));
|
||||
expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(0.0));
|
||||
expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(0.0));
|
||||
expect(parent.getMinIntrinsicWidth(double.infinity), equals(0.0));
|
||||
expect(parent.getMaxIntrinsicWidth(double.infinity), equals(0.0));
|
||||
expect(parent.getMinIntrinsicHeight(double.infinity), equals(0.0));
|
||||
expect(parent.getMaxIntrinsicHeight(double.infinity), equals(0.0));
|
||||
});
|
||||
|
||||
test('Padding and boring intrinsics', () {
|
||||
@ -308,10 +308,10 @@ void main() {
|
||||
expect(box.getMinIntrinsicHeight(80.0), 50.0);
|
||||
expect(box.getMaxIntrinsicHeight(80.0), 50.0);
|
||||
|
||||
expect(box.getMinIntrinsicWidth(double.INFINITY), 50.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.INFINITY), 50.0);
|
||||
expect(box.getMinIntrinsicHeight(double.INFINITY), 50.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.INFINITY), 50.0);
|
||||
expect(box.getMinIntrinsicWidth(double.infinity), 50.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.infinity), 50.0);
|
||||
expect(box.getMinIntrinsicHeight(double.infinity), 50.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.infinity), 50.0);
|
||||
|
||||
// also a smoke test:
|
||||
layout(
|
||||
@ -346,10 +346,10 @@ void main() {
|
||||
expect(box.getMinIntrinsicHeight(80.0), 80.0);
|
||||
expect(box.getMaxIntrinsicHeight(80.0), 80.0);
|
||||
|
||||
expect(box.getMinIntrinsicWidth(double.INFINITY), 30.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.INFINITY), 30.0);
|
||||
expect(box.getMinIntrinsicHeight(double.INFINITY), 30.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.INFINITY), 30.0);
|
||||
expect(box.getMinIntrinsicWidth(double.infinity), 30.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.infinity), 30.0);
|
||||
expect(box.getMinIntrinsicHeight(double.infinity), 30.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.infinity), 30.0);
|
||||
|
||||
// also a smoke test:
|
||||
layout(
|
||||
@ -384,10 +384,10 @@ void main() {
|
||||
expect(box.getMinIntrinsicHeight(80.0), 50.0);
|
||||
expect(box.getMaxIntrinsicHeight(80.0), 50.0);
|
||||
|
||||
expect(box.getMinIntrinsicWidth(double.INFINITY), 50.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.INFINITY), 50.0);
|
||||
expect(box.getMinIntrinsicHeight(double.INFINITY), 50.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.INFINITY), 50.0);
|
||||
expect(box.getMinIntrinsicWidth(double.infinity), 50.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.infinity), 50.0);
|
||||
expect(box.getMinIntrinsicHeight(double.infinity), 50.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.infinity), 50.0);
|
||||
|
||||
// also a smoke test:
|
||||
layout(
|
||||
@ -422,10 +422,10 @@ void main() {
|
||||
expect(box.getMinIntrinsicHeight(80.0), 80.0);
|
||||
expect(box.getMaxIntrinsicHeight(80.0), 80.0);
|
||||
|
||||
expect(box.getMinIntrinsicWidth(double.INFINITY), 30.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.INFINITY), 30.0);
|
||||
expect(box.getMinIntrinsicHeight(double.INFINITY), 30.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.INFINITY), 30.0);
|
||||
expect(box.getMinIntrinsicWidth(double.infinity), 30.0);
|
||||
expect(box.getMaxIntrinsicWidth(double.infinity), 30.0);
|
||||
expect(box.getMinIntrinsicHeight(double.infinity), 30.0);
|
||||
expect(box.getMaxIntrinsicHeight(double.infinity), 30.0);
|
||||
|
||||
// also a smoke test:
|
||||
layout(
|
||||
|
@ -15,9 +15,9 @@ void main() {
|
||||
);
|
||||
final RenderBox parent = new RenderConstrainedOverflowBox(
|
||||
minWidth: 0.0,
|
||||
maxWidth: double.INFINITY,
|
||||
maxWidth: double.infinity,
|
||||
minHeight: 0.0,
|
||||
maxHeight: double.INFINITY,
|
||||
maxHeight: double.infinity,
|
||||
child: new RenderLimitedBox(
|
||||
maxWidth: 100.0,
|
||||
maxHeight: 200.0,
|
||||
@ -64,7 +64,7 @@ void main() {
|
||||
);
|
||||
final RenderBox parent = new RenderConstrainedOverflowBox(
|
||||
minWidth: 0.0,
|
||||
maxWidth: double.INFINITY,
|
||||
maxWidth: double.infinity,
|
||||
minHeight: 500.0,
|
||||
maxHeight: 500.0,
|
||||
child: new RenderLimitedBox(
|
||||
@ -86,7 +86,7 @@ void main() {
|
||||
minWidth: 500.0,
|
||||
maxWidth: 500.0,
|
||||
minHeight: 0.0,
|
||||
maxHeight: double.INFINITY,
|
||||
maxHeight: double.infinity,
|
||||
child: new RenderLimitedBox(
|
||||
maxWidth: 100.0,
|
||||
maxHeight: 200.0,
|
||||
@ -105,7 +105,7 @@ void main() {
|
||||
minWidth: 10.0,
|
||||
maxWidth: 500.0,
|
||||
minHeight: 0.0,
|
||||
maxHeight: double.INFINITY,
|
||||
maxHeight: double.infinity,
|
||||
child: box = new RenderLimitedBox(
|
||||
maxWidth: 100.0,
|
||||
maxHeight: 200.0,
|
||||
|
@ -20,10 +20,10 @@ void main() {
|
||||
],
|
||||
);
|
||||
|
||||
final double textWidth = paragraph.getMaxIntrinsicWidth(double.INFINITY);
|
||||
final double oneLineTextHeight = paragraph.getMinIntrinsicHeight(double.INFINITY);
|
||||
final double textWidth = paragraph.getMaxIntrinsicWidth(double.infinity);
|
||||
final double oneLineTextHeight = paragraph.getMinIntrinsicHeight(double.infinity);
|
||||
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 manyLinesTextHeight = paragraph.getMinIntrinsicHeight(0.0);
|
||||
|
||||
@ -33,16 +33,16 @@ void main() {
|
||||
expect(oneLineTextHeight, lessThan(twoLinesTextHeight));
|
||||
expect(twoLinesTextHeight, lessThan(oneLineTextHeight * 3.0));
|
||||
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(0.0), equals(manyLinesTextHeight));
|
||||
|
||||
// vertical block (same expectations)
|
||||
expect(testBlock.getMinIntrinsicWidth(double.INFINITY), equals(wrappedTextWidth));
|
||||
expect(testBlock.getMaxIntrinsicWidth(double.INFINITY), equals(textWidth));
|
||||
expect(testBlock.getMinIntrinsicHeight(double.INFINITY), equals(oneLineTextHeight));
|
||||
expect(testBlock.getMinIntrinsicWidth(double.infinity), equals(wrappedTextWidth));
|
||||
expect(testBlock.getMaxIntrinsicWidth(double.infinity), equals(textWidth));
|
||||
expect(testBlock.getMinIntrinsicHeight(double.infinity), equals(oneLineTextHeight));
|
||||
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.getMinIntrinsicWidth(0.0), equals(wrappedTextWidth));
|
||||
expect(testBlock.getMaxIntrinsicWidth(0.0), equals(textWidth));
|
||||
@ -53,11 +53,11 @@ void main() {
|
||||
|
||||
// horizontal block (same expectations again)
|
||||
testBlock.axisDirection = AxisDirection.right;
|
||||
expect(testBlock.getMinIntrinsicWidth(double.INFINITY), equals(wrappedTextWidth));
|
||||
expect(testBlock.getMaxIntrinsicWidth(double.INFINITY), equals(textWidth));
|
||||
expect(testBlock.getMinIntrinsicHeight(double.INFINITY), equals(oneLineTextHeight));
|
||||
expect(testBlock.getMinIntrinsicWidth(double.infinity), equals(wrappedTextWidth));
|
||||
expect(testBlock.getMaxIntrinsicWidth(double.infinity), equals(textWidth));
|
||||
expect(testBlock.getMinIntrinsicHeight(double.infinity), equals(oneLineTextHeight));
|
||||
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.getMinIntrinsicWidth(0.0), equals(wrappedTextWidth));
|
||||
expect(testBlock.getMaxIntrinsicWidth(0.0), equals(textWidth));
|
||||
|
@ -16,8 +16,8 @@ void main() {
|
||||
|
||||
test('RenderLimitedBox getters and setters', () {
|
||||
final RenderLimitedBox box = new RenderLimitedBox();
|
||||
expect(box.maxWidth, double.INFINITY);
|
||||
expect(box.maxHeight, double.INFINITY);
|
||||
expect(box.maxWidth, double.infinity);
|
||||
expect(box.maxHeight, double.infinity);
|
||||
box.maxWidth = 0.0;
|
||||
box.maxHeight = 1.0;
|
||||
expect(box.maxHeight, 1.0);
|
||||
|
@ -95,7 +95,7 @@ void main() {
|
||||
test('RenderTransform - rotation', () {
|
||||
RenderBox inner;
|
||||
final RenderBox sizer = new RenderTransform(
|
||||
transform: new Matrix4.rotationZ(math.PI),
|
||||
transform: new Matrix4.rotationZ(math.pi),
|
||||
alignment: Alignment.center,
|
||||
child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
|
||||
);
|
||||
@ -113,7 +113,7 @@ void main() {
|
||||
test('RenderTransform - rotation with internal offset', () {
|
||||
RenderBox inner;
|
||||
final RenderBox sizer = new RenderTransform(
|
||||
transform: new Matrix4.rotationZ(math.PI),
|
||||
transform: new Matrix4.rotationZ(math.pi),
|
||||
alignment: Alignment.center,
|
||||
child: new RenderPadding(
|
||||
padding: const EdgeInsets.only(left: 20.0),
|
||||
@ -134,7 +134,7 @@ void main() {
|
||||
test('RenderTransform - perspective - globalToLocal', () {
|
||||
RenderBox inner;
|
||||
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,
|
||||
child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
|
||||
);
|
||||
@ -151,7 +151,7 @@ void main() {
|
||||
test('RenderTransform - perspective - localToGlobal', () {
|
||||
RenderBox inner;
|
||||
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,
|
||||
child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
|
||||
);
|
||||
|
@ -137,8 +137,8 @@ void main() {
|
||||
_checkEncodeDecode<dynamic>(standard, 9223372036854775807);
|
||||
_checkEncodeDecode<dynamic>(standard, -9223372036854775807);
|
||||
_checkEncodeDecode<dynamic>(standard, 3.14);
|
||||
_checkEncodeDecode<dynamic>(standard, double.INFINITY);
|
||||
_checkEncodeDecode<dynamic>(standard, double.NAN);
|
||||
_checkEncodeDecode<dynamic>(standard, double.infinity);
|
||||
_checkEncodeDecode<dynamic>(standard, double.nan);
|
||||
_checkEncodeDecode<dynamic>(standard, '');
|
||||
_checkEncodeDecode<dynamic>(standard, 'hello');
|
||||
_checkEncodeDecode<dynamic>(standard, 'special chars >\u263A\u{1F602}<');
|
||||
@ -161,15 +161,15 @@ void main() {
|
||||
<int>[-0x7fffffffffffffff - 1, 0, 0x7fffffffffffffff]),
|
||||
null, // ensures the offset of the following list is unaligned.
|
||||
new Float64List.fromList(<double>[
|
||||
double.NEGATIVE_INFINITY,
|
||||
-double.MAX_FINITE,
|
||||
-double.MIN_POSITIVE,
|
||||
double.negativeInfinity,
|
||||
-double.maxFinite,
|
||||
-double.minPositive,
|
||||
-0.0,
|
||||
0.0,
|
||||
double.MIN_POSITIVE,
|
||||
double.MAX_FINITE,
|
||||
double.INFINITY,
|
||||
double.NAN
|
||||
double.minPositive,
|
||||
double.maxFinite,
|
||||
double.infinity,
|
||||
double.nan
|
||||
]),
|
||||
<dynamic>['nested', <dynamic>[]],
|
||||
<dynamic, dynamic>{ 'a': 'nested', null: <dynamic, dynamic>{} },
|
||||
|
@ -190,7 +190,7 @@ void main() {
|
||||
);
|
||||
final List<dynamic> events = await channel.receiveBroadcastStream('hello').toList();
|
||||
expect(events, orderedEquals(<String>['hello1', 'hello2']));
|
||||
await new Future<Null>.delayed(Duration.ZERO);
|
||||
await new Future<Null>.delayed(Duration.zero);
|
||||
expect(canceled, isTrue);
|
||||
});
|
||||
test('can receive error event', () async {
|
||||
@ -212,7 +212,7 @@ void main() {
|
||||
final List<dynamic> events = <dynamic>[];
|
||||
final List<dynamic> errors = <dynamic>[];
|
||||
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(errors, hasLength(1));
|
||||
expect(errors[0], const isInstanceOf<PlatformException>());
|
||||
|
@ -328,7 +328,7 @@ void main() {
|
||||
}
|
||||
|
||||
Future<Null> eventFiring(WidgetTester tester) async {
|
||||
await tester.pump(Duration.ZERO);
|
||||
await tester.pump(Duration.zero);
|
||||
}
|
||||
|
||||
class StringCollector extends StreamBuilderBase<String, List<String>> {
|
||||
|
@ -48,7 +48,7 @@ void main() {
|
||||
});
|
||||
|
||||
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)', () {
|
||||
@ -76,7 +76,7 @@ void main() {
|
||||
});
|
||||
|
||||
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)', () {
|
||||
@ -104,7 +104,7 @@ void main() {
|
||||
});
|
||||
|
||||
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)', () {
|
||||
@ -132,7 +132,7 @@ void main() {
|
||||
});
|
||||
|
||||
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)', () {
|
||||
@ -160,7 +160,7 @@ void main() {
|
||||
});
|
||||
|
||||
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)', () {
|
||||
@ -188,7 +188,7 @@ void main() {
|
||||
});
|
||||
|
||||
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)', () {
|
||||
@ -216,7 +216,7 @@ void main() {
|
||||
});
|
||||
|
||||
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)', () {
|
||||
@ -244,7 +244,7 @@ void main() {
|
||||
});
|
||||
|
||||
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 {
|
||||
@ -257,7 +257,7 @@ void main() {
|
||||
expect(find.byType(CustomPaint), paints
|
||||
..save
|
||||
..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(0xa0b71c1c), hasMaskFilter: false)
|
||||
..paragraph(offset: const Offset(-40.0, 29.0))
|
||||
@ -270,7 +270,7 @@ void main() {
|
||||
expect(find.byType(CheckedModeBanner), paints
|
||||
..save
|
||||
..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(0xa0b71c1c), hasMaskFilter: false)
|
||||
..paragraph(offset: const Offset(-40.0, 29.0))
|
||||
|
@ -193,7 +193,7 @@ void main() {
|
||||
height: 200.0,
|
||||
child: new Center(
|
||||
child: new Transform(
|
||||
transform: new Matrix4.rotationZ(math.PI),
|
||||
transform: new Matrix4.rotationZ(math.pi),
|
||||
child: new Container(
|
||||
key: const ValueKey<int>(0),
|
||||
width: 100.0,
|
||||
@ -449,7 +449,7 @@ void main() {
|
||||
height: 200.0,
|
||||
child: new Center(
|
||||
child: new Transform(
|
||||
transform: new Matrix4.rotationZ(math.PI),
|
||||
transform: new Matrix4.rotationZ(math.pi),
|
||||
child: new Container(
|
||||
key: const ValueKey<int>(0),
|
||||
width: 100.0,
|
||||
|
@ -56,7 +56,7 @@ void main() {
|
||||
),
|
||||
),
|
||||
),
|
||||
Duration.ZERO,
|
||||
Duration.zero,
|
||||
EnginePhase.layout, // so that we don't try to paint the fake images
|
||||
);
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
expect(find.byType(Container), paints
|
||||
@ -551,7 +551,7 @@ void main() {
|
||||
matchTextDirection: false,
|
||||
),
|
||||
),
|
||||
Duration.ZERO,
|
||||
Duration.zero,
|
||||
EnginePhase.layout, // so that we don't try to paint the fake images
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
@ -563,7 +563,7 @@ void main() {
|
||||
matchTextDirection: true,
|
||||
),
|
||||
),
|
||||
Duration.ZERO,
|
||||
Duration.zero,
|
||||
EnginePhase.layout, // so that we don't try to paint the fake images
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
@ -575,7 +575,7 @@ void main() {
|
||||
matchTextDirection: false,
|
||||
),
|
||||
),
|
||||
Duration.ZERO,
|
||||
Duration.zero,
|
||||
EnginePhase.layout, // so that we don't try to paint the fake images
|
||||
);
|
||||
});
|
||||
|
@ -22,7 +22,7 @@ void main() {
|
||||
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<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 ValueKey<String>(nonconst('')) == new ValueKey<String>(nonconst('')), isTrue);
|
||||
|
@ -171,8 +171,8 @@ class LinkedScrollPosition extends ScrollPositionWithSingleContext {
|
||||
assert(beforeOverscroll == 0.0 || afterOverscroll == 0.0);
|
||||
|
||||
final double localOverscroll = setPixels(value.clamp(
|
||||
owner.canLinkWithBefore ? minScrollExtent : -double.INFINITY,
|
||||
owner.canLinkWithAfter ? maxScrollExtent : double.INFINITY,
|
||||
owner.canLinkWithBefore ? minScrollExtent : -double.infinity,
|
||||
owner.canLinkWithAfter ? maxScrollExtent : double.infinity,
|
||||
));
|
||||
|
||||
assert(localOverscroll == 0.0 || (beforeOverscroll == 0.0 && afterOverscroll == 0.0));
|
||||
|
@ -243,11 +243,11 @@ void main() {
|
||||
);
|
||||
final RenderObject painter = tester.renderObject(find.byType(CustomPaint));
|
||||
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()));
|
||||
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()
|
||||
..rotate(angle: math.PI / 2.0)..circle());
|
||||
expect(painter, paints..rotate(angle: math.pi / 2.0)..circle()
|
||||
..rotate(angle: math.pi / 2.0)..circle());
|
||||
|
||||
await tester.pumpAndSettle(const Duration(seconds: 1));
|
||||
expect(painter, doesNotOverscroll);
|
||||
@ -296,7 +296,7 @@ void main() {
|
||||
);
|
||||
painter = tester.renderObject(find.byType(CustomPaint));
|
||||
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()));
|
||||
|
||||
await tester.pumpAndSettle(const Duration(seconds: 1));
|
||||
@ -317,7 +317,7 @@ void main() {
|
||||
);
|
||||
painter = tester.renderObject(find.byType(CustomPaint));
|
||||
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()));
|
||||
});
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ void main() {
|
||||
expect(e.height, 2.0);
|
||||
|
||||
const SizedBox f = const SizedBox.expand();
|
||||
expect(f.width, double.INFINITY);
|
||||
expect(f.height, double.INFINITY);
|
||||
expect(f.width, double.infinity);
|
||||
expect(f.height, double.infinity);
|
||||
});
|
||||
|
||||
testWidgets('SizedBox - no child', (WidgetTester tester) async {
|
||||
|
@ -259,7 +259,7 @@ void main() {
|
||||
testWidgets('Transform.rotate', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
new Transform.rotate(
|
||||
angle: math.PI / 2.0,
|
||||
angle: math.pi / 2.0,
|
||||
child: new Opacity(opacity: 0.5, child: new Container()),
|
||||
),
|
||||
);
|
||||
|
@ -416,9 +416,9 @@ void main() {
|
||||
service.disposeAllGroups();
|
||||
final Element elementB = find.text('b').evaluate().first;
|
||||
final String bId = service.toId(elementB, group);
|
||||
final Object json = JSON.decode(service.getParentChain(bId, group));
|
||||
expect(json, isList);
|
||||
final List<Object> chainElements = json;
|
||||
final Object jsonList = json.decode(service.getParentChain(bId, group));
|
||||
expect(jsonList, isList);
|
||||
final List<Object> chainElements = jsonList;
|
||||
final List<Element> expectedChain = elementB.debugGetDiagnosticChain()?.reversed?.toList();
|
||||
// Sanity check that the chain goes back to the root.
|
||||
expect(expectedChain.first, tester.binding.renderViewElement);
|
||||
@ -458,7 +458,7 @@ void main() {
|
||||
final WidgetInspectorService service = WidgetInspectorService.instance;
|
||||
service.disposeAllGroups();
|
||||
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();
|
||||
expect(properties, isNotEmpty);
|
||||
expect(propertiesJson.length, equals(properties.length));
|
||||
@ -488,7 +488,7 @@ void main() {
|
||||
final WidgetInspectorService service = WidgetInspectorService.instance;
|
||||
service.disposeAllGroups();
|
||||
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();
|
||||
expect(children.length, equals(3));
|
||||
expect(propertiesJson.length, equals(children.length));
|
||||
@ -520,7 +520,7 @@ void main() {
|
||||
service.disposeAllGroups();
|
||||
service.setPubRootDirectories(<Object>[]);
|
||||
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'];
|
||||
expect(creationLocationA, isNotNull);
|
||||
final String fileA = creationLocationA['file'];
|
||||
@ -529,7 +529,7 @@ void main() {
|
||||
final List<Object> parameterLocationsA = creationLocationA['parameterLocations'];
|
||||
|
||||
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'];
|
||||
expect(creationLocationB, isNotNull);
|
||||
final String fileB = creationLocationB['file'];
|
||||
@ -581,12 +581,12 @@ void main() {
|
||||
service.disposeAllGroups();
|
||||
service.setPubRootDirectories(<Object>[]);
|
||||
service.setSelection(elementA, 'my-group');
|
||||
Map<String, Object> json = JSON.decode(service.getSelectedWidget(null, 'my-group'));
|
||||
Map<String, Object> creationLocation = json['creationLocation'];
|
||||
Map<String, Object> jsonObject = json.decode(service.getSelectedWidget(null, 'my-group'));
|
||||
Map<String, Object> creationLocation = jsonObject['creationLocation'];
|
||||
expect(creationLocation, isNotNull);
|
||||
final String fileA = creationLocation['file'];
|
||||
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;
|
||||
// Strip a couple subdirectories away to generate a plausible pub root
|
||||
// directory.
|
||||
@ -594,22 +594,22 @@ void main() {
|
||||
service.setPubRootDirectories(<Object>[pubRootTest]);
|
||||
|
||||
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']);
|
||||
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']);
|
||||
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']);
|
||||
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>[
|
||||
'/invalid/$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
|
||||
// not the current package.
|
||||
@ -619,9 +619,9 @@ void main() {
|
||||
).evaluate().first;
|
||||
service.setSelection(richText, 'my-group');
|
||||
service.setPubRootDirectories(<Object>[pubRootTest]);
|
||||
json = JSON.decode(service.getSelectedWidget(null, 'my-group'));
|
||||
expect(json, isNot(contains('createdByLocalProject')));
|
||||
creationLocation = json['creationLocation'];
|
||||
jsonObject = json.decode(service.getSelectedWidget(null, 'my-group'));
|
||||
expect(jsonObject, isNot(contains('createdByLocalProject')));
|
||||
creationLocation = jsonObject['creationLocation'];
|
||||
expect(creationLocation, isNotNull);
|
||||
// This RichText widget is created by the build method of the Text widget
|
||||
// thus the creation location is in text.dart not basic.dart
|
||||
@ -631,14 +631,14 @@ void main() {
|
||||
// Strip off /src/widgets/text.dart.
|
||||
final String pubRootFramework = '/' + pathSegmentsFramework.take(pathSegmentsFramework.length - 3).join('/');
|
||||
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');
|
||||
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.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');
|
||||
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.
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ class FlutterDriver {
|
||||
await new Future<Null>.delayed(const Duration(seconds: 2));
|
||||
|
||||
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.
|
||||
|
@ -3,7 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert' show JSON, JsonEncoder;
|
||||
import 'dart:convert' show json, JsonEncoder;
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:file/file.dart';
|
||||
@ -112,10 +112,10 @@ class TimelineSummary {
|
||||
await file.writeAsString(_encodeJson(summaryJson, pretty));
|
||||
}
|
||||
|
||||
String _encodeJson(Map<String, dynamic> json, bool pretty) {
|
||||
String _encodeJson(Map<String, dynamic> jsonObject, bool pretty) {
|
||||
return pretty
|
||||
? _prettyEncoder.convert(json)
|
||||
: JSON.encode(json);
|
||||
? _prettyEncoder.convert(jsonObject)
|
||||
: json.encode(jsonObject);
|
||||
}
|
||||
|
||||
List<TimelineEvent> _extractNamedEvents(String name) {
|
||||
|
@ -298,7 +298,7 @@ class FlutterDriverExtension {
|
||||
Future<ScrollResult> _scroll(Command command) async {
|
||||
final Scroll scrollCommand = command;
|
||||
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 Duration pause = scrollCommand.duration ~/ totalMoves;
|
||||
final Offset startLocation = _prober.getCenter(target);
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:convert' show JSON;
|
||||
import 'dart:convert' show json;
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:flutter_driver/flutter_driver.dart';
|
||||
@ -245,7 +245,7 @@ void main() {
|
||||
]).writeSummaryToFile('test', destinationDirectory: tempDir.path);
|
||||
final String written =
|
||||
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,
|
||||
'worst_frame_build_time_millis': 11.0,
|
||||
'missed_frame_build_budget_count': 2,
|
||||
|
@ -14,9 +14,9 @@ void main() {
|
||||
DateTime initialDate;
|
||||
|
||||
setUp(() {
|
||||
firstDate = new DateTime(2001, DateTime.JANUARY, 1);
|
||||
lastDate = new DateTime(2031, DateTime.DECEMBER, 31);
|
||||
initialDate = new DateTime(2016, DateTime.JANUARY, 15);
|
||||
firstDate = new DateTime(2001, DateTime.january, 1);
|
||||
lastDate = new DateTime(2031, DateTime.december, 31);
|
||||
initialDate = new DateTime(2016, DateTime.january, 15);
|
||||
});
|
||||
|
||||
group(DayPicker, () {
|
||||
|
@ -80,12 +80,12 @@ class AndroidDevice extends Device {
|
||||
printTrace(propCommand.join(' '));
|
||||
|
||||
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.
|
||||
final ProcessResult result = await processManager.run(
|
||||
propCommand,
|
||||
stdoutEncoding: LATIN1,
|
||||
stderrEncoding: LATIN1,
|
||||
stdoutEncoding: latin1,
|
||||
stderrEncoding: latin1,
|
||||
).timeout(const Duration(seconds: 5));
|
||||
if (result.exitCode == 0) {
|
||||
_properties = parseAdbDeviceProperties(result.stdout);
|
||||
@ -522,7 +522,7 @@ class AndroidDevice extends Device {
|
||||
final StreamSubscription<String> logs = getLogReader().logLines.listen((String line) {
|
||||
final Match match = discoverExp.firstMatch(line);
|
||||
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']));
|
||||
}
|
||||
});
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user