Search⌘ K
AI Features

The Align Widget

Explore how to control the position of child widgets within the Align widget in Flutter. Understand using predefined alignment constants and custom values to build responsive UI layouts that adapt to different screen sizes without hardcoding padding. This lesson guides you through practical examples to improve your Flutter application's alignment and responsiveness.

We'll cover the following...

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
...