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

A Flutter package for Linklytics SmartLinks Ads.

smartlinks_ad #

A Flutter package for integrating Linklytics SmartLinks Ads into your mobile applications. This package provides easy-to-use widgets for displaying Banner, Interstitial, and Native ads powered by the Linklytics ad network.

Features #

  • Banner Ads: Configurable banner widgets linked to SmartLinks.
  • Interstitial Ads: Full-screen ads with frequency capping.
  • Native Ads: Builder-pattern widgets for completely custom UI.
  • Smart Logic: Frequency capping and scheduling support.
  • Analytics: Built-in tracking for impressions and clicks.

Installation #

Add smartlinks_ad to your pubspec.yaml:

dependencies:
  smartlinks_ad:
    git:
      url: https://gitlab.com/elmansoryanas/smartlinks_ad.git
      ref: main

Usage #

1. Initialize the SDK #

Initialize the service with your API Key in your main.dart or before using any ad widgets.

import 'package:smartlinks_ad/smartlinks_ad.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  // Initialize the ad service
  final adService = SmartLinksAd();
  await adService.initialize('YOUR_API_KEY');

  runApp(MyApp());
}

Note: You can obtain the API Key from the Linklytics Dashboard (Profile Settings -> API Keys).

2. Banner Ad #

Display a banner ad anywhere in your widget tree.

SmartLinkBannerAd(
  adService: adService,
  height: 100, // Optional: override default height for the selected banner size
  fit: BoxFit.cover, // Optional: default is BoxFit.cover
)

3. Interstitial Ad #

Interstitial ads are full-screen ads that cover the interface of their host app.

// Create an instance
final interstitial = SmartLinkInterstitialAd(adService: adService);

// Load the ad
await interstitial.load();

// Check if loaded and show
if (interstitial.isLoaded) {
  interstitial.show(context, onDismissed: () {
    print('Ad dismissed');
  });
}

4. Native Ad #

Native ads allow you to customize the look and feel of the ads to match your app's design.

SmartLinkNativeAd(
  adService: adService,
  builder: (context, ad) {
    return Container(
      padding: EdgeInsets.all(12),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(8),
        boxShadow: [BoxShadow(blurRadius: 4, color: Colors.black12)],
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text(ad.name, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16)),
          SizedBox(height: 8),
          if (ad.config['image_url'] != null)
            ClipRRect(
              borderRadius: BorderRadius.circular(4),
              child: Image.network(ad.config['image_url'], height: 150, width: double.infinity, fit: BoxFit.cover),
            ),
          SizedBox(height: 8),
          Text(ad.config['description'] ?? '', style: TextStyle(fontSize: 14)),
          SizedBox(height: 8),
          ElevatedButton(
            onPressed: () => ad.handleClick(context), // Handle click tracking and navigation
            child: Text(ad.config['cta_text'] ?? 'Learn More'),
          ),
        ],
      ),
    );
  },
)

Requirements #

  • Flutter >=3.3.0
  • Dart >=3.0.0

License #

MIT

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