native_ads 0.5.0 copy "native_ads: ^0.5.0" to clipboard
native_ads: ^0.5.0 copied to clipboard

Flutter plugin for AdMob Native Ads. Compatible with Android and iOS using PlatformView.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:native_ads/native_ads.dart';
import 'package:native_ads_example/native_ad_view_wrapper.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  NativeAds.initialize();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('NativeAds example app'),
        ),
        body: Center(
          child: ListView.separated(
            itemBuilder: (BuildContext context, int index) {
              if (index % 10 == 0) {
                return Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: SizedBox(
                    width: double.infinity,
                    height: 400,
                    child: const NativeAdViewWrapper(),
                  ),
                );
              } else {
                return Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: Text(
                    'this is text $index',
                    style: Theme.of(context).textTheme.body1,
                  ),
                );
              }
            },
            itemCount: 50,
            separatorBuilder: (BuildContext context, _) => const Divider(),
          ),
        ),
      ),
    );
  }
}
42
likes
40
pub points
0%
popularity

Publisher

verified publishersakebook.dev

Flutter plugin for AdMob Native Ads. Compatible with Android and iOS using PlatformView.

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on native_ads