Skip to content

Commit b1e46e5

Browse files
committed
style: misc
1 parent b6205d1 commit b1e46e5

15 files changed

+104
-103
lines changed

lib/account/bloc/account_bloc.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
3838
.entityUpdated
3939
.where((type) => type == UserContentPreferences)
4040
.listen((_) {
41-
// If there's a current user, reload their preferences.
42-
if (state.user?.id != null) {
43-
add(AccountLoadUserPreferences(userId: state.user!.id));
44-
}
45-
});
41+
// If there's a current user, reload their preferences.
42+
if (state.user?.id != null) {
43+
add(AccountLoadUserPreferences(userId: state.user!.id));
44+
}
45+
});
4646

4747
// Register event handlers
4848
on<AccountUserChanged>(_onAccountUserChanged);

lib/ads/ad_service.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,11 @@ class AdService {
229229

230230
final adId = feedAd
231231
? (adType == AdType.native
232-
? platformAdIdentifiers.feedNativeAdId
233-
: platformAdIdentifiers.feedBannerAdId)
232+
? platformAdIdentifiers.feedNativeAdId
233+
: platformAdIdentifiers.feedBannerAdId)
234234
: (adType == AdType.native
235-
? platformAdIdentifiers.inArticleNativeAdId
236-
: platformAdIdentifiers.inArticleBannerAdId);
235+
? platformAdIdentifiers.inArticleNativeAdId
236+
: platformAdIdentifiers.inArticleBannerAdId);
237237

238238
if (adId == null || adId.isEmpty) {
239239
_logger.warning(

lib/ads/admob_ad_provider.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ class AdMobAdProvider implements AdProvider {
5757

5858
// Determine the template type based on the user's feed style preference.
5959
// Use largeThumbnail for a more prominent, square-like ad.
60-
final templateType =
61-
headlineImageStyle == HeadlineImageStyle.largeThumbnail
62-
? NativeAdTemplateType.medium
63-
: NativeAdTemplateType.small;
60+
final templateType = headlineImageStyle == HeadlineImageStyle.largeThumbnail
61+
? NativeAdTemplateType.medium
62+
: NativeAdTemplateType.small;
6463

6564
final completer = Completer<admob.NativeAd?>();
6665

lib/ads/local_ad_provider.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class LocalAdProvider implements AdProvider {
2121
LocalAdProvider({
2222
required DataRepository<LocalAd> localAdRepository,
2323
Logger? logger,
24-
}) : _localAdRepository = localAdRepository,
25-
_logger = logger ?? Logger('LocalAdProvider');
24+
}) : _localAdRepository = localAdRepository,
25+
_logger = logger ?? Logger('LocalAdProvider');
2626

2727
final DataRepository<LocalAd> _localAdRepository;
2828
final Logger _logger;
@@ -54,7 +54,9 @@ class LocalAdProvider implements AdProvider {
5454
final localNativeAd = await _localAdRepository.read(id: adId);
5555

5656
if (localNativeAd is LocalNativeAd) {
57-
_logger.info('Local native ad loaded successfully: ${localNativeAd.id}');
57+
_logger.info(
58+
'Local native ad loaded successfully: ${localNativeAd.id}',
59+
);
5860
return NativeAd(
5961
id: _uuid.v4(),
6062
provider: AdPlatformType.local,
@@ -101,7 +103,9 @@ class LocalAdProvider implements AdProvider {
101103
final localBannerAd = await _localAdRepository.read(id: adId);
102104

103105
if (localBannerAd is LocalBannerAd) {
104-
_logger.info('Local banner ad loaded successfully: ${localBannerAd.id}');
106+
_logger.info(
107+
'Local banner ad loaded successfully: ${localBannerAd.id}',
108+
);
105109
return BannerAd(
106110
id: _uuid.v4(),
107111
provider: AdPlatformType.local,

lib/ads/models/banner_ad.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ class BannerAd extends InlineAd {
2222

2323
/// Creates a copy of this [BannerAd] but with the given fields replaced with
2424
/// the new values.
25-
BannerAd copyWith({
26-
String? id,
27-
AdPlatformType? provider,
28-
Object? adObject,
29-
}) {
25+
BannerAd copyWith({String? id, AdPlatformType? provider, Object? adObject}) {
3026
return BannerAd(
3127
id: id ?? this.id,
3228
provider: provider ?? this.provider,

lib/ads/widgets/feed_ad_loader_widget.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import 'dart:async';
33
import 'package:core/core.dart';
44
import 'package:flutter/material.dart';
55
import 'package:flutter_bloc/flutter_bloc.dart';
6-
import 'package:flutter_news_app_mobile_client_full_source_code/ads/inline_ad_cache_service.dart';
76
import 'package:flutter_news_app_mobile_client_full_source_code/ads/ad_service.dart';
7+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/inline_ad_cache_service.dart';
88
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_placeholder.dart';
99
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_theme_style.dart';
1010
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/banner_ad.dart';

lib/ads/widgets/in_article_ad_loader_widget.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import 'dart:async';
33
import 'package:core/core.dart';
44
import 'package:flutter/material.dart';
55
import 'package:flutter_bloc/flutter_bloc.dart';
6-
import 'package:flutter_news_app_mobile_client_full_source_code/ads/inline_ad_cache_service.dart';
76
import 'package:flutter_news_app_mobile_client_full_source_code/ads/ad_service.dart';
7+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/inline_ad_cache_service.dart';
88
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_theme_style.dart';
99
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/banner_ad.dart';
1010
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/inline_ad.dart';

lib/ads/widgets/local_banner_ad_widget.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ class LocalBannerAdWidget extends StatelessWidget {
2525

2626
// Determine the height based on the headlineImageStyle.
2727
// If largeThumbnail, use a square aspect ratio, otherwise a standard banner height.
28-
final double imageHeight =
29-
headlineImageStyle == HeadlineImageStyle.largeThumbnail ? 250 : 90;
28+
final imageHeight = headlineImageStyle == HeadlineImageStyle.largeThumbnail
29+
? 250
30+
: 90;
3031

3132
return Card(
3233
margin: const EdgeInsets.symmetric(
@@ -48,7 +49,7 @@ class LocalBannerAdWidget extends StatelessWidget {
4849
Image.network(
4950
localBannerAd.imageUrl,
5051
fit: BoxFit.cover,
51-
height: imageHeight,
52+
height: imageHeight.toDouble(),
5253
width: double.infinity,
5354
errorBuilder: (context, error, stackTrace) =>
5455
const SizedBox.shrink(),

lib/ads/widgets/local_interstitial_ad_dialog.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,7 @@ class LocalInterstitialAdDialog extends StatelessWidget {
7373
top: AppSpacing.lg,
7474
right: AppSpacing.lg,
7575
child: IconButton(
76-
icon: Icon(
77-
Icons.close,
78-
color: theme.colorScheme.onSurface,
79-
),
76+
icon: Icon(Icons.close, color: theme.colorScheme.onSurface),
8077
onPressed: () {
8178
// Dismiss the dialog.
8279
Navigator.of(context).pop();

lib/ads/widgets/local_native_ad_widget.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ class LocalNativeAdWidget extends StatelessWidget {
2525

2626
// Determine the height based on the headlineImageStyle.
2727
// If largeThumbnail, use a square aspect ratio, otherwise a standard native ad height.
28-
final double imageHeight =
29-
headlineImageStyle == HeadlineImageStyle.largeThumbnail ? 250 : 180;
28+
final imageHeight = headlineImageStyle == HeadlineImageStyle.largeThumbnail
29+
? 250
30+
: 180;
3031

3132
return Card(
3233
margin: const EdgeInsets.symmetric(
@@ -44,7 +45,7 @@ class LocalNativeAdWidget extends StatelessWidget {
4445
child: Image.network(
4546
localNativeAd.imageUrl,
4647
fit: BoxFit.cover,
47-
height: imageHeight,
48+
height: imageHeight.toDouble(),
4849
width: double.infinity,
4950
errorBuilder: (context, error, stackTrace) =>
5051
const SizedBox.shrink(),
@@ -72,7 +73,9 @@ class LocalNativeAdWidget extends StatelessWidget {
7273
onPressed: () {
7374
// TODO(fulleni): Implement navigation to localNativeAd.targetUrl
7475
// For now, just log the action.
75-
debugPrint('Local Native Ad clicked: ${localNativeAd.targetUrl}');
76+
debugPrint(
77+
'Local Native Ad clicked: ${localNativeAd.targetUrl}',
78+
);
7679
},
7780
child: const Text('Learn More'),
7881
),

0 commit comments

Comments
 (0)