Skip to content

Commit 269ce67

Browse files
committed
feat(ads): add placeholder ad widget for unsupported platforms
- Create a new widget that displays a generic placeholder for advertisements - Useful for maintaining UI consistency on platforms without native ad SDK support - Features an icon, title, and subtitle to indicate it's an ad placeholder
1 parent 6153de6 commit 269ce67

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:ui_kit/ui_kit.dart';
3+
4+
/// {@template placeholder_ad_widget}
5+
/// A widget that displays a generic placeholder for an advertisement.
6+
///
7+
/// This is used on platforms (like web) where actual native ad SDKs are not
8+
/// supported, but a visual representation of an ad slot is desired for UI
9+
/// consistency or demo purposes.
10+
/// {@endtemplate}
11+
class PlaceholderAdWidget extends StatelessWidget {
12+
/// {@macro placeholder_ad_widget}
13+
const PlaceholderAdWidget({super.key});
14+
15+
@override
16+
Widget build(BuildContext context) {
17+
final theme = Theme.of(context);
18+
return Container(
19+
padding: const EdgeInsets.all(AppSpacing.lg),
20+
decoration: BoxDecoration(
21+
color: theme.colorScheme.surfaceVariant,
22+
borderRadius: BorderRadius.circular(AppSpacing.md),
23+
border: Border.all(color: theme.colorScheme.outlineVariant),
24+
),
25+
child: Column(
26+
mainAxisAlignment: MainAxisAlignment.center,
27+
children: [
28+
Icon(
29+
Icons.ad_units,
30+
size: 48,
31+
color: theme.colorScheme.onSurfaceVariant,
32+
),
33+
const SizedBox(height: AppSpacing.md),
34+
Text(
35+
'Ad Placeholder',
36+
style: theme.textTheme.titleMedium?.copyWith(
37+
color: theme.colorScheme.onSurfaceVariant,
38+
),
39+
textAlign: TextAlign.center,
40+
),
41+
const SizedBox(height: AppSpacing.xs),
42+
Text(
43+
'Native ads are not supported on this platform.',
44+
style: theme.textTheme.bodySmall?.copyWith(
45+
color: theme.colorScheme.onSurfaceVariant.withOpacity(0.7),
46+
),
47+
textAlign: TextAlign.center,
48+
),
49+
],
50+
),
51+
);
52+
}
53+
}

0 commit comments

Comments
 (0)