diff --git a/packages/flutter/lib/src/rendering/proxy_box.dart b/packages/flutter/lib/src/rendering/proxy_box.dart index 3f9b68dd7a..93dbcb86a0 100644 --- a/packages/flutter/lib/src/rendering/proxy_box.dart +++ b/packages/flutter/lib/src/rendering/proxy_box.dart @@ -53,8 +53,10 @@ class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin on RenderBox, RenderObjectWithChildMixin { @override @@ -1095,7 +1097,7 @@ mixin RenderAnimatedOpacityMixin on RenderObjectWithChil /// /// This is a variant of [RenderOpacity] that uses an [Animation] rather /// than a [double] to control the opacity. -class RenderAnimatedOpacity extends RenderProxyBox with RenderProxyBoxMixin, RenderAnimatedOpacityMixin { +class RenderAnimatedOpacity extends RenderProxyBox with RenderAnimatedOpacityMixin { /// Creates a partially transparent render object. /// /// The [opacity] argument must not be null. diff --git a/packages/flutter/test/rendering/proxy_box_test.dart b/packages/flutter/test/rendering/proxy_box_test.dart index b397a7eeb6..2a2ec4e3d0 100644 --- a/packages/flutter/test/rendering/proxy_box_test.dart +++ b/packages/flutter/test/rendering/proxy_box_test.dart @@ -963,6 +963,17 @@ void main() { expect(debugPaintClipOval(Clip.none), paintsExactlyCountTimes(#drawPath, 0)); expect(debugPaintClipOval(Clip.none), paintsExactlyCountTimes(#drawParagraph, 0)); }); + + test('RenderProxyBox behavior can be mixed in along with another base class', () { + final RenderFancyProxyBox fancyProxyBox = RenderFancyProxyBox(fancy: 6); + // Box has behavior from its base class: + expect(fancyProxyBox.fancyMethod(), 36); + // Box has behavior from RenderProxyBox: + expect( + fancyProxyBox.computeDryLayout(const BoxConstraints(minHeight: 8)), + const Size(0, 8), + ); + }); } class _TestRectClipper extends CustomClipper { @@ -1061,6 +1072,21 @@ class ConditionalRepaintBoundary extends RenderProxyBox { class TestOffsetLayerA extends OffsetLayer {} +class RenderFancyBox extends RenderBox { + RenderFancyBox({required this.fancy}) : super(); + + late int fancy; + + int fancyMethod() { + return fancy * fancy; + } +} + +class RenderFancyProxyBox extends RenderFancyBox + with RenderObjectWithChildMixin, RenderProxyBoxMixin { + RenderFancyProxyBox({required super.fancy}); +} + void expectAssertionError() { final FlutterErrorDetails errorDetails = TestRenderingFlutterBinding.instance.takeFlutterErrorDetails()!; final bool asserted = errorDetails.toString().contains('Failed assertion');