google_native_mobile_ads 1.0.3 copy "google_native_mobile_ads: ^1.0.3" to clipboard
google_native_mobile_ads: ^1.0.3 copied to clipboard

PlatformAndroid

This package helps in displaying native ads , it supports creating full screen and inline native ads with very minimal code required from android side.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'full_screen_ad.dart';
import 'inline_ad.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await MobileAds.instance.initialize();
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.indigo,
      ),
      home: const MainScreen(),
    );
  }
}

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

  @override
  State<MainScreen> createState() => _MainScreenState();
}

class _MainScreenState extends State<MainScreen> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Main screen'),
      ),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            ElevatedButton(
              child: const Text('Show inline native ad'),
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => const MediumSizeNativeAdScreen(),
                  ),
                );
              },
            ),
            ElevatedButton(
              child: const Text('Show Full screen native ad'),
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => const FullScreenNativeAdScreen(),
                  ),
                );
              },
            ),
          ],
        ),
      ),
    );
  }
}
10
likes
120
pub points
63%
popularity

Publisher

unverified uploader

This package helps in displaying native ads , it supports creating full screen and inline native ads with very minimal code required from android side.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, google_mobile_ads

More

Packages that depend on google_native_mobile_ads