smartlinks_ad 1.2.0 copy "smartlinks_ad: ^1.2.0" to clipboard
smartlinks_ad: ^1.2.0 copied to clipboard

A Flutter package for Linklytics SmartLinks Ads.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('SmartLinks Ad Example')),
        body: const AdExample(),
      ),
    );
  }
}

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

  @override
  State<AdExample> createState() => _AdExampleState();
}

class _AdExampleState extends State<AdExample> {
  final _adService = SmartLinksAd();
  bool _initialized = false;

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

  Future<void> _init() async {
    // Replace with your API Key
    await _adService.initialize('YOUR_API_KEY_HERE');
    setState(() {
      _initialized = true;
    });
  }

  @override
  Widget build(BuildContext context) {
    if (!_initialized) {
      return const Center(child: CircularProgressIndicator());
    }

    return Column(
      children: [
        const Text('Banner Ad Below:'),
        const SizedBox(height: 10),
        SmartLinkBannerAd(adService: _adService, height: 100),
        const Spacer(),
        const Text('End of screen'),
      ],
    );
  }
}
1
likes
0
points
143
downloads

Documentation

Documentation

Publisher

verified publisheralkashier.com

Weekly Downloads

A Flutter package for Linklytics SmartLinks Ads.

Repository (GitLab)
View/report issues

License

unknown (license)

Dependencies

cached_network_image, dio, flutter, shared_preferences, url_launcher

More

Packages that depend on smartlinks_ad