Unverified Commit c0bcb4fc authored by Mouad Debbar's avatar Mouad Debbar Committed by GitHub

Revert "ConstraintsTransformBox (#77994)" (#78661)

This reverts commit 8c44abc0.
parent 8c44abc0
...@@ -85,8 +85,7 @@ class _OverflowRegionData { ...@@ -85,8 +85,7 @@ class _OverflowRegionData {
/// ///
/// See also: /// See also:
/// ///
/// * [RenderConstraintsTransformBox], [RenderUnconstrainedBox] and /// * [RenderUnconstrainedBox] and [RenderFlex] for examples of classes that use this indicator mixin.
/// [RenderFlex], for examples of classes that use this indicator mixin.
mixin DebugOverflowIndicatorMixin on RenderObject { mixin DebugOverflowIndicatorMixin on RenderObject {
static const Color _black = Color(0xBF000000); static const Color _black = Color(0xBF000000);
static const Color _yellow = Color(0xBFFFFF00); static const Color _yellow = Color(0xBFFFFF00);
......
This diff is collapsed.
...@@ -378,48 +378,6 @@ void main() { ...@@ -378,48 +378,6 @@ void main() {
expect(unconstrained.getMaxIntrinsicWidth(100.0), equals(200.0)); expect(unconstrained.getMaxIntrinsicWidth(100.0), equals(200.0));
}); });
group('ConstraintsTransfromBox', () {
FlutterErrorDetails? firstErrorDetails;
void exhaustErrors() {
FlutterErrorDetails? next;
do {
next = renderer.takeFlutterErrorDetails();
firstErrorDetails ??= next;
} while (next != null);
}
tearDown(() {
firstErrorDetails = null;
});
test('throws if the resulting constraints are not normalized', () {
final RenderConstrainedBox child = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(height: 0));
final RenderConstraintsTransformBox box = RenderConstraintsTransformBox(
alignment: Alignment.center,
textDirection: TextDirection.ltr,
constraintsTransform: (BoxConstraints constraints) => const BoxConstraints(maxHeight: -1, minHeight: 200),
child: child,
);
layout(box, constraints: const BoxConstraints(), onErrors: exhaustErrors);
expect(firstErrorDetails?.toString(), contains('is not normalized'));
});
test('overflow is reported when insufficient size is given', () {
final RenderConstrainedBox child = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: double.maxFinite));
final RenderConstraintsTransformBox box = RenderConstraintsTransformBox(
alignment: Alignment.center,
textDirection: TextDirection.ltr,
constraintsTransform: (BoxConstraints constraints) => constraints.copyWith(maxWidth: double.infinity),
child: child,
);
// No error reported.
layout(box, constraints: const BoxConstraints(), phase: EnginePhase.composite, onErrors: expectOverflowedErrors);
});
});
test ('getMinIntrinsicWidth error handling', () { test ('getMinIntrinsicWidth error handling', () {
final RenderUnconstrainedBox unconstrained = RenderUnconstrainedBox( final RenderUnconstrainedBox unconstrained = RenderUnconstrainedBox(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
......
...@@ -36,7 +36,7 @@ void main() { ...@@ -36,7 +36,7 @@ void main() {
final dynamic exception = tester.takeException(); final dynamic exception = tester.takeException();
expect(exception, isFlutterError); expect(exception, isFlutterError);
expect(exception.diagnostics.first.level, DiagnosticLevel.summary); expect(exception.diagnostics.first.level, DiagnosticLevel.summary);
expect(exception.diagnostics.first.toString(), startsWith('A RenderConstraintsTransformBox overflowed by ')); expect(exception.diagnostics.first.toString(), startsWith('A RenderUnconstrainedBox overflowed by '));
expect(find.byType(UnconstrainedBox), paints..rect()); expect(find.byType(UnconstrainedBox), paints..rect());
await tester.pumpWidget( await tester.pumpWidget(
......
...@@ -323,7 +323,6 @@ void main() { ...@@ -323,7 +323,6 @@ void main() {
const UnconstrainedBox(constrainedAxis: Axis.vertical,).toString(), const UnconstrainedBox(constrainedAxis: Axis.vertical,).toString(),
equals('UnconstrainedBox(alignment: Alignment.center, constrainedAxis: vertical)'), equals('UnconstrainedBox(alignment: Alignment.center, constrainedAxis: vertical)'),
); );
expect( expect(
const UnconstrainedBox(constrainedAxis: Axis.horizontal, textDirection: TextDirection.rtl, alignment: Alignment.topRight).toString(), const UnconstrainedBox(constrainedAxis: Axis.horizontal, textDirection: TextDirection.rtl, alignment: Alignment.topRight).toString(),
equals('UnconstrainedBox(alignment: Alignment.topRight, constrainedAxis: horizontal, textDirection: rtl)'), equals('UnconstrainedBox(alignment: Alignment.topRight, constrainedAxis: horizontal, textDirection: rtl)'),
...@@ -332,32 +331,13 @@ void main() { ...@@ -332,32 +331,13 @@ void main() {
testWidgets('UnconstrainedBox can set and update clipBehavior', (WidgetTester tester) async { testWidgets('UnconstrainedBox can set and update clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(const UnconstrainedBox()); await tester.pumpWidget(const UnconstrainedBox());
final RenderConstraintsTransformBox renderObject = tester.allRenderObjects.whereType<RenderConstraintsTransformBox>().first; final RenderUnconstrainedBox renderObject = tester.allRenderObjects.whereType<RenderUnconstrainedBox>().first;
expect(renderObject.clipBehavior, equals(Clip.none)); expect(renderObject.clipBehavior, equals(Clip.none));
await tester.pumpWidget(const UnconstrainedBox(clipBehavior: Clip.antiAlias)); await tester.pumpWidget(const UnconstrainedBox(clipBehavior: Clip.antiAlias));
expect(renderObject.clipBehavior, equals(Clip.antiAlias)); expect(renderObject.clipBehavior, equals(Clip.antiAlias));
}); });
group('ConstraintsTransformBox', () {
test('toString', () {
expect(
const ConstraintsTransformBox(
constraintsTransform: ConstraintsTransformBox.unconstrained,
).toString(),
equals('ConstraintsTransformBox(alignment: Alignment.center, constraints transform: unconstrained)'),
);
expect(
const ConstraintsTransformBox(
textDirection: TextDirection.rtl,
alignment: Alignment.topRight,
constraintsTransform: ConstraintsTransformBox.widthUnconstrained,
).toString(),
equals('ConstraintsTransformBox(alignment: Alignment.topRight, textDirection: rtl, constraints transform: width constraints removed)'),
);
});
});
group('ColoredBox', () { group('ColoredBox', () {
late _MockCanvas mockCanvas; late _MockCanvas mockCanvas;
late _MockPaintingContext mockContext; late _MockPaintingContext mockContext;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment