import 'package:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; // ── Adsterra banner codes ──────────────────────────────────────────── // 320×50 — standard mobile banner, used at bottom of screens const String _kBanner320x50 = ''' '''; /// A small 320×50 banner that loads natively inside the app. /// Place at the bottom of screens. class NativeAdBanner extends StatelessWidget { final double height; final String? customCode; const NativeAdBanner({super.key, this.height = 60, this.customCode}); String get _html { final code = customCode ?? _kBanner320x50; return '''
$code '''; } @override Widget build(BuildContext context) { return Container( // Subtle native look — barely visible border, no "AD" label decoration: BoxDecoration( color: Colors.transparent, border: Border( top: BorderSide(color: Colors.grey.withValues(alpha: 0.08)), ), ), child: SizedBox( height: height, child: InAppWebView( initialSettings: InAppWebViewSettings( javaScriptEnabled: true, domStorageEnabled: true, transparentBackground: true, cacheEnabled: false, safeBrowsingEnabled: false, useHybridComposition: true, ), onWebViewCreated: (c) async { await c.loadData( data: _html, mimeType: 'text/html', encoding: 'utf-8', baseUrl: WebUri('https://adsterra.com'), ); }, ), ), ); } }