selfAligned method

Widget selfAligned(
  1. BoxAlignmentGeometry alignSelf, [
  2. Key? key
])

Sets the alignment of this widget within its parent flex container.

This overrides the parent's alignItems property for this specific child, allowing individual control over alignment. Common values include BoxAlignment.start, BoxAlignment.center, BoxAlignment.end, and BoxAlignment.stretch.

The optional key parameter assigns a key to the wrapped widget.

Example:

Container().selfAligned(BoxAlignment.center),
Container().selfAligned(BoxAlignment.stretch),

Implementation

Widget selfAligned(BoxAlignmentGeometry alignSelf, [Key? key]) {
  return _WidgetWrapper._wrapOrCopyWith(
    child: this,
    key: key != null ? () => key : null,
    alignSelf: () => alignSelf,
  );
}