Re-enable const (#31600)

* Re-enable const
This commit is contained in:
Dan Field 2019-04-29 16:02:42 -07:00 committed by GitHub
parent 8fd7fa492a
commit fe9512fa72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
104 changed files with 781 additions and 784 deletions

View file

@ -122,8 +122,7 @@ linter:
- prefer_asserts_in_initializer_lists
- prefer_collection_literals
- prefer_conditional_assignment
# TODO(dnfield) - re-enable this when custom embedders catch up with the Rect/RRect constness.
# - prefer_const_constructors
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables

View file

@ -205,13 +205,13 @@ class _PestoLogoState extends State<PestoLogo> {
static const double kTextHeight = 48.0;
final TextStyle titleStyle = const PestoStyle(fontSize: kTextHeight, fontWeight: FontWeight.w900, color: Colors.white, letterSpacing: 3.0);
final RectTween _textRectTween = RectTween(
begin: Rect.fromLTWH(0.0, kLogoHeight, kLogoWidth, kTextHeight),
end: Rect.fromLTWH(0.0, kImageHeight, kLogoWidth, kTextHeight),
begin: const Rect.fromLTWH(0.0, kLogoHeight, kLogoWidth, kTextHeight),
end: const Rect.fromLTWH(0.0, kImageHeight, kLogoWidth, kTextHeight),
);
final Curve _textOpacity = const Interval(0.4, 1.0, curve: Curves.easeInOut);
final RectTween _imageRectTween = RectTween(
begin: Rect.fromLTWH(0.0, 0.0, kLogoWidth, kLogoHeight),
end: Rect.fromLTWH(0.0, 0.0, kLogoWidth, kImageHeight),
begin: const Rect.fromLTWH(0.0, 0.0, kLogoWidth, kLogoHeight),
end: const Rect.fromLTWH(0.0, 0.0, kLogoWidth, kImageHeight),
);
@override

View file

@ -12,7 +12,7 @@ import 'package:flutter/painting.dart' show DefaultShaderWarmUp;
Future<void> beginFrame(Duration timeStamp) async {
// PAINT
final ui.PictureRecorder recorder = ui.PictureRecorder();
final ui.Rect paintBounds = ui.Rect.fromLTRB(0, 0, 1000, 1000);
const ui.Rect paintBounds = ui.Rect.fromLTRB(0, 0, 1000, 1000);
final ui.Canvas canvas = ui.Canvas(recorder, paintBounds);
final ui.Paint backgroundPaint = ui.Paint()..color = Colors.white;
canvas.drawRect(paintBounds, backgroundPaint);

View file

@ -29,7 +29,7 @@ void beginFrame(Duration timeStamp) {
final double t = timeStamp.inMicroseconds / Duration.microsecondsPerMillisecond / 1800.0;
canvas.rotate(math.pi * (t % 1.0));
canvas.drawRect(ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
canvas.drawRect(const ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0));
final ui.Picture picture = recorder.endRecording();

View file

@ -19,7 +19,7 @@ ui.Picture paint(ui.Rect paintBounds) {
final ui.Size logicalSize = ui.window.physicalSize / devicePixelRatio;
canvas.translate(logicalSize.width / 2.0, logicalSize.height / 2.0);
canvas.drawRect(ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
canvas.drawRect(const ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0));
// The paint method of Paragraph draws the contents of the paragraph onto the

View file

@ -373,7 +373,7 @@ class _FlutterLogoPainter extends BoxPainter {
0.0, 0.0, 1.0, 0.0,
-77.697, 98.057, 0.0, 1.0,
]));
canvas.drawRect(Rect.fromLTWH(59.8, 123.1, 39.4, 39.4), mediumPaint);
canvas.drawRect(const Rect.fromLTWH(59.8, 123.1, 39.4, 39.4), mediumPaint);
canvas.restore();
// The two gradients.

View file

@ -105,7 +105,7 @@ class DefaultShaderWarmUp extends ShaderWarmUp {
/// compilation cache.
@override
Future<void> warmUpOnCanvas(ui.Canvas canvas) async {
final ui.RRect rrect = ui.RRect.fromLTRBXY(20.0, 20.0, 60.0, 60.0, 10.0, 10.0);
const ui.RRect rrect = ui.RRect.fromLTRBXY(20.0, 20.0, 60.0, 60.0, 10.0, 10.0);
final ui.Path rrectPath = ui.Path()..addRRect(rrect);
final ui.Path circlePath = ui.Path()..addOval(

View file

@ -4686,7 +4686,7 @@ class RenderFollowerLayer extends RenderProxyBox {
_layer,
super.paint,
Offset.zero,
childPaintBounds: Rect.fromLTRB(
childPaintBounds: const Rect.fromLTRB(
// We don't know where we'll end up, so we have no idea what our cull rect should be.
double.negativeInfinity,
double.negativeInfinity,

View file

@ -14,7 +14,7 @@ import 'framework.dart';
const double _kOffset = 40.0; // distance to bottom of banner, at a 45 degree angle inwards
const double _kHeight = 12.0; // height of banner
const double _kBottomOffset = _kOffset + 0.707 * _kHeight; // offset plus sqrt(2)/2 * banner height
final Rect _kRect = Rect.fromLTWH(-_kOffset, _kOffset - _kHeight, _kOffset * 2.0, _kHeight);
const Rect _kRect = Rect.fromLTWH(-_kOffset, _kOffset - _kHeight, _kOffset * 2.0, _kHeight);
const Color _kColor = Color(0xA0B71C1C);
const TextStyle _kTextStyle = TextStyle(

View file

@ -58,8 +58,8 @@ void main() {
});
test('RectTween', () {
final Rect a = Rect.fromLTWH(5.0, 3.0, 7.0, 11.0);
final Rect b = Rect.fromLTWH(8.0, 12.0, 14.0, 18.0);
const Rect a = Rect.fromLTWH(5.0, 3.0, 7.0, 11.0);
const Rect b = Rect.fromLTWH(8.0, 12.0, 14.0, 18.0);
final RectTween tween = RectTween(begin: a, end: b);
expect(tween.lerp(0.5), equals(Rect.lerp(a, b, 0.5)));
expect(tween, hasOneLineDescription);

View file

@ -407,7 +407,7 @@ void main() {
// Given a box constraint of 150, the Center will occupy all that height.
expect(
tester.getRect(find.widgetWithText(Center, '-1')),
Rect.fromLTRB(0.0, 0.0, 800.0, 150.0),
const Rect.fromLTRB(0.0, 0.0, 800.0, 150.0),
);
await tester.drag(find.text('0'), const Offset(0.0, -300.0), touchSlopY: 0);
@ -443,11 +443,11 @@ void main() {
await tester.pump(const Duration(seconds: 2));
expect(
tester.getRect(find.widgetWithText(Center, '-1')),
Rect.fromLTRB(0.0, 0.0, 800.0, 60.0),
const Rect.fromLTRB(0.0, 0.0, 800.0, 60.0),
);
expect(
tester.getRect(find.widgetWithText(Center, '0')),
Rect.fromLTRB(0.0, 60.0, 800.0, 260.0),
const Rect.fromLTRB(0.0, 60.0, 800.0, 260.0),
);
debugDefaultTargetPlatformOverride = null;
@ -484,7 +484,7 @@ void main() {
));
expect(
tester.getRect(find.widgetWithText(Center, '-1')),
Rect.fromLTRB(0.0, 0.0, 800.0, 150.0),
const Rect.fromLTRB(0.0, 0.0, 800.0, 150.0),
);
verify(mockHelper.refreshTask());
@ -501,11 +501,11 @@ void main() {
));
expect(
tester.getRect(find.widgetWithText(Center, '-1')),
Rect.fromLTRB(0.0, 0.0, 800.0, 60.0),
const Rect.fromLTRB(0.0, 0.0, 800.0, 60.0),
);
expect(
tester.getRect(find.widgetWithText(Center, '0')),
Rect.fromLTRB(0.0, 60.0, 800.0, 260.0),
const Rect.fromLTRB(0.0, 60.0, 800.0, 260.0),
);
refreshCompleter.complete(null);
@ -522,7 +522,7 @@ void main() {
expect(find.text('-1'), findsNothing);
expect(
tester.getRect(find.widgetWithText(Center, '0')),
Rect.fromLTRB(0.0, 0.0, 800.0, 200.0),
const Rect.fromLTRB(0.0, 0.0, 800.0, 200.0),
);
debugDefaultTargetPlatformOverride = null;
@ -559,7 +559,7 @@ void main() {
));
expect(
tester.getRect(find.widgetWithText(Center, '-1')),
Rect.fromLTRB(0.0, 0.0, 800.0, 150.0),
const Rect.fromLTRB(0.0, 0.0, 800.0, 150.0),
);
verify(mockHelper.refreshTask());
@ -576,11 +576,11 @@ void main() {
));
expect(
tester.getRect(find.widgetWithText(Center, '-1')),
Rect.fromLTRB(0.0, 0.0, 800.0, 60.0),
const Rect.fromLTRB(0.0, 0.0, 800.0, 60.0),
);
expect(
tester.getRect(find.widgetWithText(Center, '0')),
Rect.fromLTRB(0.0, 60.0, 800.0, 260.0),
const Rect.fromLTRB(0.0, 60.0, 800.0, 260.0),
);
refreshCompleter.complete(null);
@ -687,7 +687,7 @@ void main() {
expect(find.text('-1'), findsNothing);
expect(
tester.getRect(find.widgetWithText(Center, '0')),
Rect.fromLTRB(0.0, 0.0, 800.0, 200.0),
const Rect.fromLTRB(0.0, 0.0, 800.0, 200.0),
);
// Start another drag. It's now in drag mode.
@ -745,7 +745,7 @@ void main() {
));
expect(
tester.getRect(find.widgetWithText(Center, '0')),
Rect.fromLTRB(0.0, 150.0, 800.0, 350.0),
const Rect.fromLTRB(0.0, 150.0, 800.0, 350.0),
);
await gesture.up();
@ -754,7 +754,7 @@ void main() {
expect(find.text('-1'), findsNothing);
expect(
tester.getRect(find.widgetWithText(Center, '0')),
Rect.fromLTRB(0.0, 0.0, 800.0, 200.0),
const Rect.fromLTRB(0.0, 0.0, 800.0, 200.0),
);
debugDefaultTargetPlatformOverride = null;
@ -846,7 +846,7 @@ void main() {
expect(find.text('-1'), findsNothing);
expect(
tester.getRect(find.widgetWithText(Center, '0')),
Rect.fromLTRB(0.0, 0.0, 800.0, 200.0),
const Rect.fromLTRB(0.0, 0.0, 800.0, 200.0),
);
debugDefaultTargetPlatformOverride = null;
@ -930,7 +930,7 @@ void main() {
expect(find.text('-1'), findsNothing);
expect(
tester.getRect(find.widgetWithText(Center, '0')),
Rect.fromLTRB(0.0, 0.0, 800.0, 200.0),
const Rect.fromLTRB(0.0, 0.0, 800.0, 200.0),
);
debugDefaultTargetPlatformOverride = null;
@ -1116,7 +1116,7 @@ void main() {
);
expect(
tester.getRect(find.widgetWithText(Container, '0')),
Rect.fromLTRB(0.0, 60.0, 800.0, 260.0),
const Rect.fromLTRB(0.0, 60.0, 800.0, 260.0),
);
refreshCompleter.complete(null);
@ -1298,7 +1298,7 @@ void main() {
);
expect(
tester.getRect(find.widgetWithText(Center, '0')),
Rect.fromLTRB(0.0, 0.0, 800.0, 200.0),
const Rect.fromLTRB(0.0, 0.0, 800.0, 200.0),
);
verify(mockHelper.refreshTask()); // The refresh function still called.

View file

@ -50,7 +50,7 @@ testWidgets('Opaque bar pushes contents down', (WidgetTester tester) async {
// The top of the [Container] is 44 px from the top of the screen because
// it's pushed down by the opaque navigation bar whose height is 44 px,
// and the 20 px [MediaQuery] top padding is fully absorbed by the navigation bar.
expect(tester.getRect(find.byType(Container)), Rect.fromLTRB(0, 44, 800, 600));
expect(tester.getRect(find.byType(Container)), const Rect.fromLTRB(0, 44, 800, 600));
});
testWidgets('Contents padding from viewInsets', (WidgetTester tester) async {

View file

@ -27,7 +27,7 @@ void main() {
expect(find.byType(CupertinoScrollbar), paints..rrect(
color: const Color(0x99777777),
rrect: RRect.fromRectAndRadius(
Rect.fromLTWH(
const Rect.fromLTWH(
800.0 - 2.5 - 2.5, // Screen width - margin - thickness.
4.0, // Initial position is the top margin.
2.5, // Thickness.

View file

@ -58,7 +58,7 @@ void main() {
await tester.pump(const Duration(milliseconds: 200));
// Height is 36.0.
final Rect scrollbarRect = Rect.fromLTWH(795.0, 4.28659793814433, 2.5, 36.0);
const Rect scrollbarRect = Rect.fromLTWH(795.0, 4.28659793814433, 2.5, 36.0);
expect(find.byType(CupertinoScrollbar), paints..rrect(
rrect: RRect.fromRectAndRadius(scrollbarRect, const Radius.circular(1.25)),
));

View file

@ -330,7 +330,7 @@ void main() {
),
);
expect(tester.getRect(find.byType(Placeholder)), Rect.fromLTWH(0, 0, 800, 400));
expect(tester.getRect(find.byType(Placeholder)), const Rect.fromLTWH(0, 0, 800, 400));
// Don't generate more media query padding from the translucent bottom
// tab since the tab is behind the keyboard now.
expect(MediaQuery.of(innerContext).padding.bottom, 0);
@ -357,7 +357,7 @@ void main() {
),
);
expect(tester.getRect(find.byType(Placeholder)), Rect.fromLTWH(0, 0, 800, 600));
expect(tester.getRect(find.byType(Placeholder)), const Rect.fromLTWH(0, 0, 800, 600));
// Media query padding shows up in the inner content because it wasn't masked
// by the view inset.
expect(MediaQuery.of(innerContext).padding.bottom, 50);
@ -389,7 +389,7 @@ void main() {
),
);
expect(tester.getRect(find.byType(Placeholder)), Rect.fromLTWH(0, 0, 800, 400));
expect(tester.getRect(find.byType(Placeholder)), const Rect.fromLTWH(0, 0, 800, 400));
expect(MediaQuery.of(innerContext).padding.bottom, 0);
});

View file

@ -1192,7 +1192,7 @@ void main() {
});
test('object property test', () {
final Rect rect = Rect.fromLTRB(0.0, 0.0, 20.0, 20.0);
const Rect rect = Rect.fromLTRB(0.0, 0.0, 20.0, 20.0);
final DiagnosticsNode simple = DiagnosticsProperty<Rect>(
'name',
rect,
@ -1267,7 +1267,7 @@ void main() {
});
test('lazy object property test', () {
final Rect rect = Rect.fromLTRB(0.0, 0.0, 20.0, 20.0);
const Rect rect = Rect.fromLTRB(0.0, 0.0, 20.0, 20.0);
final DiagnosticsNode simple = DiagnosticsProperty<Rect>.lazy(
'name',
() => rect,
@ -1448,7 +1448,7 @@ void main() {
validateIterablePropertyJsonSerialization(hideNullProperty);
final List<Object> objects = <Object>[
Rect.fromLTRB(0.0, 0.0, 20.0, 20.0),
const Rect.fromLTRB(0.0, 0.0, 20.0, 20.0),
const Color.fromARGB(255, 255, 255, 255),
];
final IterableProperty<Object> objectsProperty = IterableProperty<Object>(

View file

@ -1221,9 +1221,9 @@ void main() {
),
),
));
expect(tester.getRect(find.byType(AppBar)), Rect.fromLTRB(0.0, 0.0, 800.00, 100.0 + 56.0));
expect(tester.getRect(find.byKey(leadingKey)), Rect.fromLTRB(800.0 - 56.0, 100.0, 800.0, 100.0 + 56.0));
expect(tester.getRect(find.byKey(trailingKey)), Rect.fromLTRB(0.0, 100.0, 400.0, 100.0 + 56.0));
expect(tester.getRect(find.byType(AppBar)), const Rect.fromLTRB(0.0, 0.0, 800.00, 100.0 + 56.0));
expect(tester.getRect(find.byKey(leadingKey)), const Rect.fromLTRB(800.0 - 56.0, 100.0, 800.0, 100.0 + 56.0));
expect(tester.getRect(find.byKey(trailingKey)), const Rect.fromLTRB(0.0, 100.0, 400.0, 100.0 + 56.0));
});
testWidgets('SliverAppBar provides correct semantics in LTR', (WidgetTester tester) async {

View file

@ -23,13 +23,13 @@ void main() {
test('MaterialRectArcTween control test', () {
final MaterialRectArcTween a = MaterialRectArcTween(
begin: Rect.fromLTWH(0.0, 0.0, 10.0, 10.0),
end: Rect.fromLTWH(0.0, 10.0, 10.0, 10.0),
begin: const Rect.fromLTWH(0.0, 0.0, 10.0, 10.0),
end: const Rect.fromLTWH(0.0, 10.0, 10.0, 10.0),
);
final MaterialRectArcTween b = MaterialRectArcTween(
begin: Rect.fromLTWH(0.0, 0.0, 10.0, 10.0),
end: Rect.fromLTWH(0.0, 10.0, 10.0, 10.0),
begin: const Rect.fromLTWH(0.0, 0.0, 10.0, 10.0),
end: const Rect.fromLTWH(0.0, 10.0, 10.0, 10.0),
);
expect(a, hasOneLineDescription);
expect(a.toString(), equals(b.toString()));
@ -52,17 +52,17 @@ void main() {
test('on-axis MaterialRectArcTween', () {
MaterialRectArcTween tween = MaterialRectArcTween(
begin: Rect.fromLTWH(0.0, 0.0, 10.0, 10.0),
end: Rect.fromLTWH(0.0, 10.0, 10.0, 10.0),
begin: const Rect.fromLTWH(0.0, 0.0, 10.0, 10.0),
end: const Rect.fromLTWH(0.0, 10.0, 10.0, 10.0),
);
expect(tween.lerp(0.5), equals(Rect.fromLTWH(0.0, 5.0, 10.0, 10.0)));
expect(tween.lerp(0.5), equals(const Rect.fromLTWH(0.0, 5.0, 10.0, 10.0)));
expect(tween, hasOneLineDescription);
tween = MaterialRectArcTween(
begin: Rect.fromLTWH(0.0, 0.0, 10.0, 10.0),
end: Rect.fromLTWH(10.0, 0.0, 10.0, 10.0),
begin: const Rect.fromLTWH(0.0, 0.0, 10.0, 10.0),
end: const Rect.fromLTWH(10.0, 0.0, 10.0, 10.0),
);
expect(tween.lerp(0.5), equals(Rect.fromLTWH(5.0, 0.0, 10.0, 10.0)));
expect(tween.lerp(0.5), equals(const Rect.fromLTWH(5.0, 0.0, 10.0, 10.0)));
});
test('MaterialPointArcTween', () {
@ -83,8 +83,8 @@ void main() {
});
test('MaterialRectArcTween', () {
final Rect begin = Rect.fromLTRB(180.0, 100.0, 330.0, 200.0);
final Rect end = Rect.fromLTRB(32.0, 275.0, 132.0, 425.0);
const Rect begin = Rect.fromLTRB(180.0, 100.0, 330.0, 200.0);
const Rect end = Rect.fromLTRB(32.0, 275.0, 132.0, 425.0);
bool sameRect(Rect a, Rect b) {
return (a.left - b.left).abs() < 2.0
@ -95,14 +95,14 @@ void main() {
MaterialRectArcTween tween = MaterialRectArcTween(begin: begin, end: end);
expect(tween.lerp(0.0), begin);
expect(sameRect(tween.lerp(0.25), Rect.fromLTRB(120.0, 113.0, 259.0, 237.0)), isTrue);
expect(sameRect(tween.lerp(0.75), Rect.fromLTRB(42.3, 206.5, 153.5, 354.7)), isTrue);
expect(sameRect(tween.lerp(0.25), const Rect.fromLTRB(120.0, 113.0, 259.0, 237.0)), isTrue);
expect(sameRect(tween.lerp(0.75), const Rect.fromLTRB(42.3, 206.5, 153.5, 354.7)), isTrue);
expect(tween.lerp(1.0), end);
tween = MaterialRectArcTween(begin: end, end: begin);
expect(tween.lerp(0.0), end);
expect(sameRect(tween.lerp(0.25), Rect.fromLTRB(92.0, 262.0, 203.0, 388.0)), isTrue);
expect(sameRect(tween.lerp(0.75), Rect.fromLTRB(169.7, 168.5, 308.5, 270.3)), isTrue);
expect(sameRect(tween.lerp(0.25), const Rect.fromLTRB(92.0, 262.0, 203.0, 388.0)), isTrue);
expect(sameRect(tween.lerp(0.75), const Rect.fromLTRB(169.7, 168.5, 308.5, 270.3)), isTrue);
expect(tween.lerp(1.0), begin);
});

View file

@ -345,7 +345,7 @@ void main() {
SemanticsAction.tap,
],
label: 'ABC',
rect: Rect.fromLTRB(0.0, 0.0, 88.0, 48.0),
rect: const Rect.fromLTRB(0.0, 0.0, 88.0, 48.0),
transform: Matrix4.translationValues(356.0, 276.0, 0.0),
flags: <SemanticsFlag>[
SemanticsFlag.isButton,
@ -385,7 +385,7 @@ void main() {
SemanticsAction.tap,
],
label: 'ABC',
rect: Rect.fromLTRB(0.0, 0.0, 88.0, 48.0),
rect: const Rect.fromLTRB(0.0, 0.0, 88.0, 48.0),
transform: Matrix4.translationValues(356.0, 276.0, 0.0),
flags: <SemanticsFlag>[
SemanticsFlag.isButton,
@ -506,7 +506,7 @@ void main() {
await tester.pump(); // start gesture
await tester.pump(const Duration(milliseconds: 200)); // wait for splash to be well under way
final Rect expectedClipRect = Rect.fromLTRB(356.0, 282.0, 444.0, 318.0);
const Rect expectedClipRect = Rect.fromLTRB(356.0, 282.0, 444.0, 318.0);
final Path expectedClipPath = Path()
..addRRect(RRect.fromRectAndRadius(
expectedClipRect,
@ -639,7 +639,7 @@ void main() {
testWidgets('Disabled MaterialButton has same semantic size as enabled and exposes disabled semantics', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester);
final Rect expectedButtonSize = Rect.fromLTRB(0.0, 0.0, 116.0, 48.0);
const Rect expectedButtonSize = Rect.fromLTRB(0.0, 0.0, 116.0, 48.0);
// Button is in center of screen
final Matrix4 expectedButtonTransform = Matrix4.identity()
..translate(

View file

@ -98,7 +98,7 @@ void main() {
children: <TestSemantics>[
TestSemantics.rootChild(
id: 1,
rect: Rect.fromLTWH(0.0, 0.0, 800.0, 56.0),
rect: const Rect.fromLTWH(0.0, 0.0, 800.0, 56.0),
transform: null,
flags: <SemanticsFlag>[
SemanticsFlag.hasToggledState,
@ -111,7 +111,7 @@ void main() {
),
TestSemantics.rootChild(
id: 3,
rect: Rect.fromLTWH(0.0, 0.0, 800.0, 56.0),
rect: const Rect.fromLTWH(0.0, 0.0, 800.0, 56.0),
transform: Matrix4.translationValues(0.0, 56.0, 0.0),
flags: <SemanticsFlag>[
SemanticsFlag.hasCheckedState,
@ -124,7 +124,7 @@ void main() {
),
TestSemantics.rootChild(
id: 5,
rect: Rect.fromLTWH(0.0, 0.0, 800.0, 56.0),
rect: const Rect.fromLTWH(0.0, 0.0, 800.0, 56.0),
transform: Matrix4.translationValues(0.0, 112.0, 0.0),
flags: <SemanticsFlag>[
SemanticsFlag.hasCheckedState,

View file

@ -408,7 +408,7 @@ void main() {
);
expect(
tester.getRect(find.byType(Placeholder)),
Rect.fromLTRB(10.0 + 40.0, 20.0 + 24.0, 800.0 - (40.0 + 30.0), 600.0 - (24.0 + 40.0)),
const Rect.fromLTRB(10.0 + 40.0, 20.0 + 24.0, 800.0 - (40.0 + 30.0), 600.0 - (24.0 + 40.0)),
);
await tester.pumpWidget(
const MediaQuery(
@ -422,12 +422,12 @@ void main() {
);
expect( // no change because this is an animation
tester.getRect(find.byType(Placeholder)),
Rect.fromLTRB(10.0 + 40.0, 20.0 + 24.0, 800.0 - (40.0 + 30.0), 600.0 - (24.0 + 40.0)),
const Rect.fromLTRB(10.0 + 40.0, 20.0 + 24.0, 800.0 - (40.0 + 30.0), 600.0 - (24.0 + 40.0)),
);
await tester.pump(const Duration(seconds: 1));
expect( // animation finished
tester.getRect(find.byType(Placeholder)),
Rect.fromLTRB(40.0, 24.0, 800.0 - 40.0, 600.0 - 24.0),
const Rect.fromLTRB(40.0, 24.0, 800.0 - 40.0, 600.0 - 24.0),
);
});

View file

@ -206,22 +206,22 @@ void main() {
await tester.pumpWidget(build(false, false, false));
expect(tester.renderObjectList(find.byType(AnimatedSize)), hasLength(3));
expect(tester.getRect(find.byType(AnimatedSize).at(0)), Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(1)), Rect.fromLTWH(0.0, 113.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(2)), Rect.fromLTWH(0.0, 170.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(0)), const Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(1)), const Rect.fromLTWH(0.0, 113.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(2)), const Rect.fromLTWH(0.0, 170.0, 800.0, 0.0));
await tester.pump(const Duration(milliseconds: 200));
expect(tester.getRect(find.byType(AnimatedSize).at(0)), Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(1)), Rect.fromLTWH(0.0, 113.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(2)), Rect.fromLTWH(0.0, 170.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(0)), const Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(1)), const Rect.fromLTWH(0.0, 113.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(2)), const Rect.fromLTWH(0.0, 170.0, 800.0, 0.0));
await tester.pumpWidget(build(false, true, false));
expect(tester.getRect(find.byType(AnimatedSize).at(0)), Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(1)), Rect.fromLTWH(0.0, 113.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(2)), Rect.fromLTWH(0.0, 170.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(0)), const Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(1)), const Rect.fromLTWH(0.0, 113.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(2)), const Rect.fromLTWH(0.0, 170.0, 800.0, 0.0));
await tester.pump(kSizeAnimationDuration ~/ 2);
expect(tester.getRect(find.byType(AnimatedSize).at(0)), Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(0)), const Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
final Rect rect1 = tester.getRect(find.byType(AnimatedSize).at(1));
expect(rect1.left, 0.0);
expect(rect1.top, inExclusiveRange(113.0, 113.0 + 16.0 + 32.0)); // 16.0 material gap, plus 16.0 top and bottom margins added to the header
@ -231,12 +231,12 @@ void main() {
expect(rect2, Rect.fromLTWH(0.0, rect1.bottom + 16.0 + 56.0, 800.0, 0.0)); // the 16.0 comes from the MaterialGap being introduced, the 56.0 is the header height.
await tester.pumpWidget(build(false, false, false));
expect(tester.getRect(find.byType(AnimatedSize).at(0)), Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(0)), const Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(1)), rect1);
expect(tester.getRect(find.byType(AnimatedSize).at(2)), rect2);
await tester.pumpWidget(build(false, false, true));
expect(tester.getRect(find.byType(AnimatedSize).at(0)), Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(0)), const Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(1)), rect1);
expect(tester.getRect(find.byType(AnimatedSize).at(2)), rect2);
@ -244,14 +244,14 @@ void main() {
await tester.pump();
await tester.pump();
await tester.pump();
expect(tester.getRect(find.byType(AnimatedSize).at(0)), Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(0)), const Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(1)), rect1);
expect(tester.getRect(find.byType(AnimatedSize).at(2)), rect2);
await tester.pumpAndSettle();
expect(tester.getRect(find.byType(AnimatedSize).at(0)), Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(1)), Rect.fromLTWH(0.0, 56.0 + 1.0 + 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(2)), Rect.fromLTWH(0.0, 56.0 + 1.0 + 56.0 + 16.0 + 16.0 + 48.0 + 16.0, 800.0, 100.0));
expect(tester.getRect(find.byType(AnimatedSize).at(0)), const Rect.fromLTWH(0.0, 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(1)), const Rect.fromLTWH(0.0, 56.0 + 1.0 + 56.0, 800.0, 0.0));
expect(tester.getRect(find.byType(AnimatedSize).at(2)), const Rect.fromLTWH(0.0, 56.0 + 1.0 + 56.0 + 16.0 + 16.0 + 48.0 + 16.0, 800.0, 100.0));
});
testWidgets('Single Panel Open Test', (WidgetTester tester) async {

View file

@ -326,7 +326,7 @@ void main() {
),
),
);
expect(tester.getRect(find.byType(FloatingActionButton)), rectMoreOrLessEquals(Rect.fromLTWH(16.0, 28.0, 56.0, 56.0)));
expect(tester.getRect(find.byType(FloatingActionButton)), rectMoreOrLessEquals(const Rect.fromLTWH(16.0, 28.0, 56.0, 56.0)));
});
testWidgets('End-top floating action button location RTL', (WidgetTester tester) async {
@ -342,7 +342,7 @@ void main() {
),
),
);
expect(tester.getRect(find.byType(FloatingActionButton)), rectMoreOrLessEquals(Rect.fromLTWH(16.0, 28.0, 56.0, 56.0)));
expect(tester.getRect(find.byType(FloatingActionButton)), rectMoreOrLessEquals(const Rect.fromLTWH(16.0, 28.0, 56.0, 56.0)));
});
testWidgets('Start-top floating action button location RTL', (WidgetTester tester) async {
@ -358,7 +358,7 @@ void main() {
),
),
);
expect(tester.getRect(find.byType(FloatingActionButton)), rectMoreOrLessEquals(Rect.fromLTWH(800.0 - 56.0 - 16.0, 28.0, 56.0, 56.0)));
expect(tester.getRect(find.byType(FloatingActionButton)), rectMoreOrLessEquals(const Rect.fromLTWH(800.0 - 56.0 - 16.0, 28.0, 56.0, 56.0)));
});
testWidgets('End-top floating action button location LTR', (WidgetTester tester) async {
@ -371,7 +371,7 @@ void main() {
),
),
);
expect(tester.getRect(find.byType(FloatingActionButton)), rectMoreOrLessEquals(Rect.fromLTWH(800.0 - 56.0 - 16.0, 28.0, 56.0, 56.0)));
expect(tester.getRect(find.byType(FloatingActionButton)), rectMoreOrLessEquals(const Rect.fromLTWH(800.0 - 56.0 - 16.0, 28.0, 56.0, 56.0)));
});
}

View file

@ -288,7 +288,7 @@ void main() {
expect(semantics, hasSemantics(TestSemantics.root(
children: <TestSemantics>[
TestSemantics.rootChild(
rect: Rect.fromLTRB(0.0, 0.0, 48.0, 48.0),
rect: const Rect.fromLTRB(0.0, 0.0, 48.0, 48.0),
actions: <SemanticsAction>[
SemanticsAction.tap,
],
@ -320,7 +320,7 @@ void main() {
expect(semantics, hasSemantics(TestSemantics.root(
children: <TestSemantics>[
TestSemantics.rootChild(
rect: Rect.fromLTRB(0.0, 0.0, 48.0, 48.0),
rect: const Rect.fromLTRB(0.0, 0.0, 48.0, 48.0),
flags: <SemanticsFlag>[
SemanticsFlag.hasEnabledState,
SemanticsFlag.isButton,

View file

@ -171,7 +171,7 @@ void main() {
expect(
box,
paints
..rect(rect: Rect.fromLTRB(300.0, 200.0, 500.0, 400.0), color: Color(Colors.blue.value))
..rect(rect: const Rect.fromLTRB(300.0, 200.0, 500.0, 400.0), color: Color(Colors.blue.value))
..circle(color: Color(Colors.green.value)),
);
@ -199,7 +199,7 @@ void main() {
expect(
box,
paints
..rect(rect: Rect.fromLTRB(300.0, 200.0, 500.0, 400.0), color: Color(Colors.red.value))
..rect(rect: const Rect.fromLTRB(300.0, 200.0, 500.0, 400.0), color: Color(Colors.red.value))
..circle(color: Color(Colors.green.value)),
);

View file

@ -585,13 +585,13 @@ void main() {
),
),
);
// LEFT TOP WIDTH HEIGHT
expect(tester.getRect(find.byType(ListTile).at(0)), Rect.fromLTWH( 0.0, 0.0, 800.0, 177.0));
expect(tester.getRect(find.byType(CircleAvatar).at(0)), Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));
expect(tester.getRect(find.byType(ListTile).at(1)), Rect.fromLTWH( 0.0, 177.0, 800.0, 48.0));
expect(tester.getRect(find.byType(CircleAvatar).at(1)), Rect.fromLTWH( 16.0, 177.0 + 4.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(800.0 - 24.0 - 16.0, 177.0 + 12.0, 24.0, 24.0));
// LEFT TOP WIDTH HEIGHT
expect(tester.getRect(find.byType(ListTile).at(0)), const Rect.fromLTWH( 0.0, 0.0, 800.0, 177.0));
expect(tester.getRect(find.byType(CircleAvatar).at(0)), const Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));
expect(tester.getRect(find.byType(ListTile).at(1)), const Rect.fromLTWH( 0.0, 177.0, 800.0, 48.0));
expect(tester.getRect(find.byType(CircleAvatar).at(1)), const Rect.fromLTWH( 16.0, 177.0 + 4.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 177.0 + 12.0, 24.0, 24.0));
// NON-DENSE "ONE"-LINE
await tester.pumpWidget(
@ -615,13 +615,13 @@ void main() {
),
);
await tester.pump(const Duration(seconds: 2)); // the text styles are animated when we change dense
// LEFT TOP WIDTH HEIGHT
expect(tester.getRect(find.byType(ListTile).at(0)), Rect.fromLTWH( 0.0, 0.0, 800.0, 216.0));
expect(tester.getRect(find.byType(CircleAvatar).at(0)), Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));
expect(tester.getRect(find.byType(ListTile).at(1)), Rect.fromLTWH( 0.0, 216.0 , 800.0, 56.0));
expect(tester.getRect(find.byType(CircleAvatar).at(1)), Rect.fromLTWH( 16.0, 216.0 + 8.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(800.0 - 24.0 - 16.0, 216.0 + 16.0, 24.0, 24.0));
// LEFT TOP WIDTH HEIGHT
expect(tester.getRect(find.byType(ListTile).at(0)), const Rect.fromLTWH( 0.0, 0.0, 800.0, 216.0));
expect(tester.getRect(find.byType(CircleAvatar).at(0)), const Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));
expect(tester.getRect(find.byType(ListTile).at(1)), const Rect.fromLTWH( 0.0, 216.0 , 800.0, 56.0));
expect(tester.getRect(find.byType(CircleAvatar).at(1)), const Rect.fromLTWH( 16.0, 216.0 + 8.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 216.0 + 16.0, 24.0, 24.0));
// DENSE "TWO"-LINE
await tester.pumpWidget(
@ -648,13 +648,13 @@ void main() {
),
),
);
// LEFT TOP WIDTH HEIGHT
expect(tester.getRect(find.byType(ListTile).at(0)), Rect.fromLTWH( 0.0, 0.0, 800.0, 180.0));
expect(tester.getRect(find.byType(CircleAvatar).at(0)), Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));
expect(tester.getRect(find.byType(ListTile).at(1)), Rect.fromLTWH( 0.0, 180.0, 800.0, 64.0));
expect(tester.getRect(find.byType(CircleAvatar).at(1)), Rect.fromLTWH( 16.0, 180.0 + 12.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(800.0 - 24.0 - 16.0, 180.0 + 20.0, 24.0, 24.0));
// LEFT TOP WIDTH HEIGHT
expect(tester.getRect(find.byType(ListTile).at(0)), const Rect.fromLTWH( 0.0, 0.0, 800.0, 180.0));
expect(tester.getRect(find.byType(CircleAvatar).at(0)), const Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));
expect(tester.getRect(find.byType(ListTile).at(1)), const Rect.fromLTWH( 0.0, 180.0, 800.0, 64.0));
expect(tester.getRect(find.byType(CircleAvatar).at(1)), const Rect.fromLTWH( 16.0, 180.0 + 12.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 180.0 + 20.0, 24.0, 24.0));
// NON-DENSE "TWO"-LINE
await tester.pumpWidget(
@ -679,13 +679,13 @@ void main() {
),
),
);
// LEFT TOP WIDTH HEIGHT
expect(tester.getRect(find.byType(ListTile).at(0)), Rect.fromLTWH( 0.0, 0.0, 800.0, 180.0));
expect(tester.getRect(find.byType(CircleAvatar).at(0)), Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));
expect(tester.getRect(find.byType(ListTile).at(1)), Rect.fromLTWH( 0.0, 180.0, 800.0, 72.0));
expect(tester.getRect(find.byType(CircleAvatar).at(1)), Rect.fromLTWH( 16.0, 180.0 + 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(800.0 - 24.0 - 16.0, 180.0 + 24.0, 24.0, 24.0));
// LEFT TOP WIDTH HEIGHT
expect(tester.getRect(find.byType(ListTile).at(0)), const Rect.fromLTWH( 0.0, 0.0, 800.0, 180.0));
expect(tester.getRect(find.byType(CircleAvatar).at(0)), const Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));
expect(tester.getRect(find.byType(ListTile).at(1)), const Rect.fromLTWH( 0.0, 180.0, 800.0, 72.0));
expect(tester.getRect(find.byType(CircleAvatar).at(1)), const Rect.fromLTWH( 16.0, 180.0 + 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 180.0 + 24.0, 24.0, 24.0));
// DENSE "THREE"-LINE
await tester.pumpWidget(
@ -714,13 +714,13 @@ void main() {
),
),
);
// LEFT TOP WIDTH HEIGHT
expect(tester.getRect(find.byType(ListTile).at(0)), Rect.fromLTWH( 0.0, 0.0, 800.0, 180.0));
expect(tester.getRect(find.byType(CircleAvatar).at(0)), Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));
expect(tester.getRect(find.byType(ListTile).at(1)), Rect.fromLTWH( 0.0, 180.0, 800.0, 76.0));
expect(tester.getRect(find.byType(CircleAvatar).at(1)), Rect.fromLTWH( 16.0, 180.0 + 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(800.0 - 24.0 - 16.0, 180.0 + 16.0, 24.0, 24.0));
// LEFT TOP WIDTH HEIGHT
expect(tester.getRect(find.byType(ListTile).at(0)), const Rect.fromLTWH( 0.0, 0.0, 800.0, 180.0));
expect(tester.getRect(find.byType(CircleAvatar).at(0)), const Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));
expect(tester.getRect(find.byType(ListTile).at(1)), const Rect.fromLTWH( 0.0, 180.0, 800.0, 76.0));
expect(tester.getRect(find.byType(CircleAvatar).at(1)), const Rect.fromLTWH( 16.0, 180.0 + 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 180.0 + 16.0, 24.0, 24.0));
// NON-DENSE THREE-LINE
await tester.pumpWidget(
@ -747,13 +747,13 @@ void main() {
),
),
);
// LEFT TOP WIDTH HEIGHT
expect(tester.getRect(find.byType(ListTile).at(0)), Rect.fromLTWH( 0.0, 0.0, 800.0, 180.0));
expect(tester.getRect(find.byType(CircleAvatar).at(0)), Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));
expect(tester.getRect(find.byType(ListTile).at(1)), Rect.fromLTWH( 0.0, 180.0, 800.0, 88.0));
expect(tester.getRect(find.byType(CircleAvatar).at(1)), Rect.fromLTWH( 16.0, 180.0 + 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(800.0 - 24.0 - 16.0, 180.0 + 16.0, 24.0, 24.0));
// LEFT TOP WIDTH HEIGHT
expect(tester.getRect(find.byType(ListTile).at(0)), const Rect.fromLTWH( 0.0, 0.0, 800.0, 180.0));
expect(tester.getRect(find.byType(CircleAvatar).at(0)), const Rect.fromLTWH( 16.0, 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));
expect(tester.getRect(find.byType(ListTile).at(1)), const Rect.fromLTWH( 0.0, 180.0, 800.0, 88.0));
expect(tester.getRect(find.byType(CircleAvatar).at(1)), const Rect.fromLTWH( 16.0, 180.0 + 16.0, 40.0, 40.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 180.0 + 16.0, 24.0, 24.0));
// "ONE-LINE" with Small Leading Widget
await tester.pumpWidget(
@ -777,13 +777,13 @@ void main() {
),
);
await tester.pump(const Duration(seconds: 2)); // the text styles are animated when we change dense
// LEFT TOP WIDTH HEIGHT
expect(tester.getRect(find.byType(ListTile).at(0)), Rect.fromLTWH( 0.0, 0.0, 800.0, 216.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH( 16.0, 16.0, 24.0, 12.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));
expect(tester.getRect(find.byType(ListTile).at(1)), Rect.fromLTWH( 0.0, 216.0 , 800.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(2)), Rect.fromLTWH( 16.0, 216.0 + 16.0, 24.0, 12.0));
expect(tester.getRect(find.byType(Placeholder).at(3)), Rect.fromLTWH(800.0 - 24.0 - 16.0, 216.0 + 16.0, 24.0, 24.0));
// LEFT TOP WIDTH HEIGHT
expect(tester.getRect(find.byType(ListTile).at(0)), const Rect.fromLTWH( 0.0, 0.0, 800.0, 216.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH( 16.0, 16.0, 24.0, 12.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 16.0, 24.0, 24.0));
expect(tester.getRect(find.byType(ListTile).at(1)), const Rect.fromLTWH( 0.0, 216.0 , 800.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(2)), const Rect.fromLTWH( 16.0, 216.0 + 16.0, 24.0, 12.0));
expect(tester.getRect(find.byType(Placeholder).at(3)), const Rect.fromLTWH(800.0 - 24.0 - 16.0, 216.0 + 16.0, 24.0, 24.0));
});
testWidgets('ListTile leading icon height does not exceed ListTile height', (WidgetTester tester) async {
@ -812,8 +812,8 @@ void main() {
),
);
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(16.0, 0.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(16.0, 48.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(16.0, 0.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(16.0, 48.0, 24.0, 48.0));
// Non-dense One line
await tester.pumpWidget(
@ -837,8 +837,8 @@ void main() {
),
);
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(16.0, 0.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(16.0, 56.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(16.0, 0.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(16.0, 56.0, 24.0, 56.0));
// Dense Two line
await tester.pumpWidget(
@ -864,8 +864,8 @@ void main() {
),
);
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(16.0, 8.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(16.0, 64.0 + 8.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(16.0, 8.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(16.0, 64.0 + 8.0, 24.0, 48.0));
// Non-dense Two line
await tester.pumpWidget(
@ -891,8 +891,8 @@ void main() {
),
);
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(16.0, 8.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(16.0, 72.0 + 8.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(16.0, 8.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(16.0, 72.0 + 8.0, 24.0, 56.0));
// Dense Three line
await tester.pumpWidget(
@ -920,8 +920,8 @@ void main() {
),
);
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(16.0, 16.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(16.0, 76.0 + 16.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(16.0, 16.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(16.0, 76.0 + 16.0, 24.0, 48.0));
// Non-dense Three line
await tester.pumpWidget(
@ -949,8 +949,8 @@ void main() {
),
);
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(16.0, 16.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(16.0, 88.0 + 16.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(16.0, 16.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(16.0, 88.0 + 16.0, 24.0, 56.0));
});
testWidgets('ListTile trailing icon height does not exceed ListTile height', (WidgetTester tester) async {
@ -979,8 +979,8 @@ void main() {
),
);
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(800.0 - 16.0 - 24.0, 0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(800.0 - 16.0 - 24.0, 48.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 48.0, 24.0, 48.0));
// Non-dense One line
await tester.pumpWidget(
@ -1004,8 +1004,8 @@ void main() {
),
);
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(800.0 - 16.0 - 24.0, 0.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(800.0 - 16.0 - 24.0, 56.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 0.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 56.0, 24.0, 56.0));
// Dense Two line
await tester.pumpWidget(
@ -1031,8 +1031,8 @@ void main() {
),
);
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(800.0 - 16.0 - 24.0, 8.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(800.0 - 16.0 - 24.0, 64.0 + 8.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 8.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 64.0 + 8.0, 24.0, 48.0));
// Non-dense Two line
await tester.pumpWidget(
@ -1058,8 +1058,8 @@ void main() {
),
);
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(800.0 - 16.0 - 24.0, 8.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(800.0 - 16.0 - 24.0, 72.0 + 8.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 8.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 72.0 + 8.0, 24.0, 56.0));
// Dense Three line
await tester.pumpWidget(
@ -1087,8 +1087,8 @@ void main() {
),
);
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(800.0 - 16.0 - 24.0, 16.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(800.0 - 16.0 - 24.0, 76.0 + 16.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 16.0, 24.0, 48.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 76.0 + 16.0, 24.0, 48.0));
// Non-dense Three line
await tester.pumpWidget(
@ -1116,7 +1116,7 @@ void main() {
),
);
expect(tester.getRect(find.byType(Placeholder).at(0)), Rect.fromLTWH(800.0 - 16.0 - 24.0, 16.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), Rect.fromLTWH(800.0 - 16.0 - 24.0, 88.0 + 16.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(0)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 16.0, 24.0, 56.0));
expect(tester.getRect(find.byType(Placeholder).at(1)), const Rect.fromLTWH(800.0 - 16.0 - 24.0, 88.0 + 16.0, 24.0, 56.0));
});
}

View file

@ -221,7 +221,7 @@ void main() {
final BoxShadow boxShadow = kElevationToShadow[2][0];
final RRect rrect = kMaterialEdges[MaterialType.card].toRRect(
Rect.fromLTRB(0.0, 0.0, 800.0, 100.0)
const Rect.fromLTRB(0.0, 0.0, 800.0, 100.0)
);
expect(
find.byType(MergeableMaterial),

View file

@ -120,7 +120,7 @@ void main() {
);
}
final Rect clipRect = Rect.fromLTRB(0.0, 0.0, 116.0, 36.0);
const Rect clipRect = Rect.fromLTRB(0.0, 0.0, 116.0, 36.0);
final Path clipPath = Path()..addRect(clipRect);
final Finder outlineButton = find.byType(OutlineButton);
@ -244,7 +244,7 @@ void main() {
SemanticsAction.tap,
],
label: 'ABC',
rect: Rect.fromLTRB(0.0, 0.0, 88.0, 48.0),
rect: const Rect.fromLTRB(0.0, 0.0, 88.0, 48.0),
transform: Matrix4.translationValues(356.0, 276.0, 0.0),
flags: <SemanticsFlag>[
SemanticsFlag.isButton,

View file

@ -110,7 +110,7 @@ void main() {
// width to the left of 0 offset box rect and nothing is drawn inside the
// box's rect.
expect(box, paints..rect(
rect: Rect.fromLTWH(-800.0, 0.0, 800.0, 600.0)
rect: const Rect.fromLTWH(-800.0, 0.0, 800.0, 600.0)
));
await tester.pumpAndSettle();

View file

@ -369,24 +369,24 @@ void main() {
});
}
await testPositioningDown(tester, TextDirection.ltr, Alignment.topRight, TextDirection.rtl, Rect.fromLTWH(792.0, 8.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.rtl, Alignment.topRight, TextDirection.rtl, Rect.fromLTWH(792.0, 8.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.ltr, Alignment.topLeft, TextDirection.ltr, Rect.fromLTWH(8.0, 8.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.rtl, Alignment.topLeft, TextDirection.ltr, Rect.fromLTWH(8.0, 8.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.ltr, Alignment.topCenter, TextDirection.ltr, Rect.fromLTWH(350.0, 8.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.rtl, Alignment.topCenter, TextDirection.rtl, Rect.fromLTWH(450.0, 8.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.ltr, Alignment.centerRight, TextDirection.rtl, Rect.fromLTWH(792.0, 250.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.rtl, Alignment.centerRight, TextDirection.rtl, Rect.fromLTWH(792.0, 250.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.ltr, Alignment.centerLeft, TextDirection.ltr, Rect.fromLTWH(8.0, 250.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.rtl, Alignment.centerLeft, TextDirection.ltr, Rect.fromLTWH(8.0, 250.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.ltr, Alignment.center, TextDirection.ltr, Rect.fromLTWH(350.0, 250.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.rtl, Alignment.center, TextDirection.rtl, Rect.fromLTWH(450.0, 250.0, 0.0, 0.0));
await testPositioningDownThenUp(tester, TextDirection.ltr, Alignment.bottomRight, TextDirection.rtl, Rect.fromLTWH(792.0, 500.0, 0.0, 0.0));
await testPositioningDownThenUp(tester, TextDirection.rtl, Alignment.bottomRight, TextDirection.rtl, Rect.fromLTWH(792.0, 500.0, 0.0, 0.0));
await testPositioningDownThenUp(tester, TextDirection.ltr, Alignment.bottomLeft, TextDirection.ltr, Rect.fromLTWH(8.0, 500.0, 0.0, 0.0));
await testPositioningDownThenUp(tester, TextDirection.rtl, Alignment.bottomLeft, TextDirection.ltr, Rect.fromLTWH(8.0, 500.0, 0.0, 0.0));
await testPositioningDownThenUp(tester, TextDirection.ltr, Alignment.bottomCenter, TextDirection.ltr, Rect.fromLTWH(350.0, 500.0, 0.0, 0.0));
await testPositioningDownThenUp(tester, TextDirection.rtl, Alignment.bottomCenter, TextDirection.rtl, Rect.fromLTWH(450.0, 500.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.ltr, Alignment.topRight, TextDirection.rtl, const Rect.fromLTWH(792.0, 8.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.rtl, Alignment.topRight, TextDirection.rtl, const Rect.fromLTWH(792.0, 8.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.ltr, Alignment.topLeft, TextDirection.ltr, const Rect.fromLTWH(8.0, 8.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.rtl, Alignment.topLeft, TextDirection.ltr, const Rect.fromLTWH(8.0, 8.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.ltr, Alignment.topCenter, TextDirection.ltr, const Rect.fromLTWH(350.0, 8.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.rtl, Alignment.topCenter, TextDirection.rtl, const Rect.fromLTWH(450.0, 8.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.ltr, Alignment.centerRight, TextDirection.rtl, const Rect.fromLTWH(792.0, 250.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.rtl, Alignment.centerRight, TextDirection.rtl, const Rect.fromLTWH(792.0, 250.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.ltr, Alignment.centerLeft, TextDirection.ltr, const Rect.fromLTWH(8.0, 250.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.rtl, Alignment.centerLeft, TextDirection.ltr, const Rect.fromLTWH(8.0, 250.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.ltr, Alignment.center, TextDirection.ltr, const Rect.fromLTWH(350.0, 250.0, 0.0, 0.0));
await testPositioningDown(tester, TextDirection.rtl, Alignment.center, TextDirection.rtl, const Rect.fromLTWH(450.0, 250.0, 0.0, 0.0));
await testPositioningDownThenUp(tester, TextDirection.ltr, Alignment.bottomRight, TextDirection.rtl, const Rect.fromLTWH(792.0, 500.0, 0.0, 0.0));
await testPositioningDownThenUp(tester, TextDirection.rtl, Alignment.bottomRight, TextDirection.rtl, const Rect.fromLTWH(792.0, 500.0, 0.0, 0.0));
await testPositioningDownThenUp(tester, TextDirection.ltr, Alignment.bottomLeft, TextDirection.ltr, const Rect.fromLTWH(8.0, 500.0, 0.0, 0.0));
await testPositioningDownThenUp(tester, TextDirection.rtl, Alignment.bottomLeft, TextDirection.ltr, const Rect.fromLTWH(8.0, 500.0, 0.0, 0.0));
await testPositioningDownThenUp(tester, TextDirection.ltr, Alignment.bottomCenter, TextDirection.ltr, const Rect.fromLTWH(350.0, 500.0, 0.0, 0.0));
await testPositioningDownThenUp(tester, TextDirection.rtl, Alignment.bottomCenter, TextDirection.rtl, const Rect.fromLTWH(450.0, 500.0, 0.0, 0.0));
});
testWidgets('PopupMenu removes MediaQuery padding', (WidgetTester tester) async {

View file

@ -65,8 +65,8 @@ void main() {
expect(
find.byType(LinearProgressIndicator),
paints
..rect(rect: Rect.fromLTRB(0.0, 0.0, 200.0, 6.0))
..rect(rect: Rect.fromLTRB(0.0, 0.0, 50.0, 6.0)),
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 200.0, 6.0))
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 50.0, 6.0)),
);
expect(tester.binding.transientCallbackCount, 0);
@ -88,8 +88,8 @@ void main() {
expect(
find.byType(LinearProgressIndicator),
paints
..rect(rect: Rect.fromLTRB(0.0, 0.0, 200.0, 6.0))
..rect(rect: Rect.fromLTRB(150.0, 0.0, 200.0, 6.0)),
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 200.0, 6.0))
..rect(rect: const Rect.fromLTRB(150.0, 0.0, 200.0, 6.0)),
);
expect(tester.binding.transientCallbackCount, 0);
@ -115,7 +115,7 @@ void main() {
expect(
find.byType(LinearProgressIndicator),
paints
..rect(rect: Rect.fromLTRB(0.0, 0.0, 200.0, 6.0))
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 200.0, 6.0))
..rect(rect: Rect.fromLTRB(0.0, 0.0, animationValue * 200.0, 6.0)),
);
@ -142,7 +142,7 @@ void main() {
expect(
find.byType(LinearProgressIndicator),
paints
..rect(rect: Rect.fromLTRB(0.0, 0.0, 200.0, 6.0))
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 200.0, 6.0))
..rect(rect: Rect.fromLTRB(200.0 - animationValue * 200.0, 0.0, 200.0, 6.0)),
);
@ -169,8 +169,8 @@ void main() {
expect(
find.byType(LinearProgressIndicator),
paints
..rect(rect: Rect.fromLTRB(0.0, 0.0, 200.0, 6.0))
..rect(rect: Rect.fromLTRB(0.0, 0.0, 50.0, 6.0), color: Colors.white),
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 200.0, 6.0))
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 50.0, 6.0), color: Colors.white),
);
});
@ -314,8 +314,8 @@ void main() {
expect(
find.byType(LinearProgressIndicator),
paints
..rect(rect: Rect.fromLTRB(0.0, 0.0, 100.0, 12.0))
..rect(rect: Rect.fromLTRB(0.0, 0.0, 25.0, 12.0)),
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 12.0))
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 25.0, 12.0)),
);
expect(tester.binding.transientCallbackCount, 0);
});
@ -336,8 +336,8 @@ void main() {
expect(
find.byType(LinearProgressIndicator),
paints
..rect(rect: Rect.fromLTRB(0.0, 0.0, 100.0, 3.0))
..rect(rect: Rect.fromLTRB(0.0, 0.0, 25.0, 3.0)),
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 3.0))
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 25.0, 3.0)),
);
expect(tester.binding.transientCallbackCount, 0);
});
@ -358,8 +358,8 @@ void main() {
expect(
find.byType(LinearProgressIndicator),
paints
..rect(rect: Rect.fromLTRB(0.0, 0.0, 100.0, 4.0))
..rect(rect: Rect.fromLTRB(0.0, 0.0, 25.0, 4.0)),
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 4.0))
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 25.0, 4.0)),
);
expect(tester.binding.transientCallbackCount, 0);
});

View file

@ -63,7 +63,7 @@ void main() {
],
label: '+',
textDirection: TextDirection.ltr,
rect: Rect.fromLTRB(0.0, 0.0, 48.0, 48.0),
rect: const Rect.fromLTRB(0.0, 0.0, 48.0, 48.0),
children: <TestSemantics>[],
),
]

View file

@ -759,18 +759,18 @@ void main() {
await tester.pump();
await tester.pump(const Duration(seconds: 1));
expect(tester.getRect(find.byKey(appBar)), Rect.fromLTRB(0.0, 0.0, 800.0, 43.0));
expect(tester.getRect(find.byKey(body)), Rect.fromLTRB(0.0, 43.0, 800.0, 348.0));
expect(tester.getRect(find.byKey(floatingActionButton)), rectMoreOrLessEquals(Rect.fromLTRB(36.0, 255.0, 113.0, 332.0)));
expect(tester.getRect(find.byKey(persistentFooterButton)), Rect.fromLTRB(28.0, 357.0, 128.0, 447.0)); // Note: has 8px each top/bottom padding.
expect(tester.getRect(find.byKey(drawer)), Rect.fromLTRB(596.0, 0.0, 800.0, 600.0));
expect(tester.getRect(find.byKey(bottomNavigationBar)), Rect.fromLTRB(0.0, 515.0, 800.0, 600.0));
expect(tester.getRect(find.byKey(insideAppBar)), Rect.fromLTRB(20.0, 30.0, 750.0, 43.0));
expect(tester.getRect(find.byKey(insideBody)), Rect.fromLTRB(20.0, 43.0, 750.0, 348.0));
expect(tester.getRect(find.byKey(insideFloatingActionButton)), rectMoreOrLessEquals(Rect.fromLTRB(36.0, 255.0, 113.0, 332.0)));
expect(tester.getRect(find.byKey(insidePersistentFooterButton)), Rect.fromLTRB(28.0, 357.0, 128.0, 447.0));
expect(tester.getRect(find.byKey(insideDrawer)), Rect.fromLTRB(596.0, 30.0, 750.0, 540.0));
expect(tester.getRect(find.byKey(insideBottomNavigationBar)), Rect.fromLTRB(20.0, 515.0, 750.0, 540.0));
expect(tester.getRect(find.byKey(appBar)), const Rect.fromLTRB(0.0, 0.0, 800.0, 43.0));
expect(tester.getRect(find.byKey(body)), const Rect.fromLTRB(0.0, 43.0, 800.0, 348.0));
expect(tester.getRect(find.byKey(floatingActionButton)), rectMoreOrLessEquals(const Rect.fromLTRB(36.0, 255.0, 113.0, 332.0)));
expect(tester.getRect(find.byKey(persistentFooterButton)),const Rect.fromLTRB(28.0, 357.0, 128.0, 447.0)); // Note: has 8px each top/bottom padding.
expect(tester.getRect(find.byKey(drawer)), const Rect.fromLTRB(596.0, 0.0, 800.0, 600.0));
expect(tester.getRect(find.byKey(bottomNavigationBar)), const Rect.fromLTRB(0.0, 515.0, 800.0, 600.0));
expect(tester.getRect(find.byKey(insideAppBar)), const Rect.fromLTRB(20.0, 30.0, 750.0, 43.0));
expect(tester.getRect(find.byKey(insideBody)), const Rect.fromLTRB(20.0, 43.0, 750.0, 348.0));
expect(tester.getRect(find.byKey(insideFloatingActionButton)), rectMoreOrLessEquals(const Rect.fromLTRB(36.0, 255.0, 113.0, 332.0)));
expect(tester.getRect(find.byKey(insidePersistentFooterButton)), const Rect.fromLTRB(28.0, 357.0, 128.0, 447.0));
expect(tester.getRect(find.byKey(insideDrawer)), const Rect.fromLTRB(596.0, 30.0, 750.0, 540.0));
expect(tester.getRect(find.byKey(insideBottomNavigationBar)), const Rect.fromLTRB(20.0, 515.0, 750.0, 540.0));
});
testWidgets('Scaffold and extreme window padding - persistent footer buttons only', (WidgetTester tester) async {
@ -854,16 +854,16 @@ void main() {
await tester.pump();
await tester.pump(const Duration(seconds: 1));
expect(tester.getRect(find.byKey(appBar)), Rect.fromLTRB(0.0, 0.0, 800.0, 43.0));
expect(tester.getRect(find.byKey(body)), Rect.fromLTRB(0.0, 43.0, 800.0, 400.0));
expect(tester.getRect(find.byKey(floatingActionButton)), rectMoreOrLessEquals(Rect.fromLTRB(36.0, 307.0, 113.0, 384.0)));
expect(tester.getRect(find.byKey(persistentFooterButton)), Rect.fromLTRB(28.0, 442.0, 128.0, 532.0)); // Note: has 8px each top/bottom padding.
expect(tester.getRect(find.byKey(drawer)), Rect.fromLTRB(596.0, 0.0, 800.0, 600.0));
expect(tester.getRect(find.byKey(insideAppBar)), Rect.fromLTRB(20.0, 30.0, 750.0, 43.0));
expect(tester.getRect(find.byKey(insideBody)), Rect.fromLTRB(20.0, 43.0, 750.0, 400.0));
expect(tester.getRect(find.byKey(insideFloatingActionButton)), rectMoreOrLessEquals(Rect.fromLTRB(36.0, 307.0, 113.0, 384.0)));
expect(tester.getRect(find.byKey(insidePersistentFooterButton)), Rect.fromLTRB(28.0, 442.0, 128.0, 532.0));
expect(tester.getRect(find.byKey(insideDrawer)), Rect.fromLTRB(596.0, 30.0, 750.0, 540.0));
expect(tester.getRect(find.byKey(appBar)), const Rect.fromLTRB(0.0, 0.0, 800.0, 43.0));
expect(tester.getRect(find.byKey(body)), const Rect.fromLTRB(0.0, 43.0, 800.0, 400.0));
expect(tester.getRect(find.byKey(floatingActionButton)), rectMoreOrLessEquals(const Rect.fromLTRB(36.0, 307.0, 113.0, 384.0)));
expect(tester.getRect(find.byKey(persistentFooterButton)), const Rect.fromLTRB(28.0, 442.0, 128.0, 532.0)); // Note: has 8px each top/bottom padding.
expect(tester.getRect(find.byKey(drawer)), const Rect.fromLTRB(596.0, 0.0, 800.0, 600.0));
expect(tester.getRect(find.byKey(insideAppBar)), const Rect.fromLTRB(20.0, 30.0, 750.0, 43.0));
expect(tester.getRect(find.byKey(insideBody)), const Rect.fromLTRB(20.0, 43.0, 750.0, 400.0));
expect(tester.getRect(find.byKey(insideFloatingActionButton)), rectMoreOrLessEquals(const Rect.fromLTRB(36.0, 307.0, 113.0, 384.0)));
expect(tester.getRect(find.byKey(insidePersistentFooterButton)), const Rect.fromLTRB(28.0, 442.0, 128.0, 532.0));
expect(tester.getRect(find.byKey(insideDrawer)), const Rect.fromLTRB(596.0, 30.0, 750.0, 540.0));
});

View file

@ -19,7 +19,7 @@ void main() {
));
expect(find.byType(Scrollbar), isNot(paints..rect()));
await tester.fling(find.byType(SingleChildScrollView), const Offset(0.0, -10.0), 10.0);
expect(find.byType(Scrollbar), paints..rect(rect: Rect.fromLTRB(800.0 - 6.0, 1.5, 800.0, 91.5)));
expect(find.byType(Scrollbar), paints..rect(rect: const Rect.fromLTRB(800.0 - 6.0, 1.5, 800.0, 91.5)));
});
testWidgets('Viewport basic test (RTL)', (WidgetTester tester) async {
@ -33,6 +33,6 @@ void main() {
));
expect(find.byType(Scrollbar), isNot(paints..rect()));
await tester.fling(find.byType(SingleChildScrollView), const Offset(0.0, -10.0), 10.0);
expect(find.byType(Scrollbar), paints..rect(rect: Rect.fromLTRB(0.0, 1.5, 6.0, 91.5)));
expect(find.byType(Scrollbar), paints..rect(rect: const Rect.fromLTRB(0.0, 1.5, 6.0, 91.5)));
});
}

View file

@ -127,8 +127,8 @@ void main() {
expect(
sliderBox,
paints
..rect(rect: Rect.fromLTRB(25.0, 299.0, 202.0, 301.0), color: sliderTheme.activeTrackColor)
..rect(rect: Rect.fromLTRB(222.0, 299.0, 776.0, 301.0), color: sliderTheme.inactiveTrackColor),
..rect(rect: const Rect.fromLTRB(25.0, 299.0, 202.0, 301.0), color: sliderTheme.activeTrackColor)
..rect(rect: const Rect.fromLTRB(222.0, 299.0, 776.0, 301.0), color: sliderTheme.inactiveTrackColor),
);
await tester.pumpWidget(_buildApp(sliderTheme, value: 0.25, enabled: false));
@ -143,8 +143,8 @@ void main() {
expect(
sliderBox,
paints
..rect(rect: Rect.fromLTRB(25.0, 299.0, 202.0, 301.0), color: sliderTheme.disabledActiveTrackColor)
..rect(rect: Rect.fromLTRB(222.0, 299.0, 776.0, 301.0), color: sliderTheme.disabledInactiveTrackColor),
..rect(rect: const Rect.fromLTRB(25.0, 299.0, 202.0, 301.0), color: sliderTheme.disabledActiveTrackColor)
..rect(rect: const Rect.fromLTRB(222.0, 299.0, 776.0, 301.0), color: sliderTheme.disabledInactiveTrackColor),
);
});
@ -435,8 +435,8 @@ void main() {
expect(
sliderBox,
paints
..rect(rect: Rect.fromLTRB(32.0, 292.0, 202.0, 308.0), color: sliderTheme.activeTrackColor)
..rect(rect: Rect.fromLTRB(222.0, 292.0, 776.0, 308.0), color: sliderTheme.inactiveTrackColor),
..rect(rect: const Rect.fromLTRB(32.0, 292.0, 202.0, 308.0), color: sliderTheme.activeTrackColor)
..rect(rect: const Rect.fromLTRB(222.0, 292.0, 776.0, 308.0), color: sliderTheme.inactiveTrackColor),
);
await tester.pumpWidget(_buildApp(sliderTheme, value: 0.25, enabled: false));
@ -447,8 +447,8 @@ void main() {
expect(
sliderBox,
paints
..rect(rect: Rect.fromLTRB(32.0, 292.0, 202.0, 308.0), color: sliderTheme.disabledActiveTrackColor)
..rect(rect: Rect.fromLTRB(222.0, 292.0, 776.0, 308.0), color: sliderTheme.disabledInactiveTrackColor),
..rect(rect: const Rect.fromLTRB(32.0, 292.0, 202.0, 308.0), color: sliderTheme.disabledActiveTrackColor)
..rect(rect: const Rect.fromLTRB(222.0, 292.0, 776.0, 308.0), color: sliderTheme.disabledInactiveTrackColor),
);
});

View file

@ -1535,14 +1535,14 @@ void main() {
actions: SemanticsAction.tap.index,
flags: SemanticsFlag.isSelected.index,
label: 'TAB #0\nTab 1 of 2',
rect: Rect.fromLTRB(0.0, 0.0, 116.0, kTextTabBarHeight),
rect: const Rect.fromLTRB(0.0, 0.0, 116.0, kTextTabBarHeight),
transform: Matrix4.translationValues(0.0, 276.0, 0.0),
),
TestSemantics(
id: 5,
actions: SemanticsAction.tap.index,
label: 'TAB #1\nTab 2 of 2',
rect: Rect.fromLTRB(0.0, 0.0, 116.0, kTextTabBarHeight),
rect: const Rect.fromLTRB(0.0, 0.0, 116.0, kTextTabBarHeight),
transform: Matrix4.translationValues(116.0, 276.0, 0.0),
),
],
@ -1799,14 +1799,14 @@ void main() {
actions: SemanticsAction.tap.index,
flags: SemanticsFlag.isSelected.index,
label: 'Semantics override 0\nTab 1 of 2',
rect: Rect.fromLTRB(0.0, 0.0, 116.0, kTextTabBarHeight),
rect: const Rect.fromLTRB(0.0, 0.0, 116.0, kTextTabBarHeight),
transform: Matrix4.translationValues(0.0, 276.0, 0.0),
),
TestSemantics(
id: 5,
actions: SemanticsAction.tap.index,
label: 'Semantics override 1\nTab 2 of 2',
rect: Rect.fromLTRB(0.0, 0.0, 116.0, kTextTabBarHeight),
rect: const Rect.fromLTRB(0.0, 0.0, 116.0, kTextTabBarHeight),
transform: Matrix4.translationValues(116.0, 276.0, 0.0),
),
],

View file

@ -21,7 +21,7 @@ void main() {
});
test('BeveledRectangleBorder BorderRadius.zero', () {
final Rect rect1 = Rect.fromLTRB(10.0, 20.0, 30.0, 40.0);
const Rect rect1 = Rect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final Matcher looksLikeRect1 = isPathThat(
includes: const <Offset>[ Offset(10.0, 20.0), Offset(20.0, 30.0) ],
excludes: const <Offset>[ Offset(9.0, 19.0), Offset(31.0, 41.0) ],
@ -45,7 +45,7 @@ void main() {
});
test('BeveledRectangleBorder non-zero BorderRadius', () {
final Rect rect = Rect.fromLTRB(10.0, 20.0, 30.0, 40.0);
const Rect rect = Rect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final Matcher looksLikeRect = isPathThat(
includes: const <Offset>[ Offset(15.0, 25.0), Offset(20.0, 30.0) ],
excludes: const <Offset>[ Offset(10.0, 20.0), Offset(30.0, 40.0) ],

View file

@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
test('BorderRadius control test', () {
final Rect rect = Rect.fromLTRB(19.0, 23.0, 29.0, 31.0);
const Rect rect = Rect.fromLTRB(19.0, 23.0, 29.0, 31.0);
BorderRadius borderRadius;
borderRadius = const BorderRadius.all(Radius.elliptical(5.0, 7.0));
@ -162,7 +162,7 @@ void main() {
});
test('BorderRadiusDirectional control test', () {
final Rect rect = Rect.fromLTRB(19.0, 23.0, 29.0, 31.0);
const Rect rect = Rect.fromLTRB(19.0, 23.0, 29.0, 31.0);
BorderRadiusDirectional borderRadius;
borderRadius = const BorderRadiusDirectional.all(Radius.elliptical(5.0, 7.0));

View file

@ -120,7 +120,7 @@ void main() {
const Border border = Border(top: BorderSide(width: 10.0), right: BorderSide(width: 20.0));
const BorderDirectional borderDirectional = BorderDirectional(top: BorderSide(width: 10.0), end: BorderSide(width: 20.0));
expect(
border.getOuterPath(Rect.fromLTRB(50.0, 60.0, 110.0, 190.0), textDirection: TextDirection.rtl),
border.getOuterPath(const Rect.fromLTRB(50.0, 60.0, 110.0, 190.0), textDirection: TextDirection.rtl),
isPathThat(
includes: <Offset>[
const Offset(50.0, 60.0),
@ -146,7 +146,7 @@ void main() {
),
);
expect(
border.getInnerPath(Rect.fromLTRB(50.0, 60.0, 110.0, 190.0), textDirection: TextDirection.rtl),
border.getInnerPath(const Rect.fromLTRB(50.0, 60.0, 110.0, 190.0), textDirection: TextDirection.rtl),
// inner path is a rect from 50.0,70.0 to 90.0,190.0
isPathThat(
includes: <Offset>[
@ -184,7 +184,7 @@ void main() {
),
);
expect(
borderDirectional.getOuterPath(Rect.fromLTRB(50.0, 60.0, 110.0, 190.0), textDirection: TextDirection.rtl),
borderDirectional.getOuterPath(const Rect.fromLTRB(50.0, 60.0, 110.0, 190.0), textDirection: TextDirection.rtl),
isPathThat(
includes: <Offset>[
const Offset(50.0, 60.0),
@ -210,7 +210,7 @@ void main() {
),
);
expect(
borderDirectional.getInnerPath(Rect.fromLTRB(50.0, 60.0, 110.0, 190.0), textDirection: TextDirection.rtl),
borderDirectional.getInnerPath(const Rect.fromLTRB(50.0, 60.0, 110.0, 190.0), textDirection: TextDirection.rtl),
// inner path is a rect from 70.0,70.0 to 110.0,190.0
isPathThat(
includes: <Offset>[
@ -251,7 +251,7 @@ void main() {
),
);
expect(
borderDirectional.getOuterPath(Rect.fromLTRB(50.0, 60.0, 110.0, 190.0), textDirection: TextDirection.ltr),
borderDirectional.getOuterPath(const Rect.fromLTRB(50.0, 60.0, 110.0, 190.0), textDirection: TextDirection.ltr),
isPathThat(
includes: <Offset>[
const Offset(50.0, 60.0),
@ -277,7 +277,7 @@ void main() {
),
);
expect(
borderDirectional.getInnerPath(Rect.fromLTRB(50.0, 60.0, 110.0, 190.0), textDirection: TextDirection.ltr),
borderDirectional.getInnerPath(const Rect.fromLTRB(50.0, 60.0, 110.0, 190.0), textDirection: TextDirection.ltr),
// inner path is a rect from 50.0,70.0 to 90.0,190.0
isPathThat(
includes: <Offset>[
@ -590,7 +590,7 @@ void main() {
expect(
(Canvas canvas) {
const BorderDirectional(end: BorderSide(width: 10.0, color: Color(0xFF00FF00)))
.paint(canvas, Rect.fromLTRB(10.0, 20.0, 30.0, 40.0), textDirection: TextDirection.rtl);
.paint(canvas, const Rect.fromLTRB(10.0, 20.0, 30.0, 40.0), textDirection: TextDirection.rtl);
},
paints
..path(
@ -602,7 +602,7 @@ void main() {
expect(
(Canvas canvas) {
const BorderDirectional(end: BorderSide(width: 10.0, color: Color(0xFF00FF00)))
.paint(canvas, Rect.fromLTRB(10.0, 20.0, 30.0, 40.0), textDirection: TextDirection.ltr);
.paint(canvas, const Rect.fromLTRB(10.0, 20.0, 30.0, 40.0), textDirection: TextDirection.ltr);
},
paints
..path(
@ -614,7 +614,7 @@ void main() {
expect(
(Canvas canvas) {
const BorderDirectional(end: BorderSide(width: 10.0, color: Color(0xFF00FF00)))
.paint(canvas, Rect.fromLTRB(10.0, 20.0, 30.0, 40.0));
.paint(canvas, const Rect.fromLTRB(10.0, 20.0, 30.0, 40.0));
},
paintsAssertion, // no TextDirection
);

View file

@ -22,7 +22,7 @@ void main() {
expect(c10.getInnerPath(Rect.fromCircle(center: Offset.zero, radius: 1.0).inflate(10.0)), isUnitCircle);
expect(c10.getOuterPath(Rect.fromCircle(center: Offset.zero, radius: 1.0)), isUnitCircle);
expect(
(Canvas canvas) => c10.paint(canvas, Rect.fromLTWH(10.0, 20.0, 30.0, 40.0)),
(Canvas canvas) => c10.paint(canvas, const Rect.fromLTWH(10.0, 20.0, 30.0, 40.0)),
paints
..circle(x: 25.0, y: 40.0, radius: 10.0, strokeWidth: 10.0),
);

View file

@ -23,7 +23,7 @@ void main() {
});
test('ContinuousRectangleBorder BorderRadius.zero', () {
final Rect rect1 = Rect.fromLTRB(10.0, 20.0, 30.0, 40.0);
const Rect rect1 = Rect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final Matcher looksLikeRect1 = isPathThat(
includes: const <Offset>[ Offset(10.0, 20.0), Offset(20.0, 30.0) ],
excludes: const <Offset>[ Offset(9.0, 19.0), Offset(31.0, 41.0) ],
@ -46,7 +46,7 @@ void main() {
});
test('ContinuousRectangleBorder non-zero BorderRadius', () {
final Rect rect = Rect.fromLTRB(10.0, 20.0, 30.0, 40.0);
const Rect rect = Rect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final Matcher looksLikeRect = isPathThat(
includes: const <Offset>[ Offset(15.0, 25.0), Offset(20.0, 30.0) ],
excludes: const <Offset>[ Offset(10.0, 20.0), Offset(30.0, 40.0) ],

View file

@ -210,7 +210,7 @@ void main() {
colorFilter: colorFilter,
fit: BoxFit.contain,
alignment: Alignment.bottomLeft,
centerSlice: Rect.fromLTWH(10.0, 20.0, 30.0, 40.0),
centerSlice: const Rect.fromLTWH(10.0, 20.0, 30.0, 40.0),
repeat: ImageRepeat.repeatY,
);
@ -223,8 +223,8 @@ void main() {
expect(call.isMethod, isTrue);
expect(call.positionalArguments, hasLength(4));
expect(call.positionalArguments[0], isInstanceOf<TestImage>());
expect(call.positionalArguments[1], Rect.fromLTRB(10.0, 20.0, 40.0, 60.0));
expect(call.positionalArguments[2], Rect.fromLTRB(0.0, 0.0, 100.0, 100.0));
expect(call.positionalArguments[1], const Rect.fromLTRB(10.0, 20.0, 40.0, 60.0));
expect(call.positionalArguments[2], const Rect.fromLTRB(0.0, 0.0, 100.0, 100.0));
expect(call.positionalArguments[3], isInstanceOf<Paint>());
expect(call.positionalArguments[3].isAntiAlias, false);
expect(call.positionalArguments[3].colorFilter, colorFilter);
@ -347,7 +347,7 @@ void main() {
for (double scale = 1.0; scale <= 4.0; scale += 1.0) {
final TestCanvas canvas = TestCanvas(<Invocation>[]);
final Rect outputRect = Rect.fromLTWH(30.0, 30.0, 250.0, 250.0);
const Rect outputRect = Rect.fromLTWH(30.0, 30.0, 250.0, 250.0);
final ui.Image image = TestImage();
paintImage(
@ -391,7 +391,7 @@ void main() {
final TestCanvas canvas = TestCanvas(<Invocation>[]);
// container size > scaled image size
final Rect outputRect = Rect.fromLTWH(30.0, 30.0, 250.0, 250.0);
const Rect outputRect = Rect.fromLTWH(30.0, 30.0, 250.0, 250.0);
final ui.Image image = TestImage();
paintImage(
@ -434,7 +434,7 @@ void main() {
final TestCanvas canvas = TestCanvas(<Invocation>[]);
// container height (20 px) < scaled image height (50 px)
final Rect outputRect = Rect.fromLTWH(30.0, 30.0, 250.0, 20.0);
const Rect outputRect = Rect.fromLTWH(30.0, 30.0, 250.0, 20.0);
final ui.Image image = TestImage();
paintImage(
@ -486,7 +486,7 @@ void main() {
for (BoxFit boxFit in boxFits) {
final TestCanvas canvas = TestCanvas(<Invocation>[]);
final Rect outputRect = Rect.fromLTWH(30.0, 30.0, 250.0, 250.0);
const Rect outputRect = Rect.fromLTWH(30.0, 30.0, 250.0, 250.0);
final ui.Image image = TestImage();
paintImage(

View file

@ -23,11 +23,11 @@ void main() {
expect(insets.along(Axis.horizontal), equals(16.0));
expect(insets.along(Axis.vertical), equals(20.0));
expect(insets.inflateRect(Rect.fromLTRB(23.0, 32.0, 124.0, 143.0)),
Rect.fromLTRB(18.0, 25.0, 135.0, 156.0));
expect(insets.inflateRect(const Rect.fromLTRB(23.0, 32.0, 124.0, 143.0)),
const Rect.fromLTRB(18.0, 25.0, 135.0, 156.0));
expect(insets.deflateRect(Rect.fromLTRB(23.0, 32.0, 124.0, 143.0)),
Rect.fromLTRB(28.0, 39.0, 113.0, 130.0));
expect(insets.deflateRect(const Rect.fromLTRB(23.0, 32.0, 124.0, 143.0)),
const Rect.fromLTRB(28.0, 39.0, 113.0, 130.0));
expect(insets.inflateSize(const Size(100.0, 125.0)), const Size(116.0, 145.0));
expect(insets.deflateSize(const Size(100.0, 125.0)), const Size(84.0, 105.0));

View file

@ -39,7 +39,7 @@ void main() {
});
test('FractionalOffset.fromOffsetAndRect()', () {
final FractionalOffset a = FractionalOffset.fromOffsetAndRect(const Offset(150.0, 120.0), Rect.fromLTWH(50.0, 20.0, 200.0, 400.0));
final FractionalOffset a = FractionalOffset.fromOffsetAndRect(const Offset(150.0, 120.0), const Rect.fromLTWH(50.0, 20.0, 200.0, 400.0));
expect(a, const FractionalOffset(0.5, 0.25));
});
}

View file

@ -196,7 +196,7 @@ void main() {
return const LinearGradient(
begin: AlignmentDirectional.topStart,
colors: <Color>[ Color(0xFFFFFFFF), Color(0xFFFFFFFF) ],
).createShader(Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
).createShader(const Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
},
throwsAssertionError,
);
@ -205,7 +205,7 @@ void main() {
return const LinearGradient(
begin: AlignmentDirectional.topStart,
colors: <Color>[ Color(0xFFFFFFFF), Color(0xFFFFFFFF) ],
).createShader(Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.rtl);
).createShader(const Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.rtl);
},
returnsNormally,
);
@ -214,7 +214,7 @@ void main() {
return const LinearGradient(
begin: AlignmentDirectional.topStart,
colors: <Color>[ Color(0xFFFFFFFF), Color(0xFFFFFFFF) ],
).createShader(Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.ltr);
).createShader(const Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.ltr);
},
returnsNormally,
);
@ -223,7 +223,7 @@ void main() {
return const LinearGradient(
begin: Alignment.topLeft,
colors: <Color>[ Color(0xFFFFFFFF), Color(0xFFFFFFFF) ],
).createShader(Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
).createShader(const Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
},
returnsNormally,
);
@ -235,7 +235,7 @@ void main() {
return const RadialGradient(
center: AlignmentDirectional.topStart,
colors: <Color>[ Color(0xFFFFFFFF), Color(0xFFFFFFFF) ],
).createShader(Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
).createShader(const Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
},
throwsAssertionError,
);
@ -245,7 +245,7 @@ void main() {
return const RadialGradient(
center: AlignmentDirectional.topStart,
colors: <Color>[ Color(0xFFFFFFFF), Color(0xFFFFFFFF) ],
).createShader(Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.rtl);
).createShader(const Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.rtl);
},
returnsNormally,
);
@ -254,7 +254,7 @@ void main() {
return const RadialGradient(
center: AlignmentDirectional.topStart,
colors: <Color>[ Color(0xFFFFFFFF), Color(0xFFFFFFFF) ],
).createShader(Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.ltr);
).createShader(const Rect.fromLTWH(0.0, 0.0, 100.0, 100.0), textDirection: TextDirection.ltr);
},
returnsNormally,
);
@ -263,7 +263,7 @@ void main() {
return const RadialGradient(
center: Alignment.topLeft,
colors: <Color>[ Color(0xFFFFFFFF), Color(0xFFFFFFFF) ],
).createShader(Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
).createShader(const Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
},
returnsNormally,
);
@ -759,7 +759,7 @@ void main() {
],
stops: <double>[0.0, 1.0],
);
final Rect rect = Rect.fromLTWH(1.0, 2.0, 3.0, 4.0);
const Rect rect = Rect.fromLTWH(1.0, 2.0, 3.0, 4.0);
expect(test1a.createShader(rect), isNotNull);
expect(test1b.createShader(rect), isNotNull);
expect(() { test2a.createShader(rect); }, throwsArgumentError);

View file

@ -11,8 +11,8 @@ void main() {
group('CircularNotchedRectangle', () {
test('guest and host don\'t overlap', () {
const CircularNotchedRectangle shape = CircularNotchedRectangle();
final Rect host = Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
final Rect guest = Rect.fromLTWH(50.0, 50.0, 10.0, 10.0);
const Rect host = Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
const Rect guest = Rect.fromLTWH(50.0, 50.0, 10.0, 10.0);
final Path actualPath = shape.getOuterPath(host, guest);
final Path expectedPath = Path()..addRect(host);
@ -29,8 +29,8 @@ void main() {
test('guest center above host', () {
const CircularNotchedRectangle shape = CircularNotchedRectangle();
final Rect host = Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
final Rect guest = Rect.fromLTRB(190.0, 85.0, 210.0, 105.0);
const Rect host = Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
const Rect guest = Rect.fromLTRB(190.0, 85.0, 210.0, 105.0);
final Path actualPath = shape.getOuterPath(host, guest);
@ -39,8 +39,8 @@ void main() {
test('guest center below host', () {
const CircularNotchedRectangle shape = CircularNotchedRectangle();
final Rect host = Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
final Rect guest = Rect.fromLTRB(190.0, 95.0, 210.0, 115.0);
const Rect host = Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
const Rect guest = Rect.fromLTRB(190.0, 95.0, 210.0, 115.0);
final Path actualPath = shape.getOuterPath(host, guest);
@ -48,7 +48,7 @@ void main() {
});
test('no guest is ok', () {
final Rect host = Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
const Rect host = Rect.fromLTRB(0.0, 100.0, 300.0, 300.0);
expect(
const CircularNotchedRectangle().getOuterPath(host, null),
coversSameAreaAs(
@ -65,8 +65,8 @@ void main() {
RoundedRectangleBorder(),
RoundedRectangleBorder(),
).getOuterPath(
Rect.fromLTWH(-200.0, -100.0, 50.0, 100.0),
Rect.fromLTWH(-175.0, -110.0, 100.0, 100.0),
const Rect.fromLTWH(-200.0, -100.0, 50.0, 100.0),
const Rect.fromLTWH(-175.0, -110.0, 100.0, 100.0),
),
coversSameAreaAs(
Path()
@ -77,7 +77,7 @@ void main() {
..lineTo(-175.0, 0.0)
..lineTo(-200.0, 0.0)
..close(),
areaToCompare: Rect.fromLTWH(-300.0, -300.0, 600.0, 600.0),
areaToCompare: const Rect.fromLTWH(-300.0, -300.0, 600.0, 600.0),
sampleSize: 100,
),
);
@ -89,7 +89,7 @@ void main() {
RoundedRectangleBorder(),
RoundedRectangleBorder(),
).getOuterPath(
Rect.fromLTWH(-200.0, -100.0, 50.0, 100.0),
const Rect.fromLTWH(-200.0, -100.0, 50.0, 100.0),
null,
),
coversSameAreaAs(
@ -99,7 +99,7 @@ void main() {
..lineTo(-150.0, 0.0)
..lineTo(-200.0, 0.0)
..close(),
areaToCompare: Rect.fromLTWH(-300.0, -300.0, 600.0, 600.0),
areaToCompare: const Rect.fromLTWH(-300.0, -300.0, 600.0, 600.0),
sampleSize: 100,
),
);

View file

@ -43,7 +43,7 @@ void main() {
final TestCanvas canvas = TestCanvas();
paintImage(
canvas: canvas,
rect: Rect.fromLTWH(50.0, 75.0, 200.0, 100.0),
rect: const Rect.fromLTWH(50.0, 75.0, 200.0, 100.0),
image: image,
fit: BoxFit.cover,
alignment: const Alignment(-1.0, 0.0),
@ -55,8 +55,8 @@ void main() {
expect(command, isNotNull);
expect(command.positionalArguments[0], equals(image));
expect(command.positionalArguments[1], equals(Rect.fromLTWH(0.0, 75.0, 300.0, 150.0)));
expect(command.positionalArguments[2], equals(Rect.fromLTWH(50.0, 75.0, 200.0, 100.0)));
expect(command.positionalArguments[1], equals(const Rect.fromLTWH(0.0, 75.0, 300.0, 150.0)));
expect(command.positionalArguments[2], equals(const Rect.fromLTWH(50.0, 75.0, 200.0, 100.0)));
});
// See also the DecorationImage tests in: decoration_test.dart

View file

@ -24,7 +24,7 @@ void main() {
final RoundedRectangleBorder c2 = RoundedRectangleBorder(side: const BorderSide(width: 1.0), borderRadius: BorderRadius.circular(2.0));
expect(c2.getInnerPath(Rect.fromCircle(center: Offset.zero, radius: 2.0)), isUnitCircle);
expect(c1.getOuterPath(Rect.fromCircle(center: Offset.zero, radius: 1.0)), isUnitCircle);
final Rect rect = Rect.fromLTRB(10.0, 20.0, 80.0, 190.0);
const Rect rect = Rect.fromLTRB(10.0, 20.0, 80.0, 190.0);
expect(
(Canvas canvas) => c10.paint(canvas, rect),
paints
@ -45,7 +45,7 @@ void main() {
test('RoundedRectangleBorder and CircleBorder', () {
final RoundedRectangleBorder r = RoundedRectangleBorder(side: BorderSide.none, borderRadius: BorderRadius.circular(10.0));
const CircleBorder c = CircleBorder(side: BorderSide.none);
final Rect rect = Rect.fromLTWH(0.0, 0.0, 100.0, 20.0); // center is x=40..60 y=10
const Rect rect = Rect.fromLTWH(0.0, 0.0, 100.0, 20.0); // center is x=40..60 y=10
final Matcher looksLikeR = isPathThat(
includes: const <Offset>[ Offset(30.0, 10.0), Offset(50.0, 10.0), ],
excludes: const <Offset>[ Offset(1.0, 1.0), Offset(99.0, 19.0), ],

View file

@ -58,7 +58,7 @@ void main() {
'Border.all(BorderSide(Color(0xff0000ff), 1.0, BorderStyle.solid))',
);
expect((b1 + b2).dimensions, const EdgeInsets.all(2.0));
final Rect rect = Rect.fromLTRB(11.0, 15.0, 299.0, 175.0);
const Rect rect = Rect.fromLTRB(11.0, 15.0, 299.0, 175.0);
expect((Canvas canvas) => (b1 + b2).paint(canvas, rect), paints
..rect(rect: rect.deflate(0.5), color: b2.top.color)
..rect(rect: rect.deflate(1.5), color: b1.top.color),
@ -123,7 +123,7 @@ void main() {
'BorderDirectional(top: BorderSide(Color(0xff0000ff), 1.0, BorderStyle.solid), start: BorderSide(Color(0xff0000ff), 1.0, BorderStyle.solid), end: BorderSide(Color(0xff0000ff), 1.0, BorderStyle.solid), bottom: BorderSide(Color(0xff0000ff), 1.0, BorderStyle.solid))',
);
expect((b1 + b2).dimensions, const EdgeInsetsDirectional.fromSTEB(2.0, 2.0, 2.0, 2.0));
final Rect rect = Rect.fromLTRB(11.0, 15.0, 299.0, 175.0);
const Rect rect = Rect.fromLTRB(11.0, 15.0, 299.0, 175.0);
expect((Canvas canvas) => (b1 + b2).paint(canvas, rect, textDirection: TextDirection.rtl), paints
..rect(rect: rect.deflate(0.5), color: b2.top.color)
..rect(rect: rect.deflate(1.5), color: b1.top.color),

View file

@ -81,7 +81,7 @@ void main() {
);
},
paints
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 100.0, 200.0), destination: Rect.fromLTRB(20.0, 1000.0 - 40.0 - 200.0, 20.0 + 100.0, 1000.0 - 40.0)),
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 100.0, 200.0), destination: const Rect.fromLTRB(20.0, 1000.0 - 40.0 - 200.0, 20.0 + 100.0, 1000.0 - 40.0)),
);
expect(
(Canvas canvas) {

View file

@ -24,7 +24,7 @@ void main() {
expect(c1.getOuterPath(Rect.fromCircle(center: Offset.zero, radius: 1.0)), isUnitCircle);
const StadiumBorder c2 = StadiumBorder(side: BorderSide(width: 1.0));
expect(c2.getInnerPath(Rect.fromCircle(center: Offset.zero, radius: 2.0)), isUnitCircle);
final Rect rect = Rect.fromLTRB(10.0, 20.0, 100.0, 200.0);
const Rect rect = Rect.fromLTRB(10.0, 20.0, 100.0, 200.0);
expect(
(Canvas canvas) => c10.paint(canvas, rect),
paints
@ -38,7 +38,7 @@ void main() {
test('StadiumBorder and CircleBorder', () {
const StadiumBorder stadium = StadiumBorder(side: BorderSide.none);
const CircleBorder circle = CircleBorder(side: BorderSide.none);
final Rect rect = Rect.fromLTWH(0.0, 0.0, 100.0, 20.0);
const Rect rect = Rect.fromLTWH(0.0, 0.0, 100.0, 20.0);
final Matcher looksLikeS = isPathThat(
includes: const <Offset>[ Offset(30.0, 10.0), Offset(50.0, 10.0), ],
excludes: const <Offset>[ Offset(1.0, 1.0), Offset(99.0, 19.0), ],
@ -89,7 +89,7 @@ void main() {
test('StadiumBorder and RoundedRectBorder', () {
const StadiumBorder stadium = StadiumBorder(side: BorderSide.none);
const RoundedRectangleBorder rrect = RoundedRectangleBorder(side: BorderSide.none);
final Rect rect = Rect.fromLTWH(0.0, 0.0, 100.0, 50.0);
const Rect rect = Rect.fromLTWH(0.0, 0.0, 100.0, 50.0);
final Matcher looksLikeS = isPathThat(
includes: const <Offset>[
Offset(25.0, 25.0),

View file

@ -30,9 +30,9 @@ void main() {
test('finds a value within the clip in a ClipRectLayer', () {
final ContainerLayer containerLayer = ContainerLayer();
final List<ClipRectLayer> layers = <ClipRectLayer>[
ClipRectLayer(clipRect: Rect.fromLTRB(0.0, 0.0, 100.0, 100.0)),
ClipRectLayer(clipRect: Rect.fromLTRB(0.0, 100.0, 100.0, 200.0)),
ClipRectLayer(clipRect: Rect.fromLTRB(0.0, 200.0, 100.0, 300.0)),
ClipRectLayer(clipRect: const Rect.fromLTRB(0.0, 0.0, 100.0, 100.0)),
ClipRectLayer(clipRect: const Rect.fromLTRB(0.0, 100.0, 100.0, 200.0)),
ClipRectLayer(clipRect: const Rect.fromLTRB(0.0, 200.0, 100.0, 300.0)),
];
int i = 0;
for (ClipRectLayer layer in layers) {
@ -137,4 +137,3 @@ void main() {
});
});
}

View file

@ -64,14 +64,14 @@ void main() {
test('debugPaintPadding', () {
expect((Canvas canvas) {
debugPaintPadding(canvas, Rect.fromLTRB(10.0, 10.0, 20.0, 20.0), null);
debugPaintPadding(canvas, const Rect.fromLTRB(10.0, 10.0, 20.0, 20.0), null);
}, paints..rect(color: const Color(0x90909090)));
expect((Canvas canvas) {
debugPaintPadding(canvas, Rect.fromLTRB(10.0, 10.0, 20.0, 20.0), Rect.fromLTRB(11.0, 11.0, 19.0, 19.0));
debugPaintPadding(canvas, const Rect.fromLTRB(10.0, 10.0, 20.0, 20.0), const Rect.fromLTRB(11.0, 11.0, 19.0, 19.0));
}, paints..path(color: const Color(0x900090FF))..path(color: const Color(0xFF0090FF)));
expect((Canvas canvas) {
debugPaintPadding(canvas, Rect.fromLTRB(10.0, 10.0, 20.0, 20.0), Rect.fromLTRB(15.0, 15.0, 15.0, 15.0));
}, paints..rect(rect: Rect.fromLTRB(10.0, 10.0, 20.0, 20.0), color: const Color(0x90909090)));
debugPaintPadding(canvas, const Rect.fromLTRB(10.0, 10.0, 20.0, 20.0), const Rect.fromLTRB(15.0, 15.0, 15.0, 15.0));
}, paints..rect(rect: const Rect.fromLTRB(10.0, 10.0, 20.0, 20.0), color: const Color(0x90909090)));
});
test('debugPaintPadding from render objects', () {

View file

@ -93,7 +93,7 @@ void main() {
editable.layout(BoxConstraints.loose(const Size(1000.0, 1000.0)));
expect(
(Canvas canvas) => editable.paint(TestRecordingPaintingContext(canvas), Offset.zero),
paints..clipRect(rect: Rect.fromLTRB(0.0, 0.0, 1000.0, 10.0)),
paints..clipRect(rect: const Rect.fromLTRB(0.0, 0.0, 1000.0, 10.0)),
);
});
@ -134,7 +134,7 @@ void main() {
expect(editable, paints..rect(
color: const Color.fromARGB(0xFF, 0xFF, 0x00, 0x00),
rect: Rect.fromLTWH(40, 0, 1, 10),
rect: const Rect.fromLTWH(40, 0, 1, 10),
));
// Now change to a rounded caret.
@ -146,7 +146,7 @@ void main() {
expect(editable, paints..rrect(
color: const Color.fromARGB(0xFF, 0x00, 0x00, 0xFF),
rrect: RRect.fromRectAndRadius(
Rect.fromLTWH(40, 0, 4, 10),
const Rect.fromLTWH(40, 0, 4, 10),
const Radius.circular(3),
),
));
@ -158,7 +158,7 @@ void main() {
expect(editable, paints..rrect(
color: const Color.fromARGB(0xFF, 0x00, 0x00, 0xFF),
rrect: RRect.fromRectAndRadius(
Rect.fromLTWH(80, 0, 4, 20),
const Rect.fromLTWH(80, 0, 4, 20),
const Radius.circular(3),
),
));
@ -207,7 +207,7 @@ void main() {
expect(editable, paints..rect(
color: const Color.fromARGB(0xFF, 0xFF, 0x00, 0x00),
rect: Rect.fromLTWH(40, 0, 1, 10),
rect: const Rect.fromLTWH(40, 0, 1, 10),
));
// Now change to a rounded caret.
@ -219,7 +219,7 @@ void main() {
expect(editable, paints..rrect(
color: const Color.fromARGB(0xFF, 0x00, 0x00, 0xFF),
rrect: RRect.fromRectAndRadius(
Rect.fromLTWH(40, 0, 4, 10),
const Rect.fromLTWH(40, 0, 4, 10),
const Radius.circular(3),
),
));
@ -231,7 +231,7 @@ void main() {
expect(editable, paints..rrect(
color: const Color.fromARGB(0xFF, 0x00, 0x00, 0xFF),
rrect: RRect.fromRectAndRadius(
Rect.fromLTWH(80, 0, 4, 20),
const Rect.fromLTWH(80, 0, 4, 20),
const Radius.circular(3),
),
));

View file

@ -16,7 +16,7 @@ void main() {
await tester.pumpWidget(ErrorWidget(Exception(errorMessage)));
expect(find.byType(ErrorWidget), paints
..rect(rect: Rect.fromLTWH(0.0, 0.0, 800.0, 600.0))
..rect(rect: const Rect.fromLTWH(0.0, 0.0, 800.0, 600.0))
..paragraph(offset: Offset.zero));
});
}

View file

@ -190,7 +190,7 @@ void main() {
});
});
final Rect unitRect = Rect.fromLTRB(0, 0, 1, 1);
const Rect unitRect = Rect.fromLTRB(0, 0, 1, 1);
test('mutating PerformanceOverlayLayer fields triggers needsAddToScene', () {
final PerformanceOverlayLayer layer = PerformanceOverlayLayer(
@ -328,13 +328,13 @@ void main() {
//
test('Overlapping layers at wrong elevation', () {
final PhysicalModelLayer layerA = PhysicalModelLayer(
clipPath: Path()..addRect(Rect.fromLTWH(0, 0, 20, 20)),
clipPath: Path()..addRect(const Rect.fromLTWH(0, 0, 20, 20)),
elevation: 3.0,
color: const Color(0),
shadowColor: const Color(0),
);
final PhysicalModelLayer layerB =PhysicalModelLayer(
clipPath: Path()..addRect(Rect.fromLTWH(10, 10, 20, 20)),
clipPath: Path()..addRect(const Rect.fromLTWH(10, 10, 20, 20)),
elevation: 2.0,
color: const Color(0),
shadowColor: const Color(0),
@ -352,13 +352,13 @@ void main() {
// Causes no error if check is disabled.
test('Overlapping layers at wrong elevation, check disabled', () {
final PhysicalModelLayer layerA = PhysicalModelLayer(
clipPath: Path()..addRect(Rect.fromLTWH(0, 0, 20, 20)),
clipPath: Path()..addRect(const Rect.fromLTWH(0, 0, 20, 20)),
elevation: 3.0,
color: const Color(0),
shadowColor: const Color(0),
);
final PhysicalModelLayer layerB =PhysicalModelLayer(
clipPath: Path()..addRect(Rect.fromLTWH(10, 10, 20, 20)),
clipPath: Path()..addRect(const Rect.fromLTWH(10, 10, 20, 20)),
elevation: 2.0,
color: const Color(0),
shadowColor: const Color(0),
@ -374,13 +374,13 @@ void main() {
//
test('Non-overlapping layers at wrong elevation', () {
final PhysicalModelLayer layerA = PhysicalModelLayer(
clipPath: Path()..addRect(Rect.fromLTWH(0, 0, 20, 20)),
clipPath: Path()..addRect(const Rect.fromLTWH(0, 0, 20, 20)),
elevation: 3.0,
color: const Color(0),
shadowColor: const Color(0),
);
final PhysicalModelLayer layerB =PhysicalModelLayer(
clipPath: Path()..addRect(Rect.fromLTWH(20, 20, 20, 20)),
clipPath: Path()..addRect(const Rect.fromLTWH(20, 20, 20, 20)),
elevation: 2.0,
color: const Color(0),
shadowColor: const Color(0),
@ -398,21 +398,21 @@ void main() {
//
test('Non-overlapping layers at wrong elevation, child at lower elevation', () {
final PhysicalModelLayer layerA = PhysicalModelLayer(
clipPath: Path()..addRect(Rect.fromLTWH(0, 0, 20, 20)),
clipPath: Path()..addRect(const Rect.fromLTWH(0, 0, 20, 20)),
elevation: 3.0,
color: const Color(0),
shadowColor: const Color(0),
);
layerA.append(PhysicalModelLayer(
clipPath: Path()..addRect(Rect.fromLTWH(2, 2, 10, 10)),
clipPath: Path()..addRect(const Rect.fromLTWH(2, 2, 10, 10)),
elevation: 1.0,
color: const Color(0),
shadowColor: const Color(0),
));
final PhysicalModelLayer layerB =PhysicalModelLayer(
clipPath: Path()..addRect(Rect.fromLTWH(20, 20, 20, 20)),
clipPath: Path()..addRect(const Rect.fromLTWH(20, 20, 20, 20)),
elevation: 2.0,
color: const Color(0),
shadowColor: const Color(0),
@ -433,21 +433,21 @@ void main() {
// after it at a lower elevation.
test('Child overflows parent and overlaps another physical layer', () {
final PhysicalModelLayer layerA = PhysicalModelLayer(
clipPath: Path()..addRect(Rect.fromLTWH(0, 0, 20, 20)),
clipPath: Path()..addRect(const Rect.fromLTWH(0, 0, 20, 20)),
elevation: 3.0,
color: const Color(0),
shadowColor: const Color(0),
);
layerA.append(PhysicalModelLayer(
clipPath: Path()..addRect(Rect.fromLTWH(15, 15, 25, 25)),
clipPath: Path()..addRect(const Rect.fromLTWH(15, 15, 25, 25)),
elevation: 2.0,
color: const Color(0),
shadowColor: const Color(0),
));
final PhysicalModelLayer layerB =PhysicalModelLayer(
clipPath: Path()..addRect(Rect.fromLTWH(20, 20, 20, 20)),
clipPath: Path()..addRect(const Rect.fromLTWH(20, 20, 20, 20)),
elevation: 4.0,
color: const Color(0),
shadowColor: const Color(0),

View file

@ -51,7 +51,7 @@ class TestRenderObject extends RenderObject {
void performResize() { }
@override
Rect get semanticBounds => Rect.fromLTWH(0.0, 0.0, 10.0, 20.0);
Rect get semanticBounds => const Rect.fromLTWH(0.0, 0.0, 10.0, 20.0);
int describeSemanticsConfigurationCallCount = 0;
@ -62,4 +62,3 @@ class TestRenderObject extends RenderObject {
describeSemanticsConfigurationCallCount++;
}
}

View file

@ -21,7 +21,7 @@ void main() {
);
layout(paragraph);
final Rect caret = Rect.fromLTWH(0.0, 0.0, 2.0, 20.0);
const Rect caret = Rect.fromLTWH(0.0, 0.0, 2.0, 20.0);
final Offset offset5 = paragraph.getOffsetForCaret(const TextPosition(offset: 5), caret);
expect(offset5.dx, greaterThan(0.0));

View file

@ -8,7 +8,7 @@ import '../flutter_test_alternative.dart';
void main() {
test('RelativeRect.==', () {
const RelativeRect r = RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
expect(r, RelativeRect.fromSize(Rect.fromLTWH(10.0, 20.0, 0.0, 0.0), const Size(40.0, 60.0)));
expect(r, RelativeRect.fromSize(const Rect.fromLTWH(10.0, 20.0, 0.0, 0.0), const Size(40.0, 60.0)));
});
test('RelativeRect.shift', () {
const RelativeRect r1 = RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
@ -35,8 +35,8 @@ void main() {
});
test('RelativeRect.toRect', () {
const RelativeRect r1 = RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);
final Rect r2 = r1.toRect(Rect.fromLTRB(10.0, 20.0, 90.0, 180.0));
expect(r2, Rect.fromLTRB(10.0, 20.0, 50.0, 120.0));
final Rect r2 = r1.toRect(const Rect.fromLTRB(10.0, 20.0, 90.0, 180.0));
expect(r2, const Rect.fromLTRB(10.0, 20.0, 50.0, 120.0));
});
test('RelativeRect.toSize', () {
const RelativeRect r1 = RelativeRect.fromLTRB(10.0, 20.0, 30.0, 40.0);

View file

@ -38,19 +38,19 @@ void main() {
final RenderObject target = tester.renderObject(find.byWidget(children[5], skipOffstage: false));
RevealedOffset revealed = viewport.getOffsetToReveal(target, 0.0);
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 0.0, 300.0, 100.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 0.0, 300.0, 100.0));
revealed = viewport.getOffsetToReveal(target, 1.0);
expect(revealed.offset, 400.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 100.0, 300.0, 100.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 100.0, 300.0, 100.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 540.0);
expect(revealed.rect, Rect.fromLTWH(40.0, 0.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(40.0, 0.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 350.0);
expect(revealed.rect, Rect.fromLTWH(40.0, 190.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(40.0, 190.0, 10.0, 10.0));
});
testWidgets('Viewport getOffsetToReveal - right', (WidgetTester tester) async {
@ -84,19 +84,19 @@ void main() {
final RenderObject target = tester.renderObject(find.byWidget(children[5], skipOffstage: false));
RevealedOffset revealed = viewport.getOffsetToReveal(target, 0.0);
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 0.0, 100.0, 300.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 0.0, 100.0, 300.0));
revealed = viewport.getOffsetToReveal(target, 1.0);
expect(revealed.offset, 400.0);
expect(revealed.rect, Rect.fromLTWH(100.0, 0.0, 100.0, 300.0));
expect(revealed.rect, const Rect.fromLTWH(100.0, 0.0, 100.0, 300.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 540.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 40.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 350.0);
expect(revealed.rect, Rect.fromLTWH(190.0, 40.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(190.0, 40.0, 10.0, 10.0));
});
testWidgets('Viewport getOffsetToReveal - up', (WidgetTester tester) async {
@ -130,19 +130,19 @@ void main() {
final RenderObject target = tester.renderObject(find.byWidget(children[5], skipOffstage: false));
RevealedOffset revealed = viewport.getOffsetToReveal(target, 0.0);
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 100.0, 300.0, 100.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 100.0, 300.0, 100.0));
revealed = viewport.getOffsetToReveal(target, 1.0);
expect(revealed.offset, 400.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 0.0, 300.0, 100.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 0.0, 300.0, 100.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 550.0);
expect(revealed.rect, Rect.fromLTWH(40.0, 190.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(40.0, 190.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 360.0);
expect(revealed.rect, Rect.fromLTWH(40.0, 0.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(40.0, 0.0, 10.0, 10.0));
});
testWidgets('Viewport getOffsetToReveal - left', (WidgetTester tester) async {
@ -177,19 +177,19 @@ void main() {
final RenderObject target = tester.renderObject(find.byWidget(children[5], skipOffstage: false));
RevealedOffset revealed = viewport.getOffsetToReveal(target, 0.0);
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(100.0, 0.0, 100.0, 300.0));
expect(revealed.rect, const Rect.fromLTWH(100.0, 0.0, 100.0, 300.0));
revealed = viewport.getOffsetToReveal(target, 1.0);
expect(revealed.offset, 400.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 0.0, 100.0, 300.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 0.0, 100.0, 300.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 550.0);
expect(revealed.rect, Rect.fromLTWH(190.0, 40.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(190.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 360.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 40.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 40.0, 10.0, 10.0));
});
testWidgets('Viewport getOffsetToReveal Sliver - down', (WidgetTester tester) async {

View file

@ -39,7 +39,7 @@ void main() {
final Set<SemanticsTag> tags = <SemanticsTag>{tag1, tag2};
final SemanticsNode node = SemanticsNode()
..rect = Rect.fromLTRB(0.0, 0.0, 10.0, 10.0)
..rect = const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0)
..tags = tags;
expect(node.getSemanticsData().tags, tags);
@ -55,7 +55,7 @@ void main() {
childrenInInversePaintOrder: <SemanticsNode>[
SemanticsNode()
..isMergedIntoParent = true
..rect = Rect.fromLTRB(5.0, 5.0, 10.0, 10.0)
..rect = const Rect.fromLTRB(5.0, 5.0, 10.0, 10.0)
..tags = tags,
],
);
@ -108,11 +108,11 @@ void main() {
test('toStringDeep() does not throw with transform == null', () {
final SemanticsNode child1 = SemanticsNode()
..rect = Rect.fromLTRB(0.0, 0.0, 5.0, 5.0);
..rect = const Rect.fromLTRB(0.0, 0.0, 5.0, 5.0);
final SemanticsNode child2 = SemanticsNode()
..rect = Rect.fromLTRB(5.0, 0.0, 10.0, 5.0);
..rect = const Rect.fromLTRB(5.0, 0.0, 10.0, 5.0);
final SemanticsNode root = SemanticsNode()
..rect = Rect.fromLTRB(0.0, 0.0, 10.0, 5.0);
..rect = const Rect.fromLTRB(0.0, 0.0, 10.0, 5.0);
root.updateWith(
config: null,
childrenInInversePaintOrder: <SemanticsNode>[child1, child2],
@ -187,11 +187,11 @@ void main() {
test('toStringDeep respects childOrder parameter', () {
final SemanticsNode child1 = SemanticsNode()
..rect = Rect.fromLTRB(15.0, 0.0, 20.0, 5.0);
..rect = const Rect.fromLTRB(15.0, 0.0, 20.0, 5.0);
final SemanticsNode child2 = SemanticsNode()
..rect = Rect.fromLTRB(10.0, 0.0, 15.0, 5.0);
..rect = const Rect.fromLTRB(10.0, 0.0, 15.0, 5.0);
final SemanticsNode root = SemanticsNode()
..rect = Rect.fromLTRB(0.0, 0.0, 20.0, 5.0);
..rect = const Rect.fromLTRB(0.0, 0.0, 20.0, 5.0);
root.updateWith(
config: null,
childrenInInversePaintOrder: <SemanticsNode>[child1, child2],
@ -233,19 +233,19 @@ void main() {
);
final SemanticsNode child3 = SemanticsNode()
..rect = Rect.fromLTRB(0.0, 0.0, 10.0, 5.0);
..rect = const Rect.fromLTRB(0.0, 0.0, 10.0, 5.0);
child3.updateWith(
config: null,
childrenInInversePaintOrder: <SemanticsNode>[
SemanticsNode()
..rect = Rect.fromLTRB(5.0, 0.0, 10.0, 5.0),
..rect = const Rect.fromLTRB(5.0, 0.0, 10.0, 5.0),
SemanticsNode()
..rect = Rect.fromLTRB(0.0, 0.0, 5.0, 5.0),
..rect = const Rect.fromLTRB(0.0, 0.0, 5.0, 5.0),
],
);
final SemanticsNode rootComplex = SemanticsNode()
..rect = Rect.fromLTRB(0.0, 0.0, 25.0, 5.0);
..rect = const Rect.fromLTRB(0.0, 0.0, 25.0, 5.0);
rootComplex.updateWith(
config: null,
childrenInInversePaintOrder: <SemanticsNode>[child1, child2, child3],
@ -369,7 +369,7 @@ void main() {
..textDirection = TextDirection.rtl
..sortKey = const OrdinalSortKey(1.0);
final SemanticsNode allProperties = SemanticsNode()
..rect = Rect.fromLTWH(50.0, 10.0, 20.0, 30.0)
..rect = const Rect.fromLTWH(50.0, 10.0, 20.0, 30.0)
..transform = Matrix4.translation(Vector3(10.0, 10.0, 0.0))
..updateWith(config: config, childrenInInversePaintOrder: null);
expect(
@ -393,7 +393,7 @@ void main() {
);
final SemanticsNode scaled = SemanticsNode()
..rect = Rect.fromLTWH(50.0, 10.0, 20.0, 30.0)
..rect = const Rect.fromLTWH(50.0, 10.0, 20.0, 30.0)
..transform = Matrix4.diagonal3(Vector3(10.0, 10.0, 1.0));
expect(
scaled.toStringDeep(),

View file

@ -9,7 +9,7 @@ import 'package:flutter/widgets.dart';
void main() {
testWidgets('AnimatedPositioned.fromRect control test', (WidgetTester tester) async {
final AnimatedPositioned positioned = AnimatedPositioned.fromRect(
rect: Rect.fromLTWH(7.0, 5.0, 12.0, 16.0),
rect: const Rect.fromLTWH(7.0, 5.0, 12.0, 16.0),
duration: const Duration(milliseconds: 200),
);

View file

@ -259,8 +259,8 @@ void main() {
..save()
..translate(x: 800.0, y: 0.0)
..rotate(angle: math.pi / 4.0)
..rect(rect: Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0x7f000000), hasMaskFilter: true)
..rect(rect: Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0xa0b71c1c), hasMaskFilter: false)
..rect(rect: const Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0x7f000000), hasMaskFilter: true)
..rect(rect: const Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0xa0b71c1c), hasMaskFilter: false)
..paragraph(offset: const Offset(-40.0, 29.0))
..restore(),
);
@ -274,8 +274,8 @@ void main() {
..save()
..translate(x: 800.0, y: 0.0)
..rotate(angle: math.pi / 4.0)
..rect(rect: Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0x7f000000), hasMaskFilter: true)
..rect(rect: Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0xa0b71c1c), hasMaskFilter: false)
..rect(rect: const Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0x7f000000), hasMaskFilter: true)
..rect(rect: const Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0xa0b71c1c), hasMaskFilter: false)
..paragraph(offset: const Offset(-40.0, 29.0))
..restore(),
);

View file

@ -244,7 +244,7 @@ Future<void> main() async {
..path()
..path()
..path()
..rect(rect: Rect.fromLTRB(355.0, 105.0, 445.0, 195.0))
..rect(rect: const Rect.fromLTRB(355.0, 105.0, 445.0, 195.0))
..drrect(
outer: RRect.fromLTRBAndCorners(
350.0, 200.0, 450.0, 300.0,

View file

@ -16,7 +16,7 @@ class PathClipper extends CustomClipper<Path> {
Path getClip(Size size) {
log.add('getClip');
return Path()
..addRect(Rect.fromLTWH(50.0, 50.0, 100.0, 100.0));
..addRect(const Rect.fromLTWH(50.0, 50.0, 100.0, 100.0));
}
@override
bool shouldReclip(PathClipper oldClipper) => false;
@ -113,7 +113,7 @@ void main() {
width: 100.0,
height: 100.0,
child: ClipRect(
clipper: ValueClipper<Rect>('a', Rect.fromLTWH(5.0, 5.0, 10.0, 10.0)),
clipper: ValueClipper<Rect>('a', const Rect.fromLTWH(5.0, 5.0, 10.0, 10.0)),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () { log.add('tap'); },
@ -137,7 +137,7 @@ void main() {
width: 100.0,
height: 100.0,
child: ClipRect(
clipper: ValueClipper<Rect>('a', Rect.fromLTWH(5.0, 5.0, 10.0, 10.0)),
clipper: ValueClipper<Rect>('a', const Rect.fromLTWH(5.0, 5.0, 10.0, 10.0)),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () { log.add('tap'); },
@ -155,7 +155,7 @@ void main() {
width: 200.0,
height: 200.0,
child: ClipRect(
clipper: ValueClipper<Rect>('a', Rect.fromLTWH(5.0, 5.0, 10.0, 10.0)),
clipper: ValueClipper<Rect>('a', const Rect.fromLTWH(5.0, 5.0, 10.0, 10.0)),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () { log.add('tap'); },
@ -173,7 +173,7 @@ void main() {
width: 200.0,
height: 200.0,
child: ClipRect(
clipper: ValueClipper<Rect>('a', Rect.fromLTWH(5.0, 5.0, 10.0, 10.0)),
clipper: ValueClipper<Rect>('a', const Rect.fromLTWH(5.0, 5.0, 10.0, 10.0)),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () { log.add('tap'); },
@ -191,7 +191,7 @@ void main() {
width: 200.0,
height: 200.0,
child: ClipRect(
clipper: ValueClipper<Rect>('b', Rect.fromLTWH(5.0, 5.0, 10.0, 10.0)),
clipper: ValueClipper<Rect>('b', const Rect.fromLTWH(5.0, 5.0, 10.0, 10.0)),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () { log.add('tap'); },
@ -209,7 +209,7 @@ void main() {
width: 200.0,
height: 200.0,
child: ClipRect(
clipper: ValueClipper<Rect>('c', Rect.fromLTWH(25.0, 25.0, 10.0, 10.0)),
clipper: ValueClipper<Rect>('c', const Rect.fromLTWH(25.0, 25.0, 10.0, 10.0)),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () { log.add('tap'); },
@ -235,7 +235,7 @@ void main() {
);
expect(tester.renderObject(find.byType(ClipRect)).paint, paints
..save()
..clipRect(rect: Rect.fromLTRB(0.0, 0.0, 800.0, 600.0))
..clipRect(rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 600.0))
..save()
..path() // Placeholder
..restore()
@ -243,7 +243,7 @@ void main() {
);
debugPaintSizeEnabled = true;
expect(tester.renderObject(find.byType(ClipRect)).debugPaint, paints
..rect(rect: Rect.fromLTRB(0.0, 0.0, 800.0, 600.0))
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 600.0))
..paragraph(),
);
debugPaintSizeEnabled = false;

View file

@ -45,9 +45,9 @@ void main() {
expect(box, isNotNull);
expect(box, paints
..rect(rect: Rect.fromLTWH(5.0, 5.0, 53.0, 78.0), color: const Color(0xFF00FF00))
..rect(rect: Rect.fromLTWH(26.0, 43.0, 25.0, 33.0), color: const Color(0xFFFFFF00))
..rect(rect: Rect.fromLTWH(5.0, 5.0, 53.0, 78.0), color: const Color(0x7F0000FF)),
..rect(rect: const Rect.fromLTWH(5.0, 5.0, 53.0, 78.0), color: const Color(0xFF00FF00))
..rect(rect: const Rect.fromLTWH(26.0, 43.0, 25.0, 33.0), color: const Color(0xFFFFFF00))
..rect(rect: const Rect.fromLTWH(5.0, 5.0, 53.0, 78.0), color: const Color(0x7F0000FF)),
);
expect(box, hasAGoodToStringDeep);

View file

@ -46,9 +46,9 @@ void _defineTests() {
await tester.pumpWidget(CustomPaint(
foregroundPainter: _PainterWithSemantics(
semantics: CustomPainterSemantics(
semantics: const CustomPainterSemantics(
rect: Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
properties: const SemanticsProperties(
properties: SemanticsProperties(
label: 'foreground',
textDirection: TextDirection.rtl,
),
@ -66,7 +66,7 @@ void _defineTests() {
TestSemantics(
id: 2,
label: 'foreground',
rect: Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
rect: const Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
),
],
),
@ -82,9 +82,9 @@ void _defineTests() {
await tester.pumpWidget(CustomPaint(
painter: _PainterWithSemantics(
semantics: CustomPainterSemantics(
semantics: const CustomPainterSemantics(
rect: Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
properties: const SemanticsProperties(
properties: SemanticsProperties(
label: 'background',
textDirection: TextDirection.rtl,
),
@ -102,7 +102,7 @@ void _defineTests() {
TestSemantics(
id: 2,
label: 'background',
rect: Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
rect: const Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
),
],
),
@ -118,9 +118,9 @@ void _defineTests() {
await tester.pumpWidget(CustomPaint(
painter: _PainterWithSemantics(
semantics: CustomPainterSemantics(
semantics: const CustomPainterSemantics(
rect: Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
properties: const SemanticsProperties(
properties: SemanticsProperties(
label: 'background',
textDirection: TextDirection.rtl,
),
@ -131,9 +131,9 @@ void _defineTests() {
child: const Text('Hello', textDirection: TextDirection.ltr),
),
foregroundPainter: _PainterWithSemantics(
semantics: CustomPainterSemantics(
semantics: const CustomPainterSemantics(
rect: Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
properties: const SemanticsProperties(
properties: SemanticsProperties(
label: 'foreground',
textDirection: TextDirection.rtl,
),
@ -151,17 +151,17 @@ void _defineTests() {
TestSemantics(
id: 3,
label: 'background',
rect: Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
rect: const Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
),
TestSemantics(
id: 2,
label: 'Hello',
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
),
TestSemantics(
id: 4,
label: 'foreground',
rect: Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
rect: const Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
),
],
),
@ -177,10 +177,10 @@ void _defineTests() {
await tester.pumpWidget(CustomPaint(
painter: _PainterWithSemantics(
semantics: CustomPainterSemantics(
key: const ValueKey<int>(1),
semantics: const CustomPainterSemantics(
key: ValueKey<int>(1),
rect: Rect.fromLTRB(1.0, 2.0, 3.0, 4.0),
properties: const SemanticsProperties(
properties: SemanticsProperties(
checked: false,
selected: false,
button: false,
@ -203,7 +203,7 @@ void _defineTests() {
rect: TestSemantics.fullScreen,
children: <TestSemantics>[
TestSemantics(
rect: Rect.fromLTRB(1.0, 2.0, 3.0, 4.0),
rect: const Rect.fromLTRB(1.0, 2.0, 3.0, 4.0),
id: 2,
flags: 1,
label: 'label-before',
@ -223,7 +223,7 @@ void _defineTests() {
painter: _PainterWithSemantics(
semantics: CustomPainterSemantics(
key: const ValueKey<int>(1),
rect: Rect.fromLTRB(5.0, 6.0, 7.0, 8.0),
rect: const Rect.fromLTRB(5.0, 6.0, 7.0, 8.0),
properties: SemanticsProperties(
checked: true,
selected: true,
@ -255,7 +255,7 @@ void _defineTests() {
rect: TestSemantics.fullScreen,
children: <TestSemantics>[
TestSemantics(
rect: Rect.fromLTRB(5.0, 6.0, 7.0, 8.0),
rect: const Rect.fromLTRB(5.0, 6.0, 7.0, 8.0),
actions: 255,
id: 2,
flags: 15,
@ -278,10 +278,10 @@ void _defineTests() {
testWidgets('Can toggle semantics on, off, on without crash', (WidgetTester tester) async {
await tester.pumpWidget(CustomPaint(
painter: _PainterWithSemantics(
semantics: CustomPainterSemantics(
key: const ValueKey<int>(1),
semantics: const CustomPainterSemantics(
key: ValueKey<int>(1),
rect: Rect.fromLTRB(1.0, 2.0, 3.0, 4.0),
properties: const SemanticsProperties(
properties: SemanticsProperties(
checked: false,
selected: false,
button: false,
@ -325,7 +325,7 @@ void _defineTests() {
painter: _PainterWithSemantics(
semantics: CustomPainterSemantics(
key: const ValueKey<int>(1),
rect: Rect.fromLTRB(1.0, 2.0, 3.0, 4.0),
rect: const Rect.fromLTRB(1.0, 2.0, 3.0, 4.0),
properties: SemanticsProperties(
onDismiss: () => performedActions.add(SemanticsAction.dismiss),
onTap: () => performedActions.add(SemanticsAction.tap),
@ -402,10 +402,10 @@ void _defineTests() {
// checked state and toggled state are mutually exclusive.
await tester.pumpWidget(CustomPaint(
painter: _PainterWithSemantics(
semantics: CustomPainterSemantics(
key: const ValueKey<int>(1),
semantics: const CustomPainterSemantics(
key: ValueKey<int>(1),
rect: Rect.fromLTRB(1.0, 2.0, 3.0, 4.0),
properties: const SemanticsProperties(
properties: SemanticsProperties(
enabled: true,
checked: true,
selected: true,
@ -448,10 +448,10 @@ void _defineTests() {
await tester.pumpWidget(CustomPaint(
painter: _PainterWithSemantics(
semantics: CustomPainterSemantics(
key: const ValueKey<int>(1),
semantics: const CustomPainterSemantics(
key: ValueKey<int>(1),
rect: Rect.fromLTRB(1.0, 2.0, 3.0, 4.0),
properties: const SemanticsProperties(
properties: SemanticsProperties(
enabled: true,
toggled: true,
selected: true,
@ -597,9 +597,9 @@ void _defineTests() {
final SemanticsTester semanticsTester = SemanticsTester(tester);
final _PainterWithSemantics painter = _PainterWithSemantics(
semantics: CustomPainterSemantics(
semantics: const CustomPainterSemantics(
rect: Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
properties: const SemanticsProperties(
properties: SemanticsProperties(
label: 'background',
textDirection: TextDirection.rtl,
),
@ -641,9 +641,9 @@ void _defineTests() {
testWidgets('does not rebuild when shouldRebuildSemantics is false', (WidgetTester tester) async {
final SemanticsTester semanticsTester = SemanticsTester(tester);
final CustomPainterSemantics testSemantics = CustomPainterSemantics(
const CustomPainterSemantics testSemantics = CustomPainterSemantics(
rect: Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
properties: const SemanticsProperties(
properties: SemanticsProperties(
label: 'background',
textDirection: TextDirection.rtl,
),
@ -663,9 +663,9 @@ void _defineTests() {
expect(_PainterWithSemantics.buildSemanticsCallCount, 1);
expect(_PainterWithSemantics.semanticsBuilderCallCount, 4);
final CustomPainterSemantics testSemantics2 = CustomPainterSemantics(
const CustomPainterSemantics testSemantics2 = CustomPainterSemantics(
rect: Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
properties: const SemanticsProperties(
properties: SemanticsProperties(
label: 'background',
textDirection: TextDirection.rtl,
),
@ -675,8 +675,8 @@ void _defineTests() {
semantics: testSemantics2,
)));
expect(_PainterWithSemantics.shouldRebuildSemanticsCallCount, 2);
expect(_PainterWithSemantics.buildSemanticsCallCount, 2);
expect(_PainterWithSemantics.semanticsBuilderCallCount, 5);
expect(_PainterWithSemantics.buildSemanticsCallCount, 1);
expect(_PainterWithSemantics.semanticsBuilderCallCount, 4);
semanticsTester.dispose();
});
@ -708,7 +708,7 @@ class _DiffTester {
for (String label in labels) {
children.add(
TestSemantics(
rect: Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
rect: const Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
label: label,
),
);
@ -787,7 +787,7 @@ class _SemanticsDiffTest extends CustomPainter {
}
semantics.add(
CustomPainterSemantics(
rect: Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
rect: const Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
key: key,
properties: SemanticsProperties(
label: label,

View file

@ -19,9 +19,9 @@ void main() {
));
await tester.pumpAndSettle();
expect(tester.getRect(find.descendant(of: find.byKey(const Key('a')), matching: find.byType(SizedBox))),
Rect.fromLTRB(0.0, 0.0, 800.0, 100.0));
const Rect.fromLTRB(0.0, 0.0, 800.0, 100.0));
expect(tester.getRect(find.descendant(of: find.byKey(const Key('b')), matching: find.byType(SizedBox))),
Rect.fromLTRB(0.0, 100.0, 800.0, 200.0));
const Rect.fromLTRB(0.0, 100.0, 800.0, 200.0));
});
testWidgets('CustomScrollView.center', (WidgetTester tester) async {
@ -43,7 +43,7 @@ void main() {
matching: find.byType(SizedBox, skipOffstage: false),
),
),
Rect.fromLTRB(0.0, -100.0, 800.0, 0.0),
const Rect.fromLTRB(0.0, -100.0, 800.0, 0.0),
);
expect(
tester.getRect(
@ -52,7 +52,7 @@ void main() {
matching: find.byType(SizedBox),
),
),
Rect.fromLTRB(0.0, 0.0, 800.0, 100.0),
const Rect.fromLTRB(0.0, 0.0, 800.0, 100.0),
);
});
@ -76,7 +76,7 @@ void main() {
matching: find.byType(SizedBox),
),
),
Rect.fromLTRB(0.0, 500.0, 800.0, 600.0),
const Rect.fromLTRB(0.0, 500.0, 800.0, 600.0),
);
expect(
tester.getRect(
@ -85,7 +85,7 @@ void main() {
matching: find.byType(SizedBox, skipOffstage: false),
),
),
Rect.fromLTRB(0.0, 600.0, 800.0, 700.0),
const Rect.fromLTRB(0.0, 600.0, 800.0, 700.0),
);
});
}

View file

@ -617,14 +617,14 @@ void main() {
expect(editable, paints
..rrect(
rrect: RRect.fromRectAndRadius(
Rect.fromLTRB(463.3333435058594, 0.0833332538604736, 465.3333435058594, 16.083333015441895),
const Rect.fromLTRB(463.3333435058594, 0.0833332538604736, 465.3333435058594, 16.083333015441895),
const Radius.circular(2.0),
),
color: const Color(0xff8e8e93),
)
..rrect(
rrect: RRect.fromRectAndRadius(
Rect.fromLTRB(463.8333435058594, 1.0833336114883423, 466.8333435058594, 15.083333969116211),
const Rect.fromLTRB(463.8333435058594, 1.0833336114883423, 466.8333435058594, 15.083333969116211),
const Radius.circular(1.0),
),
color: const Color(0xbf2196f3),
@ -642,14 +642,14 @@ void main() {
expect(find.byType(EditableText), paints
..rrect(
rrect: RRect.fromRectAndRadius(
Rect.fromLTRB(191.3333282470703, 0.0833332538604736, 193.3333282470703, 16.083333015441895),
const Rect.fromLTRB(191.3333282470703, 0.0833332538604736, 193.3333282470703, 16.083333015441895),
const Radius.circular(2.0),
),
color: const Color(0xff8e8e93),
)
..rrect(
rrect: RRect.fromRectAndRadius(
Rect.fromLTRB(193.83334350585938, 1.0833336114883423, 196.83334350585938, 15.083333969116211),
const Rect.fromLTRB(193.83334350585938, 1.0833336114883423, 196.83334350585938, 15.083333969116211),
const Radius.circular(1.0)),
color: const Color(0xbf2196f3),
),

View file

@ -1230,8 +1230,8 @@ void main() {
const Duration duration = Duration(milliseconds: 300);
const Curve curve = Curves.fastOutSlowIn;
final RectTween pushRectTween = RectTween(
begin: Rect.fromLTWH(leftPadding, 0.0, 100.0, 100.0),
end: Rect.fromLTWH(350.0 + leftPadding / 2, 200.0, 100.0, 200.0),
begin: const Rect.fromLTWH(leftPadding, 0.0, 100.0, 100.0),
end: const Rect.fromLTWH(350.0 + leftPadding / 2, 200.0, 100.0, 200.0),
);
await tester.tap(find.text('two'));
@ -1268,8 +1268,8 @@ void main() {
await tester.pump(); // begin navigation
final RectTween popRectTween = RectTween(
begin: Rect.fromLTWH(350.0 + leftPadding / 2, 200.0, 100.0, 200.0),
end: Rect.fromLTWH(leftPadding, 0.0, 100.0, 100.0),
begin: const Rect.fromLTWH(350.0 + leftPadding / 2, 200.0, 100.0, 200.0),
end: const Rect.fromLTWH(leftPadding, 0.0, 100.0, 100.0),
);
await tester.pump();
expect(tester.getCenter(find.byKey(firstKey)), const Offset(400.0 + leftPadding / 2, 300.0));

View file

@ -66,17 +66,17 @@ void main() {
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
..clipRect(rect: Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..clipRect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..translate(x: 50.0, y: 0.0)
..scale(x: -1.0, y: 1.0)
..translate(x: -50.0, y: 0.0)
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(-12.0, 0.0, 4.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(4.0, 0.0, 20.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(20.0, 0.0, 36.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(36.0, 0.0, 52.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(52.0, 0.0, 68.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(68.0, 0.0, 84.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(84.0, 0.0, 100.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(-12.0, 0.0, 4.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(4.0, 0.0, 20.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(20.0, 0.0, 36.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(36.0, 0.0, 52.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(52.0, 0.0, 68.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(68.0, 0.0, 84.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 0.0, 100.0, 9.0))
..restore(),
);
expect(find.byType(Container), isNot(paints..scale()..scale()));
@ -105,14 +105,14 @@ void main() {
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
..clipRect(rect: Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(-12.0, 0.0, 4.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(4.0, 0.0, 20.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(20.0, 0.0, 36.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(36.0, 0.0, 52.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(52.0, 0.0, 68.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(68.0, 0.0, 84.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(84.0, 0.0, 100.0, 9.0))
..clipRect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(-12.0, 0.0, 4.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(4.0, 0.0, 20.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(20.0, 0.0, 36.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(36.0, 0.0, 52.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(52.0, 0.0, 68.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(68.0, 0.0, 84.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 0.0, 100.0, 9.0))
..restore(),
);
expect(find.byType(Container), isNot(paints..scale()));
@ -140,14 +140,14 @@ void main() {
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
..clipRect(rect: Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(16.0, 0.0, 32.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(32.0, 0.0, 48.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(48.0, 0.0, 64.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(64.0, 0.0, 80.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(80.0, 0.0, 96.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(96.0, 0.0, 112.0, 9.0))
..clipRect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(16.0, 0.0, 32.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(32.0, 0.0, 48.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(48.0, 0.0, 64.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(64.0, 0.0, 80.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(80.0, 0.0, 96.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(96.0, 0.0, 112.0, 9.0))
..restore(),
);
expect(find.byType(Container), isNot(paints..scale()));
@ -175,14 +175,14 @@ void main() {
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
..clipRect(rect: Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(-12.0, 0.0, 4.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(4.0, 0.0, 20.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(20.0, 0.0, 36.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(36.0, 0.0, 52.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(52.0, 0.0, 68.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(68.0, 0.0, 84.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(84.0, 0.0, 100.0, 9.0))
..clipRect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(-12.0, 0.0, 4.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(4.0, 0.0, 20.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(20.0, 0.0, 36.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(36.0, 0.0, 52.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(52.0, 0.0, 68.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(68.0, 0.0, 84.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 0.0, 100.0, 9.0))
..restore(),
);
expect(find.byType(Container), isNot(paints..scale()));
@ -213,7 +213,7 @@ void main() {
..translate(x: 50.0, y: 0.0)
..scale(x: -1.0, y: 1.0)
..translate(x: -50.0, y: 0.0)
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(0.0, 20.5, 16.0, 29.5))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(0.0, 20.5, 16.0, 29.5))
..restore(),
);
expect(find.byType(Container), isNot(paints..scale()..scale()));
@ -241,7 +241,7 @@ void main() {
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(84.0, 20.5, 100.0, 29.5)),
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 20.5, 100.0, 29.5)),
);
expect(find.byType(Container), isNot(paints..scale()));
expect(find.byType(Container), isNot(paints..drawImageRect()..drawImageRect()));
@ -269,7 +269,7 @@ void main() {
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(84.0, 20.5, 100.0, 29.5)),
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 20.5, 100.0, 29.5)),
);
expect(find.byType(Container), isNot(paints..scale()));
expect(find.byType(Container), isNot(paints..drawImageRect()..drawImageRect()));
@ -297,7 +297,7 @@ void main() {
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(84.0, 20.5, 100.0, 29.5)),
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 20.5, 100.0, 29.5)),
);
expect(find.byType(Container), isNot(paints..scale()));
expect(find.byType(Container), isNot(paints..drawImageRect()..drawImageRect()));
@ -324,17 +324,17 @@ void main() {
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
..clipRect(rect: Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..clipRect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..translate(x: 50.0, y: 0.0)
..scale(x: -1.0, y: 1.0)
..translate(x: -50.0, y: 0.0)
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(-12.0, 0.0, 4.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(4.0, 0.0, 20.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(20.0, 0.0, 36.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(36.0, 0.0, 52.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(52.0, 0.0, 68.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(68.0, 0.0, 84.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(84.0, 0.0, 100.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(-12.0, 0.0, 4.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(4.0, 0.0, 20.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(20.0, 0.0, 36.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(36.0, 0.0, 52.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(52.0, 0.0, 68.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(68.0, 0.0, 84.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 0.0, 100.0, 9.0))
..restore(),
);
expect(find.byType(Container), isNot(paints..scale()..scale()));
@ -361,14 +361,14 @@ void main() {
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
..clipRect(rect: Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(-12.0, 0.0, 4.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(4.0, 0.0, 20.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(20.0, 0.0, 36.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(36.0, 0.0, 52.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(52.0, 0.0, 68.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(68.0, 0.0, 84.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(84.0, 0.0, 100.0, 9.0))
..clipRect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(-12.0, 0.0, 4.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(4.0, 0.0, 20.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(20.0, 0.0, 36.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(36.0, 0.0, 52.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(52.0, 0.0, 68.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(68.0, 0.0, 84.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 0.0, 100.0, 9.0))
..restore(),
);
expect(find.byType(Container), isNot(paints..scale()));
@ -394,14 +394,14 @@ void main() {
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
..clipRect(rect: Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(16.0, 0.0, 32.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(32.0, 0.0, 48.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(48.0, 0.0, 64.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(64.0, 0.0, 80.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(80.0, 0.0, 96.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(96.0, 0.0, 112.0, 9.0))
..clipRect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(16.0, 0.0, 32.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(32.0, 0.0, 48.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(48.0, 0.0, 64.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(64.0, 0.0, 80.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(80.0, 0.0, 96.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(96.0, 0.0, 112.0, 9.0))
..restore(),
);
expect(find.byType(Container), isNot(paints..scale()));
@ -427,14 +427,14 @@ void main() {
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
..clipRect(rect: Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(-12.0, 0.0, 4.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(4.0, 0.0, 20.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(20.0, 0.0, 36.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(36.0, 0.0, 52.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(52.0, 0.0, 68.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(68.0, 0.0, 84.0, 9.0))
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(84.0, 0.0, 100.0, 9.0))
..clipRect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 50.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(-12.0, 0.0, 4.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(4.0, 0.0, 20.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(20.0, 0.0, 36.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(36.0, 0.0, 52.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(52.0, 0.0, 68.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(68.0, 0.0, 84.0, 9.0))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 0.0, 100.0, 9.0))
..restore(),
);
expect(find.byType(Container), isNot(paints..scale()));
@ -463,7 +463,7 @@ void main() {
..translate(x: 50.0, y: 0.0)
..scale(x: -1.0, y: 1.0)
..translate(x: -50.0, y: 0.0)
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(0.0, 20.5, 16.0, 29.5))
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(0.0, 20.5, 16.0, 29.5))
..restore(),
);
expect(find.byType(Container), isNot(paints..scale()..scale()));
@ -489,7 +489,7 @@ void main() {
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(84.0, 20.5, 100.0, 29.5)),
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 20.5, 100.0, 29.5)),
);
expect(find.byType(Container), isNot(paints..scale()));
expect(find.byType(Container), isNot(paints..drawImageRect()..drawImageRect()));
@ -515,7 +515,7 @@ void main() {
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(84.0, 20.5, 100.0, 29.5)),
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 20.5, 100.0, 29.5)),
);
expect(find.byType(Container), isNot(paints..scale()));
expect(find.byType(Container), isNot(paints..drawImageRect()..drawImageRect()));
@ -541,7 +541,7 @@ void main() {
EnginePhase.layout, // so that we don't try to paint the fake images
);
expect(find.byType(Container), paints
..drawImageRect(source: Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: Rect.fromLTRB(84.0, 20.5, 100.0, 29.5)),
..drawImageRect(source: const Rect.fromLTRB(0.0, 0.0, 16.0, 9.0), destination: const Rect.fromLTRB(84.0, 20.5, 100.0, 29.5)),
);
expect(find.byType(Container), isNot(paints..scale()));
expect(find.byType(Container), isNot(paints..drawImageRect()..drawImageRect()));

View file

@ -835,7 +835,7 @@ void main() {
TestSemantics.rootChild(
id: 1,
label: 'test',
rect: Rect.fromLTWH(0.0, 0.0, 100.0, 100.0),
rect: const Rect.fromLTWH(0.0, 0.0, 100.0, 100.0),
textDirection: TextDirection.ltr,
flags: <SemanticsFlag>[SemanticsFlag.isImage],
),

View file

@ -36,10 +36,10 @@ void main() {
expectRects(
tester,
<Rect>[
Rect.fromLTWH(0.0, 0.0, 800.0, 150.0),
Rect.fromLTWH(0.0, 150.0, 800.0, 150.0),
Rect.fromLTWH(0.0, 300.0, 800.0, 150.0),
Rect.fromLTWH(0.0, 450.0, 800.0, 150.0),
const Rect.fromLTWH(0.0, 0.0, 800.0, 150.0),
const Rect.fromLTWH(0.0, 150.0, 800.0, 150.0),
const Rect.fromLTWH(0.0, 300.0, 800.0, 150.0),
const Rect.fromLTWH(0.0, 450.0, 800.0, 150.0),
],
);
});
@ -53,10 +53,10 @@ void main() {
expectRects(
tester,
<Rect>[
Rect.fromLTWH(0.0, 450.0, 800.0, 150.0),
Rect.fromLTWH(0.0, 300.0, 800.0, 150.0),
Rect.fromLTWH(0.0, 150.0, 800.0, 150.0),
Rect.fromLTWH(0.0, 0.0, 800.0, 150.0),
const Rect.fromLTWH(0.0, 450.0, 800.0, 150.0),
const Rect.fromLTWH(0.0, 300.0, 800.0, 150.0),
const Rect.fromLTWH(0.0, 150.0, 800.0, 150.0),
const Rect.fromLTWH(0.0, 0.0, 800.0, 150.0),
],
);
});
@ -76,10 +76,10 @@ void main() {
expectRects(
tester,
<Rect>[
Rect.fromLTWH(0.0, 0.0, 200.0, 600.0),
Rect.fromLTWH(200.0, 0.0, 200.0, 600.0),
Rect.fromLTWH(400.0, 0.0, 200.0, 600.0),
Rect.fromLTWH(600.0, 0.0, 200.0, 600.0),
const Rect.fromLTWH(0.0, 0.0, 200.0, 600.0),
const Rect.fromLTWH(200.0, 0.0, 200.0, 600.0),
const Rect.fromLTWH(400.0, 0.0, 200.0, 600.0),
const Rect.fromLTWH(600.0, 0.0, 200.0, 600.0),
],
);
});
@ -99,10 +99,10 @@ void main() {
expectRects(
tester,
<Rect>[
Rect.fromLTWH(600.0, 0.0, 200.0, 600.0),
Rect.fromLTWH(400.0, 0.0, 200.0, 600.0),
Rect.fromLTWH(200.0, 0.0, 200.0, 600.0),
Rect.fromLTWH(0.0, 0.0, 200.0, 600.0),
const Rect.fromLTWH(600.0, 0.0, 200.0, 600.0),
const Rect.fromLTWH(400.0, 0.0, 200.0, 600.0),
const Rect.fromLTWH(200.0, 0.0, 200.0, 600.0),
const Rect.fromLTWH(0.0, 0.0, 200.0, 600.0),
],
);
});

View file

@ -1241,37 +1241,37 @@ void main() {
RenderObject target = tester.renderObject(find.byWidget(outerChildren[5]));
RevealedOffset revealed = viewport.getOffsetToReveal(target, 0.0);
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 200.0, 300.0, 100.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 200.0, 300.0, 100.0));
revealed = viewport.getOffsetToReveal(target, 1.0);
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 200.0, 300.0, 100.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 200.0, 300.0, 100.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(40.0, 240.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(40.0, 240.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(40.0, 240.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(40.0, 240.0, 10.0, 10.0));
// descendant of viewport, not direct child
target = tester.renderObject(find.byWidget(innerChildren[5]));
revealed = viewport.getOffsetToReveal(target, 0.0);
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(125.0, 225.0, 50.0, 50.0));
expect(revealed.rect, const Rect.fromLTWH(125.0, 225.0, 50.0, 50.0));
revealed = viewport.getOffsetToReveal(target, 1.0);
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(125.0, 225.0, 50.0, 50.0));
expect(revealed.rect, const Rect.fromLTWH(125.0, 225.0, 50.0, 50.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(165.0, 265.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(165.0, 265.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(165.0, 265.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(165.0, 265.0, 10.0, 10.0));
});
testWidgets('ListWheelScrollView showOnScreen', (WidgetTester tester) async {

View file

@ -644,35 +644,35 @@ void main() {
),
),
);
expect(tester.getRect(find.byKey(key1)), Rect.fromLTWH(0.0, 0.0, 800.0, 100.0));
expect(tester.getRect(find.byKey(key2)), Rect.fromLTWH(0.0, 100.0, 800.0, 1000.0));
expect(tester.getRect(find.byKey(key1)), const Rect.fromLTWH(0.0, 0.0, 800.0, 100.0));
expect(tester.getRect(find.byKey(key2)), const Rect.fromLTWH(0.0, 100.0, 800.0, 1000.0));
final TestGesture gesture = await tester.startGesture(const Offset(10.0, 10.0));
await gesture.moveBy(const Offset(0.0, -10.0)); // scroll up
await tester.pump();
expect(tester.getRect(find.byKey(key1)), Rect.fromLTWH(0.0, -10.0, 800.0, 100.0));
expect(tester.getRect(find.byKey(key2)), Rect.fromLTWH(0.0, 90.0, 800.0, 1000.0));
expect(tester.getRect(find.byKey(key1)), const Rect.fromLTWH(0.0, -10.0, 800.0, 100.0));
expect(tester.getRect(find.byKey(key2)), const Rect.fromLTWH(0.0, 90.0, 800.0, 1000.0));
await gesture.moveBy(const Offset(0.0, 10.0)); // scroll back to origin
await tester.pump();
expect(tester.getRect(find.byKey(key1)), Rect.fromLTWH(0.0, 0.0, 800.0, 100.0));
expect(tester.getRect(find.byKey(key2)), Rect.fromLTWH(0.0, 100.0, 800.0, 1000.0));
expect(tester.getRect(find.byKey(key1)), const Rect.fromLTWH(0.0, 0.0, 800.0, 100.0));
expect(tester.getRect(find.byKey(key2)), const Rect.fromLTWH(0.0, 100.0, 800.0, 1000.0));
await gesture.moveBy(const Offset(0.0, 10.0)); // overscroll
await gesture.moveBy(const Offset(0.0, 10.0)); // overscroll
await gesture.moveBy(const Offset(0.0, 10.0)); // overscroll
await tester.pump();
expect(tester.getRect(find.byKey(key1)), Rect.fromLTWH(0.0, 0.0, 800.0, 100.0));
expect(tester.getRect(find.byKey(key1)), const Rect.fromLTWH(0.0, 0.0, 800.0, 100.0));
expect(tester.getRect(find.byKey(key2)).top, greaterThan(100.0));
expect(tester.getRect(find.byKey(key2)).top, lessThan(130.0));
await gesture.moveBy(const Offset(0.0, -1.0)); // scroll back a little
await tester.pump();
expect(tester.getRect(find.byKey(key1)), Rect.fromLTWH(0.0, -1.0, 800.0, 100.0));
expect(tester.getRect(find.byKey(key1)), const Rect.fromLTWH(0.0, -1.0, 800.0, 100.0));
expect(tester.getRect(find.byKey(key2)).top, greaterThan(100.0));
expect(tester.getRect(find.byKey(key2)).top, lessThan(129.0));
await gesture.moveBy(const Offset(0.0, -10.0)); // scroll back a lot
await tester.pump();
expect(tester.getRect(find.byKey(key1)), Rect.fromLTWH(0.0, -11.0, 800.0, 100.0));
expect(tester.getRect(find.byKey(key1)), const Rect.fromLTWH(0.0, -11.0, 800.0, 100.0));
await gesture.moveBy(const Offset(0.0, 20.0)); // overscroll again
await tester.pump();
expect(tester.getRect(find.byKey(key1)), Rect.fromLTWH(0.0, 0.0, 800.0, 100.0));
expect(tester.getRect(find.byKey(key1)), const Rect.fromLTWH(0.0, 0.0, 800.0, 100.0));
await gesture.up();
debugDefaultTargetPlatformOverride = null;
});

View file

@ -27,7 +27,7 @@ void main() {
children: <TestSemantics>[
TestSemantics.rootChild(
id: 1,
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
label: 'a',
textDirection: TextDirection.rtl,
),
@ -61,7 +61,7 @@ void main() {
children: <TestSemantics>[
TestSemantics.rootChild(
id: 1,
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
label: 'a',
textDirection: TextDirection.rtl,
),
@ -95,7 +95,7 @@ void main() {
children: <TestSemantics>[
TestSemantics.rootChild(
id: 1,
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
label: 'a',
textDirection: TextDirection.rtl,
),
@ -117,7 +117,7 @@ void main() {
children: <TestSemantics>[
TestSemantics.rootChild(
id: 1,
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
label: 'a',
textDirection: TextDirection.rtl,
),
@ -139,7 +139,7 @@ void main() {
children: <TestSemantics>[
TestSemantics.rootChild(
id: 1,
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
label: 'a',
textDirection: TextDirection.rtl,
),
@ -191,6 +191,6 @@ void main() {
final Element element = find.byType(RepaintBoundary).first.evaluate().single;
// The following line will send the layer to engine and cause crash if an
// empty opacity layer is sent.
await element.renderObject.layer.toImage(Rect.fromLTRB(0.0, 0.0, 1.0, 1.0));
await element.renderObject.layer.toImage(const Rect.fromLTRB(0.0, 0.0, 1.0, 1.0));
});
}

View file

@ -208,7 +208,7 @@ void main() {
// These would be overlapping if we only took the rectangular bounds of the circle.
final List<Widget> children = <Widget>[
Positioned.fromRect(
rect: Rect.fromLTWH(150, 150, 150, 150),
rect: const Rect.fromLTWH(150, 150, 150, 150),
child: Container(
width: 300,
height: 300,
@ -219,7 +219,7 @@ void main() {
),
),
Positioned.fromRect(
rect: Rect.fromLTWH(20, 20, 140, 150),
rect: const Rect.fromLTWH(20, 20, 140, 150),
child: Container(
width: 300,
height: 300,
@ -246,7 +246,7 @@ void main() {
testWidgets('not non-rect entirely overlapping, wrong painting order', (WidgetTester tester) async {
final List<Widget> children = <Widget>[
Positioned.fromRect(
rect: Rect.fromLTWH(20, 20, 140, 150),
rect: const Rect.fromLTWH(20, 20, 140, 150),
child: Container(
width: 300,
height: 300,
@ -257,7 +257,7 @@ void main() {
),
),
Positioned.fromRect(
rect: Rect.fromLTWH(50, 50, 100, 100),
rect: const Rect.fromLTWH(50, 50, 100, 100),
child: Container(
width: 300,
height: 300,
@ -284,7 +284,7 @@ void main() {
testWidgets('non-rect partially overlapping, wrong painting order', (WidgetTester tester) async {
final List<Widget> children = <Widget>[
Positioned.fromRect(
rect: Rect.fromLTWH(150, 150, 150, 150),
rect: const Rect.fromLTWH(150, 150, 150, 150),
child: Container(
width: 300,
height: 300,
@ -295,7 +295,7 @@ void main() {
),
),
Positioned.fromRect(
rect: Rect.fromLTWH(30, 20, 150, 150),
rect: const Rect.fromLTWH(30, 20, 150, 150),
child: Container(
width: 300,
height: 300,
@ -325,7 +325,7 @@ void main() {
testWidgets('child partially overlapping, wrong painting order', (WidgetTester tester) async {
final List<Widget> children = <Widget>[
Positioned.fromRect(
rect: Rect.fromLTWH(150, 150, 150, 150),
rect: const Rect.fromLTWH(150, 150, 150, 150),
child: Container(
width: 300,
height: 300,
@ -343,7 +343,7 @@ void main() {
),
),
Positioned.fromRect(
rect: Rect.fromLTWH(30, 20, 180, 180),
rect: const Rect.fromLTWH(30, 20, 180, 180),
child: Container(
width: 300,
height: 300,
@ -369,7 +369,7 @@ void main() {
testWidgets('non-rect partially overlapping, wrong painting order, check disabled', (WidgetTester tester) async {
final List<Widget> children = <Widget>[
Positioned.fromRect(
rect: Rect.fromLTWH(150, 150, 150, 150),
rect: const Rect.fromLTWH(150, 150, 150, 150),
child: Container(
width: 300,
height: 300,
@ -380,7 +380,7 @@ void main() {
),
),
Positioned.fromRect(
rect: Rect.fromLTWH(30, 20, 150, 150),
rect: const Rect.fromLTWH(30, 20, 150, 150),
child: Container(
width: 300,
height: 300,
@ -413,7 +413,7 @@ void main() {
final List<Widget> children = <Widget>[
Positioned.fromRect(
rect: Rect.fromLTWH(140, 100, 140, 150),
rect: const Rect.fromLTWH(140, 100, 140, 150),
child: Container(
width: 300,
height: 300,
@ -427,7 +427,7 @@ void main() {
),
),
Positioned.fromRect(
rect: Rect.fromLTWH(50, 50, 100, 100),
rect: const Rect.fromLTWH(50, 50, 100, 100),
child: Container(
width: 300,
height: 300,
@ -454,7 +454,7 @@ void main() {
testWidgets('with a RenderTransform, overlapping', (WidgetTester tester) async {
final List<Widget> children = <Widget>[
Positioned.fromRect(
rect: Rect.fromLTWH(140, 100, 140, 150),
rect: const Rect.fromLTWH(140, 100, 140, 150),
child: Container(
width: 300,
height: 300,
@ -468,7 +468,7 @@ void main() {
),
),
Positioned.fromRect(
rect: Rect.fromLTWH(50, 50, 100, 100),
rect: const Rect.fromLTWH(50, 50, 100, 100),
child: Container(
width: 300,
height: 300,

View file

@ -129,7 +129,7 @@ void main() {
final Layer textureParentLayer = tester.layers[tester.layers.length - 2];
expect(textureParentLayer, isInstanceOf<ClipRectLayer>());
final ClipRectLayer clipRect = textureParentLayer;
expect(clipRect.clipRect, Rect.fromLTWH(0.0, 0.0, 100.0, 50.0));
expect(clipRect.clipRect, const Rect.fromLTWH(0.0, 0.0, 100.0, 50.0));
expect(
viewsController.views,
unorderedEquals(<FakeAndroidPlatformView>[
@ -837,7 +837,7 @@ void main() {
// Platform view has not been created yet, no platformViewId.
expect(semantics.platformViewId, null);
expect(semantics.rect, Rect.fromLTWH(0, 0, 200, 100));
expect(semantics.rect, const Rect.fromLTWH(0, 0, 200, 100));
// A 200x100 rect positioned at bottom right of a 800x600 box.
expect(semantics.transform, Matrix4.translationValues(600, 500, 0));
expect(semantics.childrenCount, 0);
@ -846,7 +846,7 @@ void main() {
await tester.pumpAndSettle();
expect(semantics.platformViewId, currentViewId + 1);
expect(semantics.rect, Rect.fromLTWH(0, 0, 200, 100));
expect(semantics.rect, const Rect.fromLTWH(0, 0, 200, 100));
// A 200x100 rect positioned at bottom right of a 800x600 box.
expect(semantics.transform, Matrix4.translationValues(600, 500, 0));
expect(semantics.childrenCount, 0);
@ -1505,7 +1505,7 @@ void main() {
final SemanticsNode semantics = tester.getSemantics(find.byType(UiKitView));
expect(semantics.platformViewId, currentViewId + 1);
expect(semantics.rect, Rect.fromLTWH(0, 0, 200, 100));
expect(semantics.rect, const Rect.fromLTWH(0, 0, 200, 100));
// A 200x100 rect positioned at bottom right of a 800x600 box.
expect(semantics.transform, Matrix4.translationValues(600, 500, 0));
expect(semantics.childrenCount, 0);

View file

@ -25,7 +25,7 @@ void main() {
expect(a.width, null);
expect(a.height, null);
final Positioned b = Positioned.fromRect(
rect: Rect.fromLTRB(
rect: const Rect.fromLTRB(
102.0,
302.0,
202.0,
@ -59,12 +59,12 @@ void main() {
testWidgets('Can animate position data', (WidgetTester tester) async {
final RelativeRectTween rect = RelativeRectTween(
begin: RelativeRect.fromRect(
Rect.fromLTRB(10.0, 20.0, 20.0, 30.0),
Rect.fromLTRB(0.0, 10.0, 100.0, 110.0),
const Rect.fromLTRB(10.0, 20.0, 20.0, 30.0),
const Rect.fromLTRB(0.0, 10.0, 100.0, 110.0),
),
end: RelativeRect.fromRect(
Rect.fromLTRB(80.0, 90.0, 90.0, 100.0),
Rect.fromLTRB(0.0, 10.0, 100.0, 110.0),
const Rect.fromLTRB(80.0, 90.0, 90.0, 100.0),
const Rect.fromLTRB(0.0, 10.0, 100.0, 110.0),
),
);
final AnimationController controller = AnimationController(

View file

@ -128,9 +128,9 @@ void main() {
),
);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, 0.0, 800.0, 100.0),
Rect.fromLTWH(0.0, 120.0, 780.0, 100.0),
Rect.fromLTWH(0.0, 240.0, 800.0, 100.0),
const Rect.fromLTWH(0.0, 0.0, 800.0, 100.0),
const Rect.fromLTWH(0.0, 120.0, 780.0, 100.0),
const Rect.fromLTWH(0.0, 240.0, 800.0, 100.0),
]);
});
@ -146,9 +146,9 @@ void main() {
),
);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, 0.0, 800.0, 100.0),
Rect.fromLTWH(20.0, 110.0, 760.0, 100.0),
Rect.fromLTWH(0.0, 240.0, 800.0, 100.0),
const Rect.fromLTWH(0.0, 0.0, 800.0, 100.0),
const Rect.fromLTWH(20.0, 110.0, 760.0, 100.0),
const Rect.fromLTWH(0.0, 240.0, 800.0, 100.0),
]);
});
@ -166,9 +166,9 @@ void main() {
),
);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, 0.0, 800.0, 100.0),
Rect.fromLTWH(20.0, 120.0, 760.0, 100.0),
Rect.fromLTWH(0.0, 240.0, 800.0, 100.0),
const Rect.fromLTWH(0.0, 0.0, 800.0, 100.0),
const Rect.fromLTWH(20.0, 120.0, 760.0, 100.0),
const Rect.fromLTWH(0.0, 240.0, 800.0, 100.0),
]);
});
@ -188,9 +188,9 @@ void main() {
),
);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, 0.0, 800.0, 100.0),
Rect.fromLTWH(20.0, 120.0, 760.0, 100.0),
Rect.fromLTWH(0.0, 220.0, 800.0, 100.0),
const Rect.fromLTWH(0.0, 0.0, 800.0, 100.0),
const Rect.fromLTWH(20.0, 120.0, 760.0, 100.0),
const Rect.fromLTWH(0.0, 220.0, 800.0, 100.0),
]);
await tester.pumpWidget(
@ -205,9 +205,9 @@ void main() {
),
);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, 0.0, 800.0, 100.0),
Rect.fromLTWH(100.0, 130.0, 700.0, 100.0),
Rect.fromLTWH(0.0, 230.0, 800.0, 100.0),
const Rect.fromLTWH(0.0, 0.0, 800.0, 100.0),
const Rect.fromLTWH(100.0, 130.0, 700.0, 100.0),
const Rect.fromLTWH(0.0, 230.0, 800.0, 100.0),
]);
});
});

View file

@ -121,13 +121,13 @@ void main() {
TestSemantics(
id: 2,
label: 'child1',
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlag.isSelected.index,
),
TestSemantics(
id: 3,
label: 'child2',
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlag.isSelected.index,
),
],
@ -217,13 +217,13 @@ void main() {
TestSemantics(
id: 4,
label: 'child1',
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlag.isSelected.index,
),
TestSemantics(
id: 3,
label: 'child2',
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlag.isSelected.index,
),
],

View file

@ -57,13 +57,13 @@ void main() {
TestSemantics(
id: 2,
label: 'child1',
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlag.isSelected.index,
),
TestSemantics(
id: 3,
label: 'child2',
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlag.isSelected.index,
),
],
@ -153,13 +153,13 @@ void main() {
TestSemantics(
id: 4,
label: 'child1',
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlag.isSelected.index,
),
TestSemantics(
id: 3,
label: 'child2',
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlag.isSelected.index,
),
],

View file

@ -46,11 +46,11 @@ void main() {
children: <TestSemantics>[
TestSemantics(
label: '1',
rect: Rect.fromLTRB(0.0, 0.0, 75.0, 14.0),
rect: const Rect.fromLTRB(0.0, 0.0, 75.0, 14.0),
),
TestSemantics(
label: '2',
rect: Rect.fromLTRB(0.0, 0.0, 25.0, 14.0), // clipped form original 75.0 to 25.0
rect: const Rect.fromLTRB(0.0, 0.0, 25.0, 14.0), // clipped form original 75.0 to 25.0
),
// node with Text 3 not present.
],
@ -105,11 +105,11 @@ void main() {
children: <TestSemantics>[
TestSemantics(
label: '1',
rect: Rect.fromLTRB(0.0, 0.0, 75.0, 14.0),
rect: const Rect.fromLTRB(0.0, 0.0, 75.0, 14.0),
),
TestSemantics(
label: '2\n3',
rect: Rect.fromLTRB(0.0, 0.0, 25.0, 14.0), // clipped form original 75.0 to 25.0
rect: const Rect.fromLTRB(0.0, 0.0, 25.0, 14.0), // clipped form original 75.0 to 25.0
),
],
),

View file

@ -199,11 +199,11 @@ class TestSemantics {
///
/// See also [new TestSemantics.root], which uses this value to describe the
/// root node.
static final Rect rootRect = Rect.fromLTWH(0.0, 0.0, 2400.0, 1800.0);
static const Rect rootRect = Rect.fromLTWH(0.0, 0.0, 2400.0, 1800.0);
/// The test screen's size in logical pixels, useful for the [rect] of
/// full-screen widgets other than the root node.
static final Rect fullScreen = Rect.fromLTWH(0.0, 0.0, 800.0, 600.0);
static const Rect fullScreen = Rect.fromLTWH(0.0, 0.0, 800.0, 600.0);
/// The transform from this node's coordinate system to its parent's coordinate system.
///

View file

@ -20,11 +20,11 @@ void main() {
expect(semantics, hasSemantics(
TestSemantics(
id: 0,
rect: Rect.fromLTRB(0.0, 0.0, 2400.0, 1800.0),
rect: const Rect.fromLTRB(0.0, 0.0, 2400.0, 1800.0),
children: <TestSemantics>[
TestSemantics(
id: 1,
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
flags: <SemanticsFlag>[SemanticsFlag.isSelected],
),
],
@ -37,7 +37,7 @@ void main() {
expect(semantics, hasSemantics(
TestSemantics(
id: 0,
rect: Rect.fromLTRB(0.0, 0.0, 0.0, 0.0),
rect: const Rect.fromLTRB(0.0, 0.0, 0.0, 0.0),
), ignoreTransform: true,
));

View file

@ -44,6 +44,6 @@ void main() {
await tester.pumpWidget(widget);
// The shader bounds rectangle should reflect the position of the centered SizedBox.
expect(shaderBounds, equals(Rect.fromLTWH(200.0, 100.0, 400.0, 400.0)));
expect(shaderBounds, equals(const Rect.fromLTWH(200.0, 100.0, 400.0, 400.0)));
});
}

View file

@ -27,7 +27,7 @@ void main() {
id: 1,
label: 'Hello!',
textDirection: TextDirection.ltr,
rect: Rect.fromLTRB(0.0, 0.0, 84.0, 14.0),
rect: const Rect.fromLTRB(0.0, 0.0, 84.0, 14.0),
transform: Matrix4.translationValues(358.0, 293.0, 0.0),
),
],
@ -56,18 +56,18 @@ void main() {
children: <TestSemantics>[
TestSemantics.rootChild(
id: 2,
rect: Rect.fromLTWH(0.0, 0.0, 800.0, 600.0),
rect: const Rect.fromLTWH(0.0, 0.0, 800.0, 600.0),
children: <TestSemantics>[
TestSemantics(
id: 3,
rect: Rect.fromLTWH(0.0, 0.0, 800.0, 600.0),
rect: const Rect.fromLTWH(0.0, 0.0, 800.0, 600.0),
flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
children: <TestSemantics>[
TestSemantics(
id: 4,
label: 'Hello!',
textDirection: TextDirection.ltr,
rect: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
rect: const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
transform: Matrix4.translationValues(395.0, 295.0, 0.0),
),
],

View file

@ -383,19 +383,19 @@ void main() {
final RenderObject target = tester.renderObject(find.byWidget(children[5]));
RevealedOffset revealed = viewport.getOffsetToReveal(target, 0.0);
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 0.0, 300.0, 100.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 0.0, 300.0, 100.0));
revealed = viewport.getOffsetToReveal(target, 1.0);
expect(revealed.offset, 400.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 100.0, 300.0, 100.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 100.0, 300.0, 100.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 540.0);
expect(revealed.rect, Rect.fromLTWH(40.0, 0.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(40.0, 0.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 350.0);
expect(revealed.rect, Rect.fromLTWH(40.0, 190.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(40.0, 190.0, 10.0, 10.0));
});
testWidgets('SingleChildScrollView getOffsetToReveal - up', (WidgetTester tester) async {
@ -430,19 +430,19 @@ void main() {
final RenderObject target = tester.renderObject(find.byWidget(children[5]));
RevealedOffset revealed = viewport.getOffsetToReveal(target, 0.0);
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 100.0, 300.0, 100.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 100.0, 300.0, 100.0));
revealed = viewport.getOffsetToReveal(target, 1.0);
expect(revealed.offset, 400.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 0.0, 300.0, 100.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 0.0, 300.0, 100.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 550.0);
expect(revealed.rect, Rect.fromLTWH(40.0, 190.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(40.0, 190.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 360.0);
expect(revealed.rect, Rect.fromLTWH(40.0, 0.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(40.0, 0.0, 10.0, 10.0));
});
testWidgets('SingleChildScrollView getOffsetToReveal - right', (WidgetTester tester) async {
@ -478,19 +478,19 @@ void main() {
final RenderObject target = tester.renderObject(find.byWidget(children[5]));
RevealedOffset revealed = viewport.getOffsetToReveal(target, 0.0);
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 0.0, 100.0, 300.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 0.0, 100.0, 300.0));
revealed = viewport.getOffsetToReveal(target, 1.0);
expect(revealed.offset, 400.0);
expect(revealed.rect, Rect.fromLTWH(100.0, 0.0, 100.0, 300.0));
expect(revealed.rect, const Rect.fromLTWH(100.0, 0.0, 100.0, 300.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 540.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 40.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 350.0);
expect(revealed.rect, Rect.fromLTWH(190.0, 40.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(190.0, 40.0, 10.0, 10.0));
});
testWidgets('SingleChildScrollView getOffsetToReveal - left', (WidgetTester tester) async {
@ -527,19 +527,19 @@ void main() {
final RenderObject target = tester.renderObject(find.byWidget(children[5]));
RevealedOffset revealed = viewport.getOffsetToReveal(target, 0.0);
expect(revealed.offset, 500.0);
expect(revealed.rect, Rect.fromLTWH(100.0, 0.0, 100.0, 300.0));
expect(revealed.rect, const Rect.fromLTWH(100.0, 0.0, 100.0, 300.0));
revealed = viewport.getOffsetToReveal(target, 1.0);
expect(revealed.offset, 400.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 0.0, 100.0, 300.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 0.0, 100.0, 300.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 0.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 550.0);
expect(revealed.rect, Rect.fromLTWH(190.0, 40.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(190.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
revealed = viewport.getOffsetToReveal(target, 1.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 360.0);
expect(revealed.rect, Rect.fromLTWH(0.0, 40.0, 10.0, 10.0));
expect(revealed.rect, const Rect.fromLTWH(0.0, 40.0, 10.0, 10.0));
});
testWidgets('Nested SingleChildScrollView showOnScreen', (WidgetTester tester) async {

View file

@ -164,7 +164,7 @@ void main() {
verifyPaintPosition(key1, const Offset(0.0, 0.0), false);
verifyPaintPosition(key2, const Offset(0.0, 0.0), true);
verifyPaintPosition(key3, const Offset(0.0, 100.0), true);
verifyActualBoxPosition(tester, find.byType(Container), 1, Rect.fromLTWH(0.0, 100.0, 800.0, 200.0));
verifyActualBoxPosition(tester, find.byType(Container), 1, const Rect.fromLTWH(0.0, 100.0, 800.0, 200.0));
verifyPaintPosition(key4, const Offset(0.0, 300.0), true);
verifyPaintPosition(key5, const Offset(0.0, 850.0), false);
position.animateTo(700.0, curve: Curves.linear, duration: const Duration(minutes: 1));
@ -172,7 +172,7 @@ void main() {
verifyPaintPosition(key1, const Offset(0.0, 0.0), false);
verifyPaintPosition(key2, const Offset(0.0, 0.0), true);
verifyPaintPosition(key3, const Offset(0.0, 100.0), true);
verifyActualBoxPosition(tester, find.byType(Container), 1, Rect.fromLTWH(0.0, 100.0, 800.0, 200.0));
verifyActualBoxPosition(tester, find.byType(Container), 1, const Rect.fromLTWH(0.0, 100.0, 800.0, 200.0));
verifyPaintPosition(key4, const Offset(0.0, 250.0), true);
verifyPaintPosition(key5, const Offset(0.0, 800.0), false);
position.animateTo(750.0, curve: Curves.linear, duration: const Duration(minutes: 1));
@ -180,7 +180,7 @@ void main() {
verifyPaintPosition(key1, const Offset(0.0, 0.0), false);
verifyPaintPosition(key2, const Offset(0.0, 0.0), true);
verifyPaintPosition(key3, const Offset(0.0, 100.0), true);
verifyActualBoxPosition(tester, find.byType(Container), 1, Rect.fromLTWH(0.0, 100.0, 800.0, 200.0));
verifyActualBoxPosition(tester, find.byType(Container), 1, const Rect.fromLTWH(0.0, 100.0, 800.0, 200.0));
verifyPaintPosition(key4, const Offset(0.0, 200.0), true);
verifyPaintPosition(key5, const Offset(0.0, 750.0), false);
position.animateTo(800.0, curve: Curves.linear, duration: const Duration(minutes: 1));
@ -209,7 +209,7 @@ void main() {
verifyPaintPosition(key1, const Offset(0.0, 0.0), false);
verifyPaintPosition(key2, const Offset(0.0, 0.0), true);
verifyPaintPosition(key3, const Offset(0.0, 100.0), true);
verifyActualBoxPosition(tester, find.byType(Container), 1, Rect.fromLTWH(0.0, 100.0, 800.0, 100.0));
verifyActualBoxPosition(tester, find.byType(Container), 1, const Rect.fromLTWH(0.0, 100.0, 800.0, 100.0));
verifyPaintPosition(key4, const Offset(0.0, 0.0), true);
verifyPaintPosition(key5, const Offset(0.0, 550.0), true);
});

View file

@ -71,7 +71,7 @@ void main() {
await tester.pumpAndSettle(const Duration(milliseconds: 1000));
final RenderBox box = tester.renderObject<RenderBox>(find.byType(Container));
final Rect rect = Rect.fromPoints(box.localToGlobal(Offset.zero), box.localToGlobal(box.size.bottomRight(Offset.zero)));
expect(rect, equals(Rect.fromLTWH(0.0, -195.0, 800.0, 200.0)));
expect(rect, equals(const Rect.fromLTWH(0.0, -195.0, 800.0, 200.0)));
});
testWidgets('Sliver appbars - scrolling - overscroll gap is below header', (WidgetTester tester) async {

View file

@ -43,37 +43,37 @@ void main() {
await test(tester, 0.0, padding, AxisDirection.down, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
Rect.fromLTWH(0.0, 0.0, 800.0, 400.0),
Rect.fromLTWH(25.0, 420.0, 760.0, 400.0),
Rect.fromLTWH(0.0, 855.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, 0.0, 800.0, 400.0),
const Rect.fromLTWH(25.0, 420.0, 760.0, 400.0),
const Rect.fromLTWH(0.0, 855.0, 800.0, 400.0),
]);
await test(tester, 200.0, padding, AxisDirection.down, TextDirection.ltr);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, -200.0, 800.0, 400.0),
Rect.fromLTWH(25.0, 220.0, 760.0, 400.0),
Rect.fromLTWH(0.0, 655.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, -200.0, 800.0, 400.0),
const Rect.fromLTWH(25.0, 220.0, 760.0, 400.0),
const Rect.fromLTWH(0.0, 655.0, 800.0, 400.0),
]);
await test(tester, 390.0, padding, AxisDirection.down, TextDirection.ltr);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, -390.0, 800.0, 400.0),
Rect.fromLTWH(25.0, 30.0, 760.0, 400.0),
Rect.fromLTWH(0.0, 465.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, -390.0, 800.0, 400.0),
const Rect.fromLTWH(25.0, 30.0, 760.0, 400.0),
const Rect.fromLTWH(0.0, 465.0, 800.0, 400.0),
]);
await test(tester, 490.0, padding, AxisDirection.down, TextDirection.ltr);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, -490.0, 800.0, 400.0),
Rect.fromLTWH(25.0, -70.0, 760.0, 400.0),
Rect.fromLTWH(0.0, 365.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, -490.0, 800.0, 400.0),
const Rect.fromLTWH(25.0, -70.0, 760.0, 400.0),
const Rect.fromLTWH(0.0, 365.0, 800.0, 400.0),
]);
await test(tester, 10000.0, padding, AxisDirection.down, TextDirection.ltr);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, -10000.0, 800.0, 400.0),
Rect.fromLTWH(25.0, -9580.0, 760.0, 400.0),
Rect.fromLTWH(0.0, -9145.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, -10000.0, 800.0, 400.0),
const Rect.fromLTWH(25.0, -9580.0, 760.0, 400.0),
const Rect.fromLTWH(0.0, -9145.0, 800.0, 400.0),
]);
});
@ -82,37 +82,37 @@ void main() {
await test(tester, 0.0, padding, AxisDirection.down, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
Rect.fromLTWH(0.0, 0.0, 800.0, 400.0),
Rect.fromLTWH(25.0, 420.0, 760.0, 400.0),
Rect.fromLTWH(0.0, 855.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, 0.0, 800.0, 400.0),
const Rect.fromLTWH(25.0, 420.0, 760.0, 400.0),
const Rect.fromLTWH(0.0, 855.0, 800.0, 400.0),
]);
await test(tester, 200.0, padding, AxisDirection.down, TextDirection.ltr);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, -200.0, 800.0, 400.0),
Rect.fromLTWH(25.0, 220.0, 760.0, 400.0),
Rect.fromLTWH(0.0, 655.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, -200.0, 800.0, 400.0),
const Rect.fromLTWH(25.0, 220.0, 760.0, 400.0),
const Rect.fromLTWH(0.0, 655.0, 800.0, 400.0),
]);
await test(tester, 390.0, padding, AxisDirection.down, TextDirection.ltr);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, -390.0, 800.0, 400.0),
Rect.fromLTWH(25.0, 30.0, 760.0, 400.0),
Rect.fromLTWH(0.0, 465.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, -390.0, 800.0, 400.0),
const Rect.fromLTWH(25.0, 30.0, 760.0, 400.0),
const Rect.fromLTWH(0.0, 465.0, 800.0, 400.0),
]);
await test(tester, 490.0, padding, AxisDirection.down, TextDirection.ltr);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, -490.0, 800.0, 400.0),
Rect.fromLTWH(25.0, -70.0, 760.0, 400.0),
Rect.fromLTWH(0.0, 365.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, -490.0, 800.0, 400.0),
const Rect.fromLTWH(25.0, -70.0, 760.0, 400.0),
const Rect.fromLTWH(0.0, 365.0, 800.0, 400.0),
]);
await test(tester, 10000.0, padding, AxisDirection.down, TextDirection.ltr);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, -10000.0, 800.0, 400.0),
Rect.fromLTWH(25.0, -9580.0, 760.0, 400.0),
Rect.fromLTWH(0.0, -9145.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, -10000.0, 800.0, 400.0),
const Rect.fromLTWH(25.0, -9580.0, 760.0, 400.0),
const Rect.fromLTWH(0.0, -9145.0, 800.0, 400.0),
]);
});
@ -121,37 +121,37 @@ void main() {
await test(tester, 0.0, padding, AxisDirection.down, TextDirection.rtl);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
Rect.fromLTWH(0.0, 0.0, 800.0, 400.0),
Rect.fromLTWH(15.0, 420.0, 760.0, 400.0),
Rect.fromLTWH(0.0, 855.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, 0.0, 800.0, 400.0),
const Rect.fromLTWH(15.0, 420.0, 760.0, 400.0),
const Rect.fromLTWH(0.0, 855.0, 800.0, 400.0),
]);
await test(tester, 200.0, padding, AxisDirection.down, TextDirection.rtl);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, -200.0, 800.0, 400.0),
Rect.fromLTWH(15.0, 220.0, 760.0, 400.0),
Rect.fromLTWH(0.0, 655.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, -200.0, 800.0, 400.0),
const Rect.fromLTWH(15.0, 220.0, 760.0, 400.0),
const Rect.fromLTWH(0.0, 655.0, 800.0, 400.0),
]);
await test(tester, 390.0, padding, AxisDirection.down, TextDirection.rtl);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, -390.0, 800.0, 400.0),
Rect.fromLTWH(15.0, 30.0, 760.0, 400.0),
Rect.fromLTWH(0.0, 465.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, -390.0, 800.0, 400.0),
const Rect.fromLTWH(15.0, 30.0, 760.0, 400.0),
const Rect.fromLTWH(0.0, 465.0, 800.0, 400.0),
]);
await test(tester, 490.0, padding, AxisDirection.down, TextDirection.rtl);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, -490.0, 800.0, 400.0),
Rect.fromLTWH(15.0, -70.0, 760.0, 400.0),
Rect.fromLTWH(0.0, 365.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, -490.0, 800.0, 400.0),
const Rect.fromLTWH(15.0, -70.0, 760.0, 400.0),
const Rect.fromLTWH(0.0, 365.0, 800.0, 400.0),
]);
await test(tester, 10000.0, padding, AxisDirection.down, TextDirection.rtl);
verify(tester, <Rect>[
Rect.fromLTWH(0.0, -10000.0, 800.0, 400.0),
Rect.fromLTWH(15.0, -9580.0, 760.0, 400.0),
Rect.fromLTWH(0.0, -9145.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, -10000.0, 800.0, 400.0),
const Rect.fromLTWH(15.0, -9580.0, 760.0, 400.0),
const Rect.fromLTWH(0.0, -9145.0, 800.0, 400.0),
]);
});
@ -160,9 +160,9 @@ void main() {
await test(tester, 350.0, padding, AxisDirection.down, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
Rect.fromLTWH(0.0, -350.0, 800.0, 400.0),
Rect.fromLTWH(30.0, 80.0, 740.0, 400.0),
Rect.fromLTWH(0.0, 510.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, -350.0, 800.0, 400.0),
const Rect.fromLTWH(30.0, 80.0, 740.0, 400.0),
const Rect.fromLTWH(0.0, 510.0, 800.0, 400.0),
]);
HitTestResult result;
result = tester.hitTestOnBinding(const Offset(10.0, 10.0));
@ -182,9 +182,9 @@ void main() {
await test(tester, 350.0, padding, AxisDirection.up, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
Rect.fromLTWH(0.0, 600.0+350.0-400.0, 800.0, 400.0),
Rect.fromLTWH(30.0, 600.0-80.0-400.0, 740.0, 400.0),
Rect.fromLTWH(0.0, 600.0-510.0-400.0, 800.0, 400.0),
const Rect.fromLTWH(0.0, 600.0+350.0-400.0, 800.0, 400.0),
const Rect.fromLTWH(30.0, 600.0-80.0-400.0, 740.0, 400.0),
const Rect.fromLTWH(0.0, 600.0-510.0-400.0, 800.0, 400.0),
]);
HitTestResult result;
result = tester.hitTestOnBinding(const Offset(10.0, 600.0-10.0));
@ -204,9 +204,9 @@ void main() {
await test(tester, 350.0, padding, AxisDirection.left, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
Rect.fromLTWH(800.0+350.0-400.0, 0.0, 400.0, 600.0),
Rect.fromLTWH(800.0-80.0-400.0, 30.0, 400.0, 540.0),
Rect.fromLTWH(800.0-510.0-400.0, 0.0, 400.0, 600.0),
const Rect.fromLTWH(800.0+350.0-400.0, 0.0, 400.0, 600.0),
const Rect.fromLTWH(800.0-80.0-400.0, 30.0, 400.0, 540.0),
const Rect.fromLTWH(800.0-510.0-400.0, 0.0, 400.0, 600.0),
]);
HitTestResult result;
result = tester.hitTestOnBinding(const Offset(800.0-10.0, 10.0));
@ -226,9 +226,9 @@ void main() {
await test(tester, 350.0, padding, AxisDirection.right, TextDirection.ltr);
expect(tester.renderObject<RenderBox>(find.byType(Viewport)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Rect>[
Rect.fromLTWH(-350.0, 0.0, 400.0, 600.0),
Rect.fromLTWH(80.0, 30.0, 400.0, 540.0),
Rect.fromLTWH(510.0, 0.0, 400.0, 600.0),
const Rect.fromLTWH(-350.0, 0.0, 400.0, 600.0),
const Rect.fromLTWH(80.0, 30.0, 400.0, 540.0),
const Rect.fromLTWH(510.0, 0.0, 400.0, 600.0),
]);
HitTestResult result;
result = tester.hitTestOnBinding(const Offset(10.0, 10.0));
@ -397,7 +397,7 @@ void main() {
expect(
tester.getRect(find.widgetWithText(Container, '2')),
Rect.fromLTRB(0.0, 100.0, 800.0, 300.0),
const Rect.fromLTRB(0.0, 100.0, 800.0, 300.0),
);
// Now item 0 is 400.0px and going back will underflow.
@ -420,7 +420,7 @@ void main() {
expect(
tester.getRect(find.widgetWithText(Container, '0')),
Rect.fromLTRB(0.0, -200.0, 800.0, 200.0),
const Rect.fromLTRB(0.0, -200.0, 800.0, 200.0),
);
});
}

View file

@ -68,6 +68,6 @@ void main() {
final Rect flexRect = tester.getRect(find.byType(Column));
expect(spacerRect.size, const Size(0.0, 580.0));
expect(spacerRect.topLeft, const Offset(400.0, 10.0));
expect(flexRect, Rect.fromLTWH(390.0, 0.0, 20.0, 600.0));
expect(flexRect, const Rect.fromLTWH(390.0, 0.0, 20.0, 600.0));
});
}

View file

@ -650,15 +650,15 @@ void main() {
),
),
);
expect(tester.getRect(find.byType(SizedBox).at(0)), Rect.fromLTWH(350.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(1)), Rect.fromLTWH(0.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(2)), Rect.fromLTWH(700.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(3)), Rect.fromLTWH(350.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(4)), Rect.fromLTWH(350.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(5)), Rect.fromLTWH(700.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(6)), Rect.fromLTWH(0.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(7)), Rect.fromLTWH(350.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(8)), Rect.fromLTWH(350.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(0)), const Rect.fromLTWH(350.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(1)), const Rect.fromLTWH(0.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(2)), const Rect.fromLTWH(700.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(3)), const Rect.fromLTWH(350.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(4)), const Rect.fromLTWH(350.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(5)), const Rect.fromLTWH(700.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(6)), const Rect.fromLTWH(0.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(7)), const Rect.fromLTWH(350.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(8)), const Rect.fromLTWH(350.0, 500.0, 100.0, 100.0));
await tester.pumpWidget(
Directionality(
@ -679,15 +679,15 @@ void main() {
),
),
);
expect(tester.getRect(find.byType(SizedBox).at(0)), Rect.fromLTWH(350.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(1)), Rect.fromLTWH(0.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(2)), Rect.fromLTWH(700.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(3)), Rect.fromLTWH(350.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(4)), Rect.fromLTWH(350.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(5)), Rect.fromLTWH(0.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(6)), Rect.fromLTWH(700.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(7)), Rect.fromLTWH(350.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(8)), Rect.fromLTWH(350.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(0)), const Rect.fromLTWH(350.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(1)), const Rect.fromLTWH(0.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(2)), const Rect.fromLTWH(700.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(3)), const Rect.fromLTWH(350.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(4)), const Rect.fromLTWH(350.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(5)), const Rect.fromLTWH(0.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(6)), const Rect.fromLTWH(700.0, 250.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(7)), const Rect.fromLTWH(350.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(8)), const Rect.fromLTWH(350.0, 500.0, 100.0, 100.0));
await tester.pumpWidget(
Directionality(
@ -708,15 +708,15 @@ void main() {
),
),
);
expect(tester.getRect(find.byType(SizedBox).at(0)), Rect.fromLTWH(700.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(1)), Rect.fromLTWH(0.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(2)), Rect.fromLTWH(700.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(3)), Rect.fromLTWH(700.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(4)), Rect.fromLTWH(700.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(5)), Rect.fromLTWH(0.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(6)), Rect.fromLTWH(700.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(7)), Rect.fromLTWH(700.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(8)), Rect.fromLTWH(700.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(0)), const Rect.fromLTWH(700.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(1)), const Rect.fromLTWH(0.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(2)), const Rect.fromLTWH(700.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(3)), const Rect.fromLTWH(700.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(4)), const Rect.fromLTWH(700.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(5)), const Rect.fromLTWH(0.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(6)), const Rect.fromLTWH(700.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(7)), const Rect.fromLTWH(700.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(8)), const Rect.fromLTWH(700.0, 500.0, 100.0, 100.0));
await tester.pumpWidget(
Directionality(
@ -737,14 +737,14 @@ void main() {
),
),
);
expect(tester.getRect(find.byType(SizedBox).at(0)), Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(1)), Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(2)), Rect.fromLTWH(700.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(3)), Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(4)), Rect.fromLTWH(0.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(5)), Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(6)), Rect.fromLTWH(700.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(7)), Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(8)), Rect.fromLTWH(0.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(0)), const Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(1)), const Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(2)), const Rect.fromLTWH(700.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(3)), const Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(4)), const Rect.fromLTWH(0.0, 500.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(5)), const Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(6)), const Rect.fromLTWH(700.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(7)), const Rect.fromLTWH(0.0, 0.0, 100.0, 100.0));
expect(tester.getRect(find.byType(SizedBox).at(8)), const Rect.fromLTWH(0.0, 500.0, 100.0, 100.0));
});
}

View file

@ -66,7 +66,7 @@ void main() {
const Color blue = Color(0xFF0000FF);
final Shader linearGradient = const LinearGradient(
colors: <Color>[red, blue],
).createShader(Rect.fromLTWH(0.0, 0.0, 50.0, 20.0));
).createShader(const Rect.fromLTWH(0.0, 0.0, 50.0, 20.0));
await tester.pumpWidget(
Align(

View file

@ -252,15 +252,15 @@ void main() {
final TestSemantics expectedSemantics = TestSemantics.root(
children: <TestSemantics>[
TestSemantics.rootChild(
rect: Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
children: <TestSemantics>[
TestSemantics(
rect: Rect.fromLTRB(-4.0, -4.0, 480.0, 18.0),
rect: const Rect.fromLTRB(-4.0, -4.0, 480.0, 18.0),
label: 'hello world ',
textDirection: TextDirection.ltr, // text direction is declared as LTR.
),
TestSemantics(
rect: Rect.fromLTRB(150.0, -4.0, 200.0, 18.0),
rect: const Rect.fromLTRB(150.0, -4.0, 200.0, 18.0),
label: 'RIS',
textDirection: TextDirection.rtl, // in the last string we switched to RTL using RLE.
actions: <SemanticsAction>[
@ -268,12 +268,12 @@ void main() {
],
),
TestSemantics(
rect: Rect.fromLTRB(192.0, -4.0, 424.0, 18.0),
rect: const Rect.fromLTRB(192.0, -4.0, 424.0, 18.0),
label: ' OD you OD WOH ', // Still RTL.
textDirection: TextDirection.rtl,
),
TestSemantics(
rect: Rect.fromLTRB(416.0, -4.0, 466.0, 18.0),
rect: const Rect.fromLTRB(416.0, -4.0, 466.0, 18.0),
label: 'YOB',
textDirection: TextDirection.rtl, // Still RTL.
actions: <SemanticsAction>[
@ -281,7 +281,7 @@ void main() {
],
),
TestSemantics(
rect: Rect.fromLTRB(472.0, -4.0, 606.0, 18.0),
rect: const Rect.fromLTRB(472.0, -4.0, 606.0, 18.0),
label: ' good bye',
textDirection: TextDirection.rtl, // Begin as RTL but pop to LTR.
),
@ -311,7 +311,7 @@ void main() {
text: 'a long long long long text, should be clip',
);
expect(find.byType(Text), paints..clipRect(rect: Rect.fromLTWH(0, 0, 50, 50)));
expect(find.byType(Text), paints..clipRect(rect: const Rect.fromLTWH(0, 0, 50, 50)));
});
testWidgets('Overflow is clipping correctly - short text with overflow: ellipsis', (WidgetTester tester) async {
@ -331,7 +331,7 @@ void main() {
text: 'a long long long long text, should be clip',
);
expect(find.byType(Text), paints..clipRect(rect: Rect.fromLTWH(0, 0, 50, 50)));
expect(find.byType(Text), paints..clipRect(rect: const Rect.fromLTWH(0, 0, 50, 50)));
});
testWidgets('Overflow is clipping correctly - short text with overflow: fade', (WidgetTester tester) async {

View file

@ -46,4 +46,4 @@ void loadDateIntlDataIfNotLoaded() {
});
_dateIntlDataInitialized = true;
}
}
}

View file

@ -187,18 +187,18 @@ void main() {
test('rectMoreOrLessEquals', () {
expect(
Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
rectMoreOrLessEquals(Rect.fromLTRB(0.0, 0.0, 10.0, 10.00000000001)),
const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
rectMoreOrLessEquals(const Rect.fromLTRB(0.0, 0.0, 10.0, 10.00000000001)),
);
expect(
Rect.fromLTRB(11.0, 11.0, 20.0, 20.0),
isNot(rectMoreOrLessEquals(Rect.fromLTRB(-11.0, -11.0, 20.0, 20.0), epsilon: 1.0)),
const Rect.fromLTRB(11.0, 11.0, 20.0, 20.0),
isNot(rectMoreOrLessEquals(const Rect.fromLTRB(-11.0, -11.0, 20.0, 20.0), epsilon: 1.0)),
);
expect(
Rect.fromLTRB(11.0, 11.0, 20.0, 20.0),
rectMoreOrLessEquals(Rect.fromLTRB(-11.0, -11.0, 20.0, 20.0), epsilon: 100.0),
const Rect.fromLTRB(11.0, 11.0, 20.0, 20.0),
rectMoreOrLessEquals(const Rect.fromLTRB(-11.0, -11.0, 20.0, 20.0), epsilon: 100.0),
);
});
@ -219,8 +219,8 @@ void main() {
expect(const Offset(1.0, 0.0), within(distance: 1.0, from: const Offset(0.0, 0.0)));
expect(const Offset(1.0, 0.0), isNot(within(distance: 1.0, from: const Offset(-1.0, 0.0))));
expect(Rect.fromLTRB(0.0, 1.0, 2.0, 3.0), within<Rect>(distance: 4.0, from: Rect.fromLTRB(1.0, 3.0, 5.0, 7.0)));
expect(Rect.fromLTRB(0.0, 1.0, 2.0, 3.0), isNot(within<Rect>(distance: 3.9, from: Rect.fromLTRB(1.0, 3.0, 5.0, 7.0))));
expect(const Rect.fromLTRB(0.0, 1.0, 2.0, 3.0), within<Rect>(distance: 4.0, from: const Rect.fromLTRB(1.0, 3.0, 5.0, 7.0)));
expect(const Rect.fromLTRB(0.0, 1.0, 2.0, 3.0), isNot(within<Rect>(distance: 3.9, from: const Rect.fromLTRB(1.0, 3.0, 5.0, 7.0))));
expect(const Size(1.0, 1.0), within<Size>(distance: 1.415, from: const Size(2.0, 2.0)));
expect(const Size(1.0, 1.0), isNot(within<Size>(distance: 1.414, from: const Size(2.0, 2.0))));
@ -242,39 +242,39 @@ void main() {
Path(),
coversSameAreaAs(
Path(),
areaToCompare: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
areaToCompare: const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
),
);
});
test('mismatch', () {
final Path rectPath = Path()
..addRect(Rect.fromLTRB(5.0, 5.0, 6.0, 6.0));
..addRect(const Rect.fromLTRB(5.0, 5.0, 6.0, 6.0));
expect(
Path(),
isNot(coversSameAreaAs(
rectPath,
areaToCompare: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
areaToCompare: const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
)),
);
});
test('mismatch out of examined area', () {
final Path rectPath = Path()
..addRect(Rect.fromLTRB(5.0, 5.0, 6.0, 6.0));
rectPath.addRect(Rect.fromLTRB(5.0, 5.0, 6.0, 6.0));
..addRect(const Rect.fromLTRB(5.0, 5.0, 6.0, 6.0));
rectPath.addRect(const Rect.fromLTRB(5.0, 5.0, 6.0, 6.0));
expect(
Path(),
coversSameAreaAs(
rectPath,
areaToCompare: Rect.fromLTRB(0.0, 0.0, 4.0, 4.0),
areaToCompare: const Rect.fromLTRB(0.0, 0.0, 4.0, 4.0),
),
);
});
test('differently constructed rects match', () {
final Path rectPath = Path()
..addRect(Rect.fromLTRB(5.0, 5.0, 6.0, 6.0));
..addRect(const Rect.fromLTRB(5.0, 5.0, 6.0, 6.0));
final Path linePath = Path()
..moveTo(5.0, 5.0)
..lineTo(5.0, 6.0)
@ -285,14 +285,14 @@ void main() {
linePath,
coversSameAreaAs(
rectPath,
areaToCompare: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
areaToCompare: const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
),
);
});
test('partially overlapping paths', () {
final Path rectPath = Path()
..addRect(Rect.fromLTRB(5.0, 5.0, 6.0, 6.0));
..addRect(const Rect.fromLTRB(5.0, 5.0, 6.0, 6.0));
final Path linePath = Path()
..moveTo(5.0, 5.0)
..lineTo(5.0, 6.0)
@ -303,7 +303,7 @@ void main() {
linePath,
isNot(coversSameAreaAs(
rectPath,
areaToCompare: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
areaToCompare: const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
)),
);
});
@ -510,7 +510,7 @@ void main() {
decreasedValue: 'd',
hint: 'e',
textDirection: TextDirection.ltr,
rect: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
rect: const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
elevation: 3.0,
thickness: 4.0,
textSelection: null,
@ -526,7 +526,7 @@ void main() {
node.data = data;
expect(node, matchesSemantics(
rect: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
rect: const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
size: const Size(10.0, 10.0),
elevation: 3.0,
thickness: 4.0,

View file

@ -17,4 +17,4 @@ String makefileExecutableName(LinuxProject project) {
}
}
return null;
}
}

View file

@ -113,4 +113,4 @@ class MockPlatform extends Mock implements Platform {
Map<String, String> environment = <String, String>{
'FLUTTER_ROOT': '/',
};
}
}

View file

@ -102,4 +102,4 @@ class MockPlatform extends Mock implements Platform {
Map<String, String> environment = <String, String>{
'FLUTTER_ROOT': '/',
};
}
}

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