RenderBoxmodels a two dimensional box with a width, height, and position (
RenderBox.parentData.offset). The box's top-left corner defines its origin, with the bottom-right corner corresponding to
BoxParentDatastores the child's offset in the parent’s coordinate space (
BoxParentData.offset). By convention, this data may not be accessed by the child.
BoxConstraintsdescribes immutable constraints expressed as a maximum and minimum width and height ranging from zero to infinity, inclusive. Constraints are satisfied by concrete sizes that fall within this range.
BoxConstraints.isNormal: minimum is greater than zero and less than or equal to the maximum in both dimensions.
BoxConstraints.tight, BoxConstraints.isTight: minimum and maximum values are equal in both dimensions.
BoxConstraints.loose: minimum value is zero, even if maximum is also zero (i.e., loose and tight).
BoxConstraints.hasBoundedHeight: the corresponding maximum is not infinite.
BoxConstraints.expanding: both maximum and minimum values are infinite in the same dimension (i.e., tightly infinite).
BoxConstraints.hasInfiniteHeight: the corresponding minimum is infinite (thus, the maximum must also be infinite; this is the same as expanding).
BoxConstraints.isSatisfiedBy), applied to a
BoxConstraints.constrain), tightened relative to constraints (
BoxConstraints.tighten), loosened by setting minimums to zero (
BoxConstraints.loosen), and intersected (
BoxConstraints.enforce). Constraints can also be scaled standard algebraic operators.
HitTestResultsubclass that captures each
HitTestTarget) that reported being hit in order of decreasing precedence.
BoxHitTestEntryrepresents a box that was hit during hit testing. It captures the position of the collision in local coordinates (
ContainerParentDataMixin. This combines a child offset (
BoxParentData.offset) with next and previous pointers (
ContainerParentData.nextSibling) to describe a doubly linked list of children.
ContainerRenderObjectMixincan both be used with a type argument of
ContainerRenderObjectMixinaccepts a parent data type argument;
ContainerBoxParentDatais compatible and adds support for box children.
RenderBoxContainerDefaultsMixinadds useful defaults to
ContainerRenderObjectMixinfor render boxes with children. Type constraints require that children extend
RenderBoxand parent data extends
RenderBoxContainerDefaultsMixin.defaultHitTestChildren), painting (
RenderBoxContainerDefaultsMixin.defaultPaint), and listing (
RenderProxyBoxdelegates all methods to a single
RenderBoxchild, adopting the child's size as its own size and positioning the child at its origin. Proxies are convenient for writing subclasses that selectively override some, but not all, of a box's behavior. This box's implementation is provided by
RenderProxyBoxMixin, which provides an alternative to direct inheritance. Proxy boxes uses
BoxParentDatasince the child's offset is never used.
RenderProxyBox.hitTestto disable hit testing for a subtree (i.e., by not testing its child) when
RenderAnimatedOpacitylistens to an animation (
RenderAnimatedOpacity.opacity) to render its child with varying opacity (via
RenderAnimatedOpacity.paint). This box manages its listener by overriding
RenderProxyBox.detach. It selective inserts an
OpacityLayer(i.e., for translucent values only), and manages
RenderBox.alwaysNeedsCompositingto reflect whether a layer will be added (via
RenderAnimatedOpacityMixin._updateOpacity, called in response to the animation).
RenderProxyBox.performLayoutto adopt a size that corresponds to its child's intrinsic width, subject to the incoming constraints. It also overrides intrinsic sizing methods since it also provides size snapping (
RenderShiftedBoxdelegates all methods to a single
RenderBoxchild, but leaves layout undefined. Subclasses override
RenderShiftedBox.performLayoutto assign a position to the child (via
BoxParentData.offset). Otherwise, this subclass is analogous to
RenderShiftedBox.performLayoutto deflate the incoming constraints by the resolved padding amount. The child is laid out using the new, padded constraints and positioned within the padded region.
RenderShiftedBox.performLayoutto align its child's baseline (via
RenderBox.getDistanceToBaseline) with an offset from its top edge (
RenderBaseline.baseline). It then sizes itself such that its bottom is coincident with the child's baseline (this can potentially truncate the top of the child).
RenderObjectlayout protocol to map from incoming
BoxConstraintsto a concrete
RenderBox.size). Layout also determines the child's offset relative to the parent (
RenderBox.parentData.offset). This information should not be read by the child during layout.
RenderBoxinstances track changes to these values and whether the parent has queried them; if so, when that box is marked as needing layout, the parent is marked as well.
RenderBox._cachedIntrinsicDimensions) whenever they're computed (via
RenderBox._computeIntrinsicDimension). The cache is disabled during debugging.
RenderBox._cachedBaselines) whenever they're computed (via
RenderBox.getDistanceToActualBaseline). Different baselines are computed for alphabetic and ideographic text.
RenderBox.markNeedsLayoutmarks the parent as needing layout if the box's intrinsic dimension or baseline caches have been modified (i.e., this implies that the parent has accessed the box's "out-of-band" geometry). If so, both are cleared so that new values are computed after the next layout pass.
BoxConstraintsto the appropriate type.
RenderObjectpainting protocol to paint themselves to a provided canvas. The canvas's origin isn't necessarily coincident with the box's origin; the offset provided to
RenderBox.paintdescribes where the box's origin falls on the canvas. The canvas and the box will always be axis-aligned.
RenderBox.paintBoundsdescribes the region that will be painted by a box. This determines the size of the buffer used for painting and is expressed in local coordinates. It need not match
RenderBox.applyPaintTransformmust apply the same transformation to the provided matrix.
RenderBox.localToGlobalrely on this transformation to map from global coordinates to box coordinates and vice versa.
RenderBox.applyPaintTransformapplies the child’s offset (via
child.parentData.offset) as a translation.
RendererBinding, the hit testing entry point, does implement this interface).
RendererBinding.hitTestis invoked using mixin chaining (via
GestureBinding._handlePointerEvent). The binding delegates to
RenderView.hitTestwhich tests its child (via
RenderBox.hitTestdetermines whether an offset (in local coordinates) falls within its bounds. If so, each child is tested in sequence (via
RenderBox.hitTestChildren) before the box tests itself (via
RenderBox.hitTestSelf). By default, both methods return
false(i.e., boxes do not handle events or forward events to their children).
RenderBox.handleEventcalls for events related to the interaction) by adding themselves to
BoxHitTestResult. Boxes added earlier take precedence.
BoxHitTestResultare notified of events (via
RenderBox.handleEvent) in the order that they were added.
IntrinsicWidthwidgets, which attempt to layout a child using its intrinsic dimensions).
RenderBox.computeMaxIntrinsicHeight, etc.). Both receive a value for the opposite dimension (if infinite, the other dimension is unconstrained); this is useful for boxes that define one intrinsic dimension in terms of the other (e.g., text).
RenderBox.computeDistanceToActualBaseline. The returned value represents a vertical offset from the top of the box. Values are cached until the box is marked as needing layout.
RenderBoxContainerDefaultsMixinto produce a baseline from a set of children.
RenderBoxContainerDefaultsMixin.defaultComputeDistanceToFirstActualBaselinereturns the first valid baseline reported by the set of children, adjusted to account for the child's offset.
RenderBox.getDistanceToBaselinereturns the offset to the box's bottom edge (
RenderBox.size.height) if an actual baseline isn't available (i.e.,