diff --git a/packages/flutter/lib/src/rendering/box.dart b/packages/flutter/lib/src/rendering/box.dart index 077e34ee6b..4a26e5d79e 100644 --- a/packages/flutter/lib/src/rendering/box.dart +++ b/packages/flutter/lib/src/rendering/box.dart @@ -7,6 +7,7 @@ import 'dart:ui' as ui show lerpDouble; import 'package:flutter/animation.dart'; import 'package:flutter/gestures.dart'; +import 'package:meta/meta.dart'; import 'package:vector_math/vector_math_64.dart'; import 'debug.dart'; @@ -815,6 +816,7 @@ abstract class RenderBox extends RenderObject { /// /// Subclasses should override this function to supply the distances to their /// baselines. + @protected double computeDistanceToActualBaseline(TextBaseline baseline) { assert(_debugDoingBaseline); return null; @@ -1035,6 +1037,7 @@ abstract class RenderBox extends RenderObject { /// Override this function if this render object can be hit even if its /// children were not hit. + @protected bool hitTestSelf(Point position) => false; /// Override this function to check whether any children are located at the @@ -1043,6 +1046,7 @@ abstract class RenderBox extends RenderObject { /// Typically children should be hit tested in reverse paint order so that /// hit tests at locations where children overlap hit the child that is /// visually "on top" (i.e., paints later). + @protected bool hitTestChildren(HitTestResult result, { Point position }) => false; /// Multiply the transform from the parent's coordinate system to this box's @@ -1149,6 +1153,7 @@ abstract class RenderBox extends RenderObject { /// In debug mode, paints a border around this render box. /// /// Called for every [RenderBox] when [debugPaintSizeEnabled] is true. + @protected void debugPaintSize(PaintingContext context, Offset offset) { assert(() { Paint paint = new Paint() @@ -1163,6 +1168,7 @@ abstract class RenderBox extends RenderObject { /// In debug mode, paints a line for each baseline. /// /// Called for every [RenderBox] when [debugPaintBaselinesEnabled] is true. + @protected void debugPaintBaselines(PaintingContext context, Offset offset) { assert(() { Paint paint = new Paint() @@ -1194,6 +1200,7 @@ abstract class RenderBox extends RenderObject { /// In debug mode, paints a rectangle if this render box has received more pointer downs than pointer up events. /// /// Called for every [RenderBox] when [debugPaintPointersEnabled] is true. + @protected void debugPaintPointers(PaintingContext context, Offset offset) { assert(() { if (_debugActivePointers > 0) { diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index bdf161eb84..a551cfabc7 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -9,6 +9,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/painting.dart'; import 'package:flutter/scheduler.dart'; +import 'package:meta/meta.dart'; import 'package:mojo_services/mojo/gfx/composition/scene_token.mojom.dart' as mojom; import 'package:vector_math/vector_math_64.dart'; @@ -29,6 +30,7 @@ export 'package:flutter/foundation.dart' show FlutterError, InformationCollector /// to other children. class ParentData { /// Called when the RenderObject is removed from the tree. + @mustCallSuper void detach() { } @override @@ -1438,6 +1440,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { /// property isn't used when debugCanParentUseSize isn't set, then that /// subclass should override debugResetSize() to reapply the current values of /// debugCanParentUseSize to that state. + @protected void debugResetSize() { } /// Whether the constraints are the only input to the sizing algorithm (in @@ -1459,6 +1462,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { /// to compute their size. /// /// This function is called only if [sizedByParent] is true. + @protected void performResize(); /// Do the work of computing the layout for this render object. @@ -1480,6 +1484,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { /// parentUsesSize ensures that this render object will undergo layout if the /// child undergoes layout. Otherwise, the child can changes its layout /// information without informing this render object. + @protected void performLayout(); // We cache a closure to performLayout so that the callsite is monomorphic. @@ -1489,6 +1494,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { /// Allows this render object to mutate its child list during layout and /// calls callback. + @protected void invokeLayoutCallback(LayoutCallback callback) { assert(_debugMutationsLocked); assert(_debugDoingThisLayout); @@ -1754,6 +1760,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { Rect get paintBounds; /// Override this function to paint debugging information. + @protected void debugPaint(PaintingContext context, Offset offset) { } /// Paint this render object into the given context at the given offset. @@ -2094,6 +2101,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { /// Returns a list of strings describing the current node's fields, one field /// per string. Subclasses should override this to have their information /// included in toStringDeep(). + @protected void debugFillDescription(List description) { if (debugCreator != null) description.add('creator: $debugCreator'); @@ -2103,6 +2111,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { /// Returns a string describing the current node's descendants. Each line of /// the subtree in the output should be indented by the prefix argument. + @protected String debugDescribeChildren(String prefix) => ''; }