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 {
///
/// See also:
///
/// * [RenderConstraintsTransformBox], [RenderUnconstrainedBox] and
/// [RenderFlex], for examples of classes that use this indicator mixin.
/// * [RenderUnconstrainedBox] and [RenderFlex] for examples of classes that use this indicator mixin.
mixin DebugOverflowIndicatorMixin on RenderObject {
static const Color _black = Color(0xBF000000);
static const Color _yellow = Color(0xBFFFFF00);
......
This diff is collapsed.
......@@ -378,48 +378,6 @@ void main() {
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', () {
final RenderUnconstrainedBox unconstrained = RenderUnconstrainedBox(
textDirection: TextDirection.ltr,
......
......@@ -36,7 +36,7 @@ void main() {
final dynamic exception = tester.takeException();
expect(exception, isFlutterError);
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());
await tester.pumpWidget(
......
......@@ -323,7 +323,6 @@ void main() {
const UnconstrainedBox(constrainedAxis: Axis.vertical,).toString(),
equals('UnconstrainedBox(alignment: Alignment.center, constrainedAxis: vertical)'),
);
expect(
const UnconstrainedBox(constrainedAxis: Axis.horizontal, textDirection: TextDirection.rtl, alignment: Alignment.topRight).toString(),
equals('UnconstrainedBox(alignment: Alignment.topRight, constrainedAxis: horizontal, textDirection: rtl)'),
......@@ -332,32 +331,13 @@ void main() {
testWidgets('UnconstrainedBox can set and update clipBehavior', (WidgetTester tester) async {
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));
await tester.pumpWidget(const UnconstrainedBox(clipBehavior: 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', () {
late _MockCanvas mockCanvas;
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