> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stac.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Spacer

> Documentation for Spacer

export const PLAYGROUND_BASE_URL = "https://playground.stac.dev/";

export const spacerPreviewJson = {
  "type": "spacer",
  "flex": 2
};
export const spacerPreviewSrc = `${PLAYGROUND_BASE_URL}/embed`;

The Stac Spacer allows you to build a Flutter spacer widget using JSON.
To know more about the spacer widget in Flutter, refer to the [official documentation](https://api.flutter.dev/flutter/widgets/Spacer-class.html).

## Properties

\| Property | Type  | Description                                             |
\|----------|--chore-----|---------------------------------------------------------|
\| flex     | `int` | The flex factor to use for the spacer. Defaults to `1`. |

## Example

<Tabs sync={false}>
  <Tab title="Dart">
    ```dart theme={null}
    StacSpacer(flex: 2)
    ```
  </Tab>

  <Tab title="JSON">
    ```json theme={null}
    {
      "type": "spacer",
      "flex": 2
    }
    ```
  </Tab>

  <Tab title="Preview">
    <Frame>
      <iframe
        id="stac"
        src={spacerPreviewSrc}
        title="Stac Playground"
        className="w-full rounded-xl border-0"
        style={{ height: "640px" }}
        loading="lazy"
        onLoad={(event) => {
      const iframe = event.currentTarget;
      const targetOrigin = PLAYGROUND_BASE_URL;
      const message = {
        type: "stac-preview-json",
        payload: spacerPreviewJson
      };

      let attempts = 0;
      const maxAttempts = 12;
      const interval = setInterval(() => {
        iframe.contentWindow?.postMessage(message, targetOrigin);
        attempts += 1;

        if (attempts >= maxAttempts) {
          clearInterval(interval);
        }
      }, 250);
    }}
      />
    </Frame>
  </Tab>
</Tabs>
