File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 11import 'package:core/core.dart' ;
22import 'package:flutter/material.dart' ;
3- import 'package:go_router/go_router.dart' ;
43import 'package:ui_kit/ui_kit.dart' ;
4+ import 'package:url_launcher/url_launcher.dart' ; // Import url_launcher
55
66/// {@template local_interstitial_ad_dialog}
77/// A dialog widget that displays a [LocalInterstitialAd] .
@@ -36,10 +36,17 @@ class LocalInterstitialAdDialog extends StatelessWidget {
3636 Padding (
3737 padding: const EdgeInsets .all (AppSpacing .lg),
3838 child: InkWell (
39- onTap: () {
40- // Navigate to the target URL when the ad image is tapped.
41- // Using context.go to open external URL.
42- context.go (localInterstitialAd.targetUrl);
39+ onTap: () async {
40+ // Launch the target URL in an external browser.
41+ final uri = Uri .parse (localInterstitialAd.targetUrl);
42+ if (await canLaunchUrl (uri)) {
43+ await launchUrl (uri);
44+ } else {
45+ // Log an error or show a user-friendly message
46+ // if the URL cannot be launched.
47+ // For now, we'll just print to debug console.
48+ debugPrint ('Could not launch ${localInterstitialAd .targetUrl }' );
49+ }
4350 },
4451 child: Image .network (
4552 localInterstitialAd.imageUrl,
You can’t perform that action at this time.
0 commit comments