What’s Align?

The Align class is a widget in Flutter that aligns its child within itself and can optionally size itself based on the child’s size. Important properties include alignment, widthFactor, and heightFactor.

Check the official documentation for more.

Align explained for Android Developers

For Android developers, the Align class can be compared to the layout parameters in Android views, where you can specify how a child view should be positioned within its parent. Similar to how you might use Gravity in Android XML layouts, the Align widget allows you to control the alignment of its child using the Alignment class.

Example Code

Here is an example of how to use Align:

Center( child: Container( height: 120.0, width: 120.0, color: Colors.blue[50], child: const Align( alignment: Alignment.topRight, child: FlutterLogo( size: 60, ), ), ), )

Align Remarks

The Align class is a powerful tool for positioning widgets in Flutter, providing flexibility similar to Android’s layout parameters.

Bootstrap Your app with ShipFlutter

A fully customizable starter kit to seamlessly launch responsive Android, iOS, and Web apps with Flutter powered by Firebase and Vertex AI.