yodo1mas 0.0.2 copy "yodo1mas: ^0.0.2" to clipboard
yodo1mas: ^0.0.2 copied to clipboard

outdated

Yodo1 MAS (Managed Ad Service) Flutter Plugin.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:testmasfluttersdktwo/testmasfluttersdktwo.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  @override
  void initState() {
    super.initState();
    Yodo1MAS.instance.init("MRGhsxAuLgJ", false,(successful) {

    });
    //Yodo1MAS.instance.showBannerAd();
    initPlatformState();
    //Yodo1MAS.instance.showBannerAd();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    //Yodo1MAS.instance.showBannerAd();
    // Platform messages may fail, so we use a try/catch PlatformException.
    // We also handle the message potentially returning null.


    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;


  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Unity Ads Example'),
        ),
        body: const SafeArea(
          child: YodoAdsExample(),
        ),
      ),
    );
  }
}

class YodoAdsExample extends StatefulWidget {
  const YodoAdsExample({Key? key}) : super(key: key);

  @override
  _YodoAdsExampleState createState() => _YodoAdsExampleState();
}

class _YodoAdsExampleState extends State<YodoAdsExample> {
  bool _showBanner = false;

  @override
  void initState() {
    super.initState();
  }



  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: double.infinity,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              if (_showBanner)

                Yodo1MASBannerAd(
                  size: BannerSize.IABMediumRectangle,
                  onLoad: () => print('Banner loaded:'),
                  onOpen: () => print('Banner clicked:'),
                  onClosed: () => print('Banner clicked:'),
                  onLoadFailed: (message) =>
                      print('Banner Ad $message'),
                  onOpenFailed: (message) =>
                      print('Banner Ad $message'),
                ),
            ],
          ),
          ElevatedButton(
            onPressed: () {
              setState(() {
                _showBanner = !_showBanner;
              });
            },
            child: Text(_showBanner ? 'Hide Banner' : 'Show Banner'),
          ),

        ],
      ),

    );
  }
}
4
likes
0
points
6
downloads

Publisher

unverified uploader

Weekly Downloads

Yodo1 MAS (Managed Ad Service) Flutter Plugin.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on yodo1mas

Packages that implement yodo1mas