The Align Widget

Learn to render a child at a specific position within its parent.

We can use the Align widget to specify how a child widget will be positioned within Align itself. Its main argument is alignment, which expresses the distance from the child widget to the center of Align. The most common way to use Align is with the constant values from the Alignment class. This class aligns the child with the edges or with the center of Align. Following are the constant values from the alignment class:

  • Alignment.bottomCenter
  • Alignment.bottomLeft
  • Alignment.bottomRight
  • Alignment.center
  • Alignment.centerLeft
  • Alignment.centerRight
  • Alignment.topCenter
  • Alignment.topLeft
  • Alignment.topRight

Here’s an example of each of them:

Get hands-on with 1400+ tech skills courses.