# 5-2. 전면 광고 for Flutter

## 사전 작업

{% content-ref url="" %}
[](https://one-admax-organization.gitbook.io/one-admax-sdk/05.-flutter-plugin-guide)
{% endcontent-ref %}

## 전면 광고 인스턴스 생성

```java
 ...
 OAMInterstitial _oamInterstitial = OAMInterstitial()
 ...
```

## 전면 광고 요청

전면 광고의 `load()`를 요청합니다.

매개변수로는 `placementId`와 `InterstitialCallBackListener`을 받습니다.

[전면광고의 `placementId`는 ONE AdMax 콘솔에서 생성이 가능합니다.](https://one-admax-organization.gitbook.io/one-admax-sdk/02.)

```dart
oamInterstitial.load(
 placementId: interstitialPlacementId,
);
```

{% hint style="warning" %}
과도한 광고 요청은 차단 사유가 되니 주의해주세요!
{% endhint %}

## 전면 광고 이벤트 리스너 설정

전면 광고를 불러올 때 발생하는 이벤트에 대한 리스너를 설정합니다. 제공되는 리스너와 구현 예시는 다음과 같습니다.

```java
_oamInterstitial.load(
  callback: InterstitialCallBackListener(
    onLoaded: onLoaded,
    onLoadFailed: onLoadFailed,
    onOpened: onOpened,
    onOpenFailed: onOpenFailed,
    onClosed: onClosed,
    onClicked: onClicked,
  ),
);
```

{% content-ref url="../oamerror" %}
[oamerror](https://one-admax-organization.gitbook.io/one-admax-sdk/oamerror)
{% endcontent-ref %}

## 전면 광고 노출

전면 광고를 보여줍니다.

```java
_oamInterstitial.show();
```

## 전면 광고 커스텀 옵션

| 변수                    | 설명                                                      |
| --------------------- | ------------------------------------------------------- |
| backgroundColor       | 배경색 및 투명도 변경. Color 값                                   |
| isHideCloseButton     | 우측 상단 닫기 버튼 노출 여부 설정. default : false                   |
| closeBtnMargin.left   | 닫기 버튼 좌측 마진. default : -28dp                            |
| closeBtnMargin.top    | 닫기 버튼 상단 마진. default : 20dp                             |
| closeBtnMargin.right  | 닫기 버튼 우측 마진. default : 20dp                             |
| closeBtnMargin.bottom | 닫기 버튼 하단 마진. default : 0dp                              |
| isDisableBackButton   | 백키 종료 사용 안 함. deault : false                            |
| EndingText.isShow     | 종료 메시지 노출 여부. default : false                           |
| EndingText.text       | <p>종료 메시지. <br>default : "뒤로 가기를 한 번 더 누르시면 종료됩니다."</p> |
| EndingText.size       | 종료 메시지 size. default : 11sp                             |
| EndingText.color      | 종료 메시지 test color. default : white                      |
| EndingText.align      | 종료 메시지 gravity. default : RIGHT                         |

## 전면 광고 샘플 코드

```java
OAMInterstitial _oamInterstitial = OAMInterstitial()

_oamInterstitial.load(
  placementId: interstitialPlacementId,
  callback: InterstitialCallBackListener(
    onLoaded: onLoaded,
    onLoadFailed: onLoadFailed,
    onOpened: onOpened,
    onOpenFailed: onOpenFailed,
    onClosed: onClosed,
    onClicked: onClicked,
  ),
);

_oamInterstitial.interstitialConfig.isHideCloseButton = false;
_oamInterstitial.interstitialConfig.backgroundColor = Colors.red;
_oamInterstitial.interstitialConfig.endingText = const EndingText(
  'Sample Text',
  12,
  Colors.white,
  TextAlign.center,
  true,
);

_oamInterstitial.interstitialConfig.closeBtnMargin = const CloseBtnMargin(
  top: 10,
  left: 10,
  right: 10,
  bottom: 10,
);

_oamInterstitial.show();
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://one-admax-organization.gitbook.io/one-admax-sdk/05.-flutter-plugin-guide/interstitial.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
