buildPositioned method

  1. @override
Widget buildPositioned(
  1. BuildContext context,
  2. Widget content
)
override

Builds the Widget which positions the SceneElement in the Scene's Stack.

The returned Widget must contain the given content Widget somewhere in it's subtree. The position and size of content determines the position and size of the SceneElement in the Scene. If buildContent returns null, content will take up all the available space. To determine the size of the SceneElement through a Widget, implement buildContent. The result of buildContent will be contained in content.

Implementation

@override
Widget buildPositioned(BuildContext context, Widget content) {
  final alignment = this.alignment.resolve(Directionality.of(context));
  final alignmentOffset = alignment.alongSize(size);
  final offset = position - alignmentOffset;

  return Positioned.fromRect(rect: offset & size, child: content);
}