Skip to main content
The Stac AspectRatio allows you to build a Flutter AspectRatio widget using JSON. To know more about the aspectRatio widget in Flutter, refer to the official documentation.

Properties

PropertyTypeDescription
aspectRatiodoubleThe desired width-to-height ratio for the child widget. Defaults to 1 (a square aspect ratio).
childStacWidgetThe child widget that should adhere to the specified aspect ratio, represented as a JSON object.

Example

StacAspectRatio(
  aspectRatio: 1.33,
  child: StacContainer(
    color: '#FF5733',
    width: 100,
    height: 100,
  ),
)