PaddingComponent

class PaddingComponent
extends SingleLayoutComponent

A padding component akin to Flutter’s Padding widget. Use padding as you would Flutter’s counterpart. While this component is designed to shrink or expand to its child’s dimensions, it is fine to set its size explicitly. The child will simply be offset by the padding dimensions.

Set the child of this component with child. Avoid using add directly on an instance of PaddingComponent because its behavior is undefined with multiple children. It is designed only for one child.

You may set padding as well as the child after the fact, and it will cause the layout to refresh.

Example usage:

PaddingComponent(
  padding: EdgeInsets.all(10),
  child: TextComponent(text: 'bar')
);

Constructors

PaddingComponent({super.key, EdgeInsets? padding, super.anchor, super.position, super.priority, super.size, PositionComponent? child})

Properties

padding ←→ EdgeInsets