# adsjmsdk

This project is a starting point for a Flutter
[plug-in package](https://flutter.dev/developing-packages/),
a specialized package that includes platform-specific implementation code for
Android and/or iOS.

## 详细接入文档：
+ [Android 接入文档](http://sdk.hzsanjiaomao.com/sdkdoc/0-SDK-HTML1/md/flutter/Android_flutter.html)
+ [iOS 接入文档](http://sdk.hzsanjiaomao.com/sdk/iOS/iOS%E6%96%87%E6%A1%A3/SJMSDK_Flutter_%E6%96%87%E6%A1%A3.html)

## Initialization SDK
```
MaoAdSdk.init("AppId");
```

## Examples：

### Splash Ad
```
SplashAdView(
    adId: "adId",
    width: width,
    height: height,
    onMaoAdLoaded: (String id) {
        print("SplashAd onMaoAdLoaded");
    },
    onMaoAdShow: (String id) {
        print("SplashAd onMaoAdShow");
    },
    onMaoAdClicked: (String id) {
        print("SplashAd onMaoAdClicked");
    },
    onMaoAdClosed: (String id) {
        print("SplashAd onMaoAdClosed");
    },
    onMaoAdError: (String id, int code, String message) {
        print("SplashAd onMaoAdError");
    }
)
```


### Reward Video Ad
```
MaoAdSdk.showRewardVideoAd(
    "adId",
    "userId",
    onMaoAdTradeId:(String id){
        print("RewardVideoAd onMaoAdTradeId");
    },
    onMaoAdLoaded: (String id) {
        print("RewardVideoAd onMaoAdLoad");
    },
    onMaoAdShow: (String id) {
        print("RewardVideoAd onMaoAdShow");
    },
    onMaoAdReward: (String id) {
        print("RewardVideoAd onReward");
    },
    onMaoAdClicked: (String id) {
        print("RewardVideoAd onMaoAdClick");
    },
    onMaoAdVideoComplete: (String id) {
        print("RewardVideoAd onVideoComplete");
    },
    onMaoAdClosed: (String id) {
        print("RewardVideoAd onMaoAdClose");
    },
    onMaoAdError: (String id, int code, String message) {
        print("RewardVideoAd onMaoAdError");
    },
);
```
### Interstital Ad

```
MaoAdSdk.loadInterstitalAd(
    "adId",
    onMaoAdLoaded: (String id) {
        print("InterstitalAd onMaoAdLoad");
    },
    onMaoAdShow: (String id) {
        print("InterstitalAd onMaoAdShow");
    },
    onMaoAdClicked: (String id) {
        print("InterstitalAd onMaoAdClick");
    },
    onMaoAdClosed: (String id) {
        print("InterstitalAd onMaoAdClose");
    },
    onMaoAdError: (String id, int code, String message) {
        print("InterstitalAd onMaoAdError");
    },
);
```


### Native Express Ad 

```
NativeExpressAdView(
    adId:  "adId",
    width: 350,
    height: 300,
    onMaoAdLoaded: (String id) {
        print("native_express onMaoAdLoad");
    },
    onMaoAdShow: (String id) {
        print("native_express onMaoAdShow");
    },
    onMaoAdClicked: (String id) {
        print("native_express onMaoAdClick");
    },
    onMaoAdClosed: (String id) {
        print("native_express onMaoAdClose");
    },
    onMaoAdError: (String id, int code, String message) {
        print("native_express onError");
    },
)
```

### Banner Ad

```
BannerAdView(
    adId: "adId",
    width: 400,
    height: 60,
    onMaoAdLoaded: (String id) {
        print("BannerAd onMaoAdLoad");
    },
    onMaoAdShow: (String id) {
        print("BannerAd onMaoAdShow");
    },
    onMaoAdClicked: (String id) {
        print("BannerAd onMaoAdClick");
    },
    onMaoAdClosed: (String id) {
        print("BannerAd onMaoAdClose");
    },
    onMaoAdError: (String id, int code, String message) {
        print("BannerAd onError");
    },
)
```

