Skip to content

Customize the paint order. #3

@leavky

Description

@leavky

Subclasses of RenderTwoDimensionalViewport will typically use firstChild to traverse children in a standard paint order that follows row or column major ordering. so we can customize the paint order. like this.

  @override
  void paint(PaintingContext context, Offset offset) {
    // Paint as wish
    var item = _visibleElements!.removeAt(0);
    _visibleElements!.add(item);

    for (final element in _visibleElements!) {
      if (getChildFor(element.vicinity) case final child?) {
        context.paintChild(child, parentDataOf(child).layoutOffset! + offset);
      }
    }
  }

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions