layout

package
v0.23.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package layout provides layout value types and the render system.

This package defines the types used for positioning and sizing widgets: Constraints, EdgeInsets, Alignment, and the render object system.

Layout Types

Constraints specify the min/max dimensions a child can occupy:

constraints := layout.Tight(graphics.Size{Width: 100, Height: 50})
constraints := layout.Loose(graphics.Size{Width: 200, Height: 200})

EdgeInsets represents padding/margin on four sides:

padding := layout.EdgeInsetsAll(16)
padding := layout.EdgeInsetsSymmetric(horizontal: 8, vertical: 16)

Alignment represents a position within a rectangle:

alignment := layout.AlignmentCenter
alignment := layout.AlignmentTopLeft

Render Objects

RenderObject handles layout, painting, and hit testing. The render tree is responsible for the actual visual representation of widgets.

RenderBox is a RenderObject with box layout, the most common type.

PipelineOwner tracks render objects that need layout or paint updates.

Index

Constants

This section is empty.

Variables

View Source
var (
	// AlignmentTopLeft aligns to the top-left corner.
	AlignmentTopLeft = Alignment{-1, -1}
	// AlignmentTopCenter aligns to the top center.
	AlignmentTopCenter = Alignment{0, -1}
	// AlignmentTopRight aligns to the top-right corner.
	AlignmentTopRight = Alignment{1, -1}
	// AlignmentCenterLeft aligns to the center-left edge.
	AlignmentCenterLeft = Alignment{-1, 0}
	// AlignmentCenter aligns to the center.
	AlignmentCenter = Alignment{0, 0}
	// AlignmentCenterRight aligns to the center-right edge.
	AlignmentCenterRight = Alignment{1, 0}
	// AlignmentBottomLeft aligns to the bottom-left corner.
	AlignmentBottomLeft = Alignment{-1, 1}
	// AlignmentBottomCenter aligns to the bottom center.
	AlignmentBottomCenter = Alignment{0, 1}
	// AlignmentBottomRight aligns to the bottom-right corner.
	AlignmentBottomRight = Alignment{1, 1}
)

Common alignment presets.

Functions

func SetParentOnChild added in v0.22.0

func SetParentOnChild(child, parent RenderObject)

SetParentOnChild sets the parent reference on a child render object. It marks both the old and new parent as needing layout when the parent changes.

func WithinBounds added in v0.22.0

func WithinBounds(position graphics.Offset, size graphics.Size) bool

WithinBounds checks if a position is within the given size.

Types

type Alignment

type Alignment struct {
	X float64
	Y float64
}

Alignment represents a position within a rectangle.

func (Alignment) WithinRect

func (a Alignment) WithinRect(rect graphics.Rect, childSize graphics.Size) graphics.Offset

WithinRect returns the offset for a child within the given rect.

type BoxParentData

type BoxParentData struct {
	Offset graphics.Offset
}

BoxParentData stores the offset for a child in a box layout.

type ChildVisitor added in v0.2.0

type ChildVisitor interface {
	// VisitChildren calls the visitor function for each child.
	VisitChildren(visitor func(RenderObject))
}

ChildVisitor is implemented by render objects that have children.

type Constraints

type Constraints struct {
	MinWidth  float64
	MaxWidth  float64
	MinHeight float64
	MaxHeight float64
}

Constraints specify the min/max dimensions a child can occupy.

func Loose

func Loose(size graphics.Size) Constraints

Loose returns constraints with zero minimum.

func Tight

func Tight(size graphics.Size) Constraints

Tight returns constraints that force an exact size.

func (Constraints) Constrain

func (c Constraints) Constrain(size graphics.Size) graphics.Size

Constrain clamps a size to fit within the constraints.

func (Constraints) Deflate

func (c Constraints) Deflate(insets EdgeInsets) Constraints

Deflate reduces constraints by the provided padding.

func (Constraints) HasTightHeight

func (c Constraints) HasTightHeight() bool

HasTightHeight returns true if height is fixed.

func (Constraints) HasTightWidth

func (c Constraints) HasTightWidth() bool

HasTightWidth returns true if width is fixed.

func (Constraints) IsTight

func (c Constraints) IsTight() bool

IsTight returns true if both width and height are tight.

type EdgeInsets

type EdgeInsets struct {
	Left   float64
	Top    float64
	Right  float64
	Bottom float64
}

EdgeInsets represents padding/margin on four sides.

func EdgeInsetsAll

func EdgeInsetsAll(value float64) EdgeInsets

EdgeInsetsAll creates uniform padding on all sides.

func EdgeInsetsOnly

func EdgeInsetsOnly(left, top, right, bottom float64) EdgeInsets

EdgeInsetsOnly creates padding with explicit values.

func EdgeInsetsSymmetric

func EdgeInsetsSymmetric(horizontal, vertical float64) EdgeInsets

EdgeInsetsSymmetric creates symmetric padding.

func (EdgeInsets) Add

func (e EdgeInsets) Add(all float64) EdgeInsets

Add returns a new EdgeInsets with uniform padding added to all sides.

func (EdgeInsets) AddBottom

func (e EdgeInsets) AddBottom(value float64) EdgeInsets

AddBottom returns a new EdgeInsets with padding added to bottom.

func (EdgeInsets) AddHorizontal

func (e EdgeInsets) AddHorizontal(value float64) EdgeInsets

AddHorizontal returns a new EdgeInsets with padding added to left and right.

func (EdgeInsets) AddLeft

func (e EdgeInsets) AddLeft(value float64) EdgeInsets

AddLeft returns a new EdgeInsets with padding added to left.

func (EdgeInsets) AddRight

func (e EdgeInsets) AddRight(value float64) EdgeInsets

AddRight returns a new EdgeInsets with padding added to right.

func (EdgeInsets) AddTop

func (e EdgeInsets) AddTop(value float64) EdgeInsets

AddTop returns a new EdgeInsets with padding added to top.

func (EdgeInsets) AddVertical

func (e EdgeInsets) AddVertical(value float64) EdgeInsets

AddVertical returns a new EdgeInsets with padding added to top and bottom.

func (EdgeInsets) Horizontal

func (e EdgeInsets) Horizontal() float64

Horizontal returns the sum of left and right padding.

func (EdgeInsets) OnlyBottom

func (e EdgeInsets) OnlyBottom() EdgeInsets

OnlyBottom returns a new EdgeInsets with only the bottom value preserved.

func (EdgeInsets) OnlyHorizontal

func (e EdgeInsets) OnlyHorizontal() EdgeInsets

OnlyHorizontal returns a new EdgeInsets with only left and right preserved.

func (EdgeInsets) OnlyLeft

func (e EdgeInsets) OnlyLeft() EdgeInsets

OnlyLeft returns a new EdgeInsets with only the left value preserved.

func (EdgeInsets) OnlyRight

func (e EdgeInsets) OnlyRight() EdgeInsets

OnlyRight returns a new EdgeInsets with only the right value preserved.

func (EdgeInsets) OnlyTop

func (e EdgeInsets) OnlyTop() EdgeInsets

OnlyTop returns a new EdgeInsets with only the top value preserved.

func (EdgeInsets) OnlyVertical

func (e EdgeInsets) OnlyVertical() EdgeInsets

OnlyVertical returns a new EdgeInsets with only top and bottom preserved.

func (EdgeInsets) Vertical

func (e EdgeInsets) Vertical() float64

Vertical returns the sum of top and bottom padding.

type HitTestResult

type HitTestResult struct {
	Entries []RenderObject
}

HitTestResult collects hit test entries in paint order.

func (*HitTestResult) Add

func (h *HitTestResult) Add(target RenderObject)

Add inserts a render object into the hit test result list.

type OcclusionShaper added in v0.21.0

type OcclusionShaper interface {
	OcclusionPath() *graphics.Path
}

OcclusionShaper is an optional interface for render objects that know the shape of their opaque painted area (e.g. Container with a background color or border radius). The returned path is in the render object's local coordinates.

Implementors should call ctx.OccludePlatformViews(path) during their Paint() method when OcclusionPath() returns a non-nil path. This ensures platform views painted earlier in z-order are clipped beneath the opaque region. The occlusion op is a no-op on canvases that don't implement OcclusionCanvas (e.g. Skia), so there is no overhead outside the geometry compositing pass.

type PaintContext

type PaintContext struct {
	Canvas graphics.Canvas

	ShowLayoutBounds bool // Debug flag to draw bounds around widgets

	DebugStrokeWidth float64         // Scaled stroke width (0 = use default 1.0)
	RecordingLayer   *graphics.Layer // Non-nil during layer recording phase.
	// contains filtered or unexported fields
}

PaintContext provides the canvas and state tracking for painting render objects. It maintains transform and clip stacks for culling and platform view geometry, and supports layer-based recording when RecordingLayer is set.

func (*PaintContext) CurrentClipBounds added in v0.6.0

func (p *PaintContext) CurrentClipBounds() (graphics.Rect, bool)

CurrentClipBounds returns the effective clip in global coordinates. Returns (clip, true) if a clip is active, (Rect{}, false) if not.

func (*PaintContext) CurrentTransform added in v0.6.0

func (p *PaintContext) CurrentTransform() graphics.Offset

CurrentTransform returns the accumulated translation offset.

func (*PaintContext) EmbedPlatformView added in v0.10.0

func (p *PaintContext) EmbedPlatformView(viewID int64, size graphics.Size)

EmbedPlatformView records a platform view at the current position. During the geometry compositing pass, GeometryCanvas resolves transform+clip and captures native view geometry for the platform to apply.

func (*PaintContext) OccludePlatformViews added in v0.21.0

func (p *PaintContext) OccludePlatformViews(mask *graphics.Path)

OccludePlatformViews records a path mask that occludes platform views rendered before this point in z-order. The mask is in local coordinates and will be transformed to global coordinates during the geometry compositing pass. If the canvas does not support occlusion tracking, this is a no-op.

func (*PaintContext) PaintChild

func (p *PaintContext) PaintChild(child RenderBox, offset graphics.Offset)

PaintChild paints a child render box at the given offset.

func (*PaintContext) PaintChildWithLayer added in v0.4.0

func (p *PaintContext) PaintChildWithLayer(child RenderBox, offset graphics.Offset)

PaintChildWithLayer paints a child, using its cached layer if available. During layer recording (RecordingLayer != nil), child boundaries are recorded as DrawChildLayer ops rather than having their content embedded.

func (*PaintContext) PopClipRect added in v0.6.0

func (p *PaintContext) PopClipRect()

PopClipRect removes the most recent clip rectangle.

func (*PaintContext) PopTranslation added in v0.6.0

func (p *PaintContext) PopTranslation()

PopTranslation removes the most recent translation from the stack.

func (*PaintContext) PushClipRect added in v0.6.0

func (p *PaintContext) PushClipRect(localRect graphics.Rect)

PushClipRect pushes a clip rectangle (in local coordinates). The rect is transformed to global coordinates and intersected with current clip.

func (*PaintContext) PushTranslation added in v0.6.0

func (p *PaintContext) PushTranslation(dx, dy float64)

PushTranslation adds a translation delta to the stack.

type PipelineOwner

type PipelineOwner struct {
	// contains filtered or unexported fields
}

PipelineOwner tracks render objects that need layout or paint.

Layout scheduling works with relayout boundaries: when a node needs layout, MarkNeedsLayout walks up to the nearest boundary, marking each node along the way. The boundary gets scheduled here. During FlushLayoutForRoot, layout propagates from the root (or scheduled boundaries) down through all marked nodes.

func (*PipelineOwner) DirtyLayoutCount added in v0.10.0

func (p *PipelineOwner) DirtyLayoutCount() int

DirtyLayoutCount returns the number of scheduled layout boundaries.

func (*PipelineOwner) DirtyLayoutTypes added in v0.10.0

func (p *PipelineOwner) DirtyLayoutTypes(limit int) []TypeCount

DirtyLayoutTypes returns the most common dirty layout boundary types.

func (*PipelineOwner) DirtyPaintCount added in v0.10.0

func (p *PipelineOwner) DirtyPaintCount() int

DirtyPaintCount returns the number of scheduled paint boundaries.

func (*PipelineOwner) DirtyPaintTypes added in v0.10.0

func (p *PipelineOwner) DirtyPaintTypes(limit int) []TypeCount

DirtyPaintTypes returns the most common dirty paint boundary types.

func (*PipelineOwner) DirtySemanticsCount added in v0.10.0

func (p *PipelineOwner) DirtySemanticsCount() int

DirtySemanticsCount returns the number of scheduled semantics boundaries.

func (*PipelineOwner) DirtySemanticsTypes added in v0.10.0

func (p *PipelineOwner) DirtySemanticsTypes(limit int) []TypeCount

DirtySemanticsTypes returns the most common dirty semantics boundary types.

func (*PipelineOwner) FlushLayout

func (p *PipelineOwner) FlushLayout()

FlushLayout clears the dirty layout list without performing layout.

func (*PipelineOwner) FlushLayoutForRoot

func (p *PipelineOwner) FlushLayoutForRoot(root RenderObject, constraints Constraints)

FlushLayoutForRoot runs layout starting from the root.

The typical frame sequence is:

  1. FlushBuild - rebuilds dirty elements, updates render object properties
  2. FlushLayoutForRoot - lays out from root, propagating to dirty subtrees
  3. Paint - renders the tree

Layout starts at the root with tight constraints (root is always a boundary). From there, layout propagates down. Nodes with needsLayout=true will run PerformLayout; clean nodes with unchanged constraints skip layout entirely.

func (*PipelineOwner) FlushLayoutFromBoundaries added in v0.4.0

func (p *PipelineOwner) FlushLayoutFromBoundaries()

FlushLayoutFromBoundaries processes dirty relayout boundaries without a root. This is useful for incremental updates outside the normal frame cycle.

func (*PipelineOwner) FlushPaint

func (p *PipelineOwner) FlushPaint() []RenderObject

FlushPaint processes dirty repaint boundaries in depth order. Returns boundaries that need repainting (parents first).

func (*PipelineOwner) FlushSemantics added in v0.4.0

func (p *PipelineOwner) FlushSemantics() []RenderObject

FlushSemantics returns dirty semantics boundaries sorted by depth.

func (*PipelineOwner) NeedsLayout

func (p *PipelineOwner) NeedsLayout() bool

NeedsLayout reports if any render objects need layout.

func (*PipelineOwner) NeedsPaint

func (p *PipelineOwner) NeedsPaint() bool

NeedsPaint reports if any render objects need paint.

func (*PipelineOwner) NeedsSemantics added in v0.4.0

func (p *PipelineOwner) NeedsSemantics() bool

NeedsSemantics reports if any render objects need semantics update.

func (*PipelineOwner) ScheduleLayout

func (p *PipelineOwner) ScheduleLayout(object RenderObject)

ScheduleLayout marks a relayout boundary as needing layout. Only relayout boundaries should be scheduled here - intermediate nodes are marked via MarkNeedsLayout but not scheduled directly.

func (*PipelineOwner) SchedulePaint

func (p *PipelineOwner) SchedulePaint(object RenderObject)

SchedulePaint marks a render object as needing paint.

func (*PipelineOwner) ScheduleSemantics added in v0.4.0

func (p *PipelineOwner) ScheduleSemantics(object RenderObject)

ScheduleSemantics marks a semantics boundary as needing update.

type PlatformViewOwner added in v0.12.0

type PlatformViewOwner interface {
	PlatformViewID() int64
}

PlatformViewOwner identifies a render object that owns a native platform view. Used by the hit test query to determine if a platform view is the topmost target. Implementations return the platform view's positive ID, or -1 if the native view has not been created yet.

type PointerHandler

type PointerHandler interface {
	HandlePointer(event gestures.PointerEvent)
}

PointerHandler receives pointer events routed from hit testing.

type RenderBox

type RenderBox interface {
	RenderObject
}

RenderBox is a RenderObject with box layout.

func AsRenderBox added in v0.22.0

func AsRenderBox(child RenderObject) RenderBox

AsRenderBox converts a RenderObject to a RenderBox. Returns nil if the child is nil or not a RenderBox.

type RenderBoxBase

type RenderBoxBase struct {
	// contains filtered or unexported fields
}

RenderBoxBase provides base behavior for render boxes.

func (*RenderBoxBase) ClearNeedsPaint added in v0.4.0

func (r *RenderBoxBase) ClearNeedsPaint()

ClearNeedsPaint marks this render object as painted.

func (*RenderBoxBase) ClearNeedsSemanticsUpdate added in v0.4.0

func (r *RenderBoxBase) ClearNeedsSemanticsUpdate()

ClearNeedsSemanticsUpdate marks this render object's semantics as updated.

func (*RenderBoxBase) Constraints added in v0.4.0

func (r *RenderBoxBase) Constraints() Constraints

Constraints returns the last received constraints.

func (*RenderBoxBase) Depth added in v0.4.0

func (r *RenderBoxBase) Depth() int

Depth returns the tree depth (root = 0).

func (*RenderBoxBase) DescribeSemanticsConfiguration added in v0.2.0

func (r *RenderBoxBase) DescribeSemanticsConfiguration(config *semantics.SemanticsConfiguration) bool

DescribeSemanticsConfiguration is the default implementation that reports no semantic content. Override this method in render objects that provide semantic information.

func (*RenderBoxBase) Dispose added in v0.10.0

func (r *RenderBoxBase) Dispose()

Dispose releases resources held by this render box. Call this when the render object is permanently removed from the tree.

func (*RenderBoxBase) EnsureLayer added in v0.10.0

func (r *RenderBoxBase) EnsureLayer() *graphics.Layer

EnsureLayer returns the existing layer or creates one if needed. The layer has stable identity - never replace it, only mark dirty.

func (*RenderBoxBase) IsRepaintBoundary added in v0.4.0

func (r *RenderBoxBase) IsRepaintBoundary() bool

IsRepaintBoundary returns whether this render object repaints separately. Override this in render objects that should isolate their paint.

func (*RenderBoxBase) Layer added in v0.4.0

func (r *RenderBoxBase) Layer() *graphics.Layer

Layer returns the cached layer for repaint boundaries.

func (*RenderBoxBase) Layout added in v0.4.0

func (r *RenderBoxBase) Layout(constraints Constraints, parentUsesSize bool)

Layout handles boundary determination and delegates to PerformLayout.

This implements Flutter's relayout boundary optimization. A node becomes a relayout boundary when:

  • It receives tight constraints (parent dictates exact size)
  • It is the root (no parent)
  • Parent doesn't use our size (parentUsesSize=false)

Boundaries contain layout changes - when a descendant needs layout, the walk up stops at the boundary, preventing unnecessary relayout of ancestors.

Widgets should implement PerformLayout() for their specific layout logic. The base Layout() handles:

  • Updating the relayout boundary reference
  • Skipping layout when clean and constraints unchanged
  • Clearing the needsLayout flag
  • Calling PerformLayout()

func (*RenderBoxBase) MarkNeedsLayout

func (r *RenderBoxBase) MarkNeedsLayout()

MarkNeedsLayout marks this render box as needing layout.

This follows Flutter's relayout boundary pattern: when a node needs layout, we walk up the tree marking each node until we reach a relayout boundary. The boundary then gets scheduled for layout. During layout, all marked nodes will run their PerformLayout because their needsLayout flag is true.

This ensures that when a deep descendant changes, layout properly propagates from the boundary down through all intermediate nodes to reach the changed node.

func (*RenderBoxBase) MarkNeedsPaint

func (r *RenderBoxBase) MarkNeedsPaint()

MarkNeedsPaint marks this render box as needing paint.

This follows Flutter's repaint boundary pattern: when a node needs paint, we walk up the tree until we reach a repaint boundary. The boundary then gets scheduled for paint.

Key optimization: When we hit a repaint boundary, we STOP walking up. Parent boundaries reference child boundaries via DrawChildLayer ops, not embedded content. This means changing a child's content doesn't require re-recording the parent.

Note: Unlike MarkNeedsLayout, we don't early-return when needsPaint is true. This is because SetSelf() pre-sets needsPaint=true without scheduling, and SchedulePaint() already handles deduplication internally.

func (*RenderBoxBase) MarkNeedsSemanticsUpdate added in v0.2.0

func (r *RenderBoxBase) MarkNeedsSemanticsUpdate()

MarkNeedsSemanticsUpdate marks this render box as needing semantics update.

This follows Flutter's semantics boundary pattern: when a node needs semantics update, we walk up the tree until we reach a semantics boundary. The boundary then gets scheduled for semantics update.

Note: Unlike MarkNeedsLayout, we don't early-return when needsSemanticsUpdate is true. This is because SetSelf() and SetParent() pre-set needsSemanticsUpdate=true without scheduling, and ScheduleSemantics() already handles deduplication internally.

NOTE: This method marks needsSemanticsUpdate=true on all nodes along the path to the boundary, but only the boundary is added to dirtySemantics. When FlushSemantics clears flags, only boundary flags are cleared - intermediate nodes remain dirty. This is harmless with the current full-rebuild approach but would need addressing for true incremental updates (either clear all affected nodes, or only mark boundaries).

func (*RenderBoxBase) NeedsLayout added in v0.4.0

func (r *RenderBoxBase) NeedsLayout() bool

NeedsLayout returns true if this render box needs layout.

func (*RenderBoxBase) NeedsPaint added in v0.4.0

func (r *RenderBoxBase) NeedsPaint() bool

NeedsPaint returns true if this render box needs painting.

func (*RenderBoxBase) NeedsSemanticsUpdate added in v0.4.0

func (r *RenderBoxBase) NeedsSemanticsUpdate() bool

NeedsSemanticsUpdate returns true if this render box needs semantics update.

func (*RenderBoxBase) Parent added in v0.4.0

func (r *RenderBoxBase) Parent() RenderObject

Parent returns the parent render object.

func (*RenderBoxBase) ParentData

func (r *RenderBoxBase) ParentData() any

ParentData returns the parent-assigned data for this render box.

func (*RenderBoxBase) RelayoutBoundary added in v0.4.0

func (r *RenderBoxBase) RelayoutBoundary() RenderObject

RelayoutBoundary returns the cached nearest relayout boundary.

func (*RenderBoxBase) RepaintBoundary added in v0.4.0

func (r *RenderBoxBase) RepaintBoundary() RenderObject

RepaintBoundary returns the cached nearest repaint boundary.

func (*RenderBoxBase) Self added in v0.22.0

func (r *RenderBoxBase) Self() RenderObject

Self returns the concrete render object registered via SetSelf.

func (*RenderBoxBase) SemanticsBoundary added in v0.4.0

func (r *RenderBoxBase) SemanticsBoundary() RenderObject

SemanticsBoundary returns the cached nearest semantics boundary.

func (*RenderBoxBase) SetLayerContent added in v0.10.0

func (r *RenderBoxBase) SetLayerContent(content *graphics.DisplayList)

SetLayerContent updates the layer's content (called after recording). Disposes old content before setting new content.

func (*RenderBoxBase) SetOwner

func (r *RenderBoxBase) SetOwner(owner *PipelineOwner)

SetOwner assigns the pipeline owner for scheduling layout and paint.

func (*RenderBoxBase) SetParent added in v0.4.0

func (r *RenderBoxBase) SetParent(parent RenderObject)

SetParent sets the parent render object and computes depth. Clears relayoutBoundary and constraints to prevent stale references when the object is reparented to a different subtree. Also marks old and new parent for repaint since their DrawChildLayer ops change.

func (*RenderBoxBase) SetParentData

func (r *RenderBoxBase) SetParentData(data any)

SetParentData assigns parent-controlled data to this render box. If the offset in BoxParentData changes, marks the parent for repaint since the parent's DrawChildLayer op embeds the child offset and becomes stale.

func (*RenderBoxBase) SetSelf

func (r *RenderBoxBase) SetSelf(self RenderObject)

SetSelf registers the concrete render object for scheduling.

func (*RenderBoxBase) SetSize

func (r *RenderBoxBase) SetSize(size graphics.Size)

SetSize updates the render box size. If the size changes, marks paint as dirty since the render object's content needs to be re-recorded at the new size.

func (*RenderBoxBase) Size

func (r *RenderBoxBase) Size() graphics.Size

Size returns the current size of the render box.

type RenderObject

type RenderObject interface {
	Layout(constraints Constraints, parentUsesSize bool)
	Size() graphics.Size
	Paint(ctx *PaintContext)
	HitTest(position graphics.Offset, result *HitTestResult) bool
	ParentData() any
	SetParentData(data any)
	MarkNeedsLayout()
	MarkNeedsPaint()
	MarkNeedsSemanticsUpdate()
	SetOwner(owner *PipelineOwner)
	IsRepaintBoundary() bool
}

RenderObject handles layout, painting, and hit testing.

type RepaintBoundaryNode added in v0.10.0

type RepaintBoundaryNode interface {
	IsRepaintBoundary() bool
	NeedsPaint() bool
}

RepaintBoundaryNode is implemented by render objects that are repaint boundaries.

type SemanticScrollOffsetProvider added in v0.22.0

type SemanticScrollOffsetProvider interface {
	// SemanticScrollOffset returns the scroll offset to subtract from child positions.
	// A positive Y value means content has scrolled up (showing lower content).
	SemanticScrollOffset() graphics.Offset
}

SemanticScrollOffsetProvider is implemented by scrollable render objects. The accessibility system uses this to adjust child positions for scroll offset.

type SemanticsChildVisitor added in v0.12.0

type SemanticsChildVisitor interface {
	VisitChildrenForSemantics(visitor func(RenderObject))
}

SemanticsChildVisitor is implemented by render objects that need to provide a different set of children for semantics traversal than for painting/layout. When present, the accessibility service uses this instead of ChildVisitor.

type SemanticsDescriber added in v0.2.0

type SemanticsDescriber interface {
	// DescribeSemanticsConfiguration populates the semantic configuration for this render object.
	// Returns true if this render object contributes semantic information.
	DescribeSemanticsConfiguration(config *semantics.SemanticsConfiguration) bool
}

SemanticsDescriber is implemented by render objects that provide semantic information.

type TapTarget

type TapTarget interface {
	OnTap()
}

TapTarget is a render object that responds to tap events.

type TypeCount added in v0.10.0

type TypeCount struct {
	Type  string `json:"type"`
	Count int    `json:"count"`
}

TypeCount records the count for a render object type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL