ad_gridview 0.0.4 copy "ad_gridview: ^0.0.4" to clipboard
ad_gridview: ^0.0.4 copied to clipboard

A flutter widget to easily show Native Ad or any other Widget in Between a GridView.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const Homepage(),
    );
  }
}

class Homepage extends StatefulWidget {
  const Homepage({super.key});

  @override
  State<Homepage> createState() => _HomepageState();
}

class _HomepageState extends State<Homepage> {
  List list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("AdGridView Homepage")),
      body: AdGridView(
        crossAxisCount: 4,
        itemCount: list.length,
        adIndex: 1,
        adGridViewType: AdGridViewType.once,
        itemMainAspectRatio: 1 / 1,
        adWidget: Container(
          height: 250,
          margin: const EdgeInsets.symmetric(horizontal: 5),
          color: Colors.blue,
          child: const Center(
              child: Text(
            "Native Ad",
            style: TextStyle(fontSize: 60),
          )),
        ),
        itemWidget: (context, index) {
          return Container(
            height: 150,
            width: 160,
            margin: const EdgeInsets.all(5),
            color: Colors.grey,
            child: Center(
              child: Text(
                "${list[index]}",
                style: const TextStyle(fontSize: 30),
              ),
            ),
          );
        },
      ),
    );
  }
}
21
likes
150
points
74
downloads

Publisher

unverified uploader

Weekly Downloads

A flutter widget to easily show Native Ad or any other Widget in Between a GridView.

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

flutter, flutter_staggered_grid_view

More

Packages that depend on ad_gridview