yodo1maslite 0.0.1 copy "yodo1maslite: ^0.0.1" to clipboard
yodo1maslite: ^0.0.1 copied to clipboard

This Plugins is the lite version of Yodo1 MAS (Managed Ad Service) which you can integrate into your Flutter Project.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:yodo1maslite/yodo1maslite.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.Banner,
                  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'),
          ),

        ],
      ),

    );
  }
}
0
likes
130
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

This Plugins is the lite version of Yodo1 MAS (Managed Ad Service) which you can integrate into your Flutter Project.

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on yodo1maslite

Packages that implement yodo1maslite