Skip to content

Commit bbf3765

Browse files
committed
feat(l10n): add extension for localized banner ad shape names
- Create new extension on BannerAdShape to provide localized string representations - Add l10n method to return localized name based on context and shape type - Implement switch case for different banner ad shapes (square and rectangle)
1 parent c452aae commit bbf3765

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import 'package:core/core.dart';
2+
import 'package:flutter/widgets.dart';
3+
import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart';
4+
5+
/// {@template banner_ad_shape_l10n}
6+
/// Extension on [BannerAdShape] to provide localized string representations.
7+
/// {@endtemplate}
8+
extension BannerAdShapeL10n on BannerAdShape {
9+
/// Returns the localized name for a [BannerAdShape].
10+
String l10n(BuildContext context) {
11+
final l10n = context.l10n;
12+
switch (this) {
13+
case BannerAdShape.square:
14+
return l10n.bannerAdShapeSquare;
15+
case BannerAdShape.rectangle:
16+
return l10n.bannerAdShapeRectangle;
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)