Skip to content

Commit 5c73809

Browse files
committed
style: misc
1 parent 83d0f3f commit 5c73809

File tree

9 files changed

+32
-40
lines changed

9 files changed

+32
-40
lines changed

lib/src/models/feed/ad.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import 'package:ht_shared/src/models/feed/ad_placement.dart';
22
import 'package:ht_shared/src/models/feed/feed_item.dart';
3-
import 'package:json_annotation/json_annotation.dart';
4-
import 'package:uuid/uuid.dart';
5-
63
import 'package:ht_shared/src/models/feed/feed_item_action.dart'
74
show FeedItemAction, feedItemActionFromJson, feedItemActionToJson;
5+
import 'package:json_annotation/json_annotation.dart';
6+
import 'package:uuid/uuid.dart';
87

98
part 'ad.g.dart';
109

@@ -36,9 +35,8 @@ class Ad extends FeedItem {
3635
required this.imageUrl,
3736
required this.targetUrl,
3837
required this.adType,
39-
this.placement,
38+
required super.action, // Add action to constructor, this.placement,
4039
String? id,
41-
required super.action, // Add action to constructor
4240
}) : id = id ?? const Uuid().v4(),
4341
super(type: 'ad');
4442

lib/src/models/feed/engagement_content.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import 'package:ht_shared/src/models/feed/engagement_content_type.dart';
22
import 'package:ht_shared/src/models/feed/feed_item.dart';
3-
import 'package:json_annotation/json_annotation.dart';
4-
import 'package:uuid/uuid.dart';
5-
63
import 'package:ht_shared/src/models/feed/feed_item_action.dart'
74
show FeedItemAction, feedItemActionFromJson, feedItemActionToJson;
5+
import 'package:json_annotation/json_annotation.dart';
6+
import 'package:uuid/uuid.dart';
87

98
part 'engagement_content.g.dart';
109

@@ -21,11 +20,10 @@ class EngagementContent extends FeedItem {
2120
EngagementContent({
2221
required this.title,
2322
required this.engagementContentType,
24-
this.description,
23+
required super.action, // Add action to constructor, this.description,
2524
this.callToActionText,
2625
this.callToActionUrl,
2726
String? id,
28-
required super.action, // Add action to constructor
2927
}) : id = id ?? const Uuid().v4(),
3028
super(type: 'engagement_content');
3129

lib/src/models/feed/feed_item_action.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
import 'package:ht_shared/ht_shared.dart' show FeedItem;
12
import 'package:ht_shared/src/models/content_type.dart';
3+
import 'package:ht_shared/src/models/feed/feed.dart' show FeedItem;
4+
import 'package:ht_shared/src/models/feed/feed_item.dart' show FeedItem;
5+
import 'package:ht_shared/src/models/models.dart' show FeedItem;
26
import 'package:json_annotation/json_annotation.dart';
37

48
part 'feed_item_action.g.dart';
@@ -90,8 +94,7 @@ class ShowInterstitialThenOpenInternalContent extends FeedItemAction {
9094
/// instance from a JSON map.
9195
factory ShowInterstitialThenOpenInternalContent.fromJson(
9296
Map<String, dynamic> json,
93-
) =>
94-
_$ShowInterstitialThenOpenInternalContentFromJson(json);
97+
) => _$ShowInterstitialThenOpenInternalContentFromJson(json);
9598

9699
/// The unique identifier of the internal content to open after the interstitial.
97100
final String contentId;

lib/src/models/feed/suggested_content.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
import 'package:ht_shared/ht_shared.dart' show Category, Country, Headline, Source;
12
import 'package:ht_shared/src/models/feed/feed_item.dart';
3+
import 'package:ht_shared/src/models/feed/feed_item_action.dart'
4+
show FeedItemAction, feedItemActionFromJson, feedItemActionToJson;
25
import 'package:ht_shared/src/models/feed/suggested_content_display_type.dart';
6+
import 'package:ht_shared/src/models/models.dart' show Category, Country, Headline, Source;
7+
import 'package:ht_shared/src/models/news/news.dart' show Category, Country, Headline, Source;
38
import 'package:json_annotation/json_annotation.dart';
49
import 'package:uuid/uuid.dart';
510

6-
import 'package:ht_shared/src/models/feed/feed_item_action.dart'
7-
show FeedItemAction, feedItemActionFromJson, feedItemActionToJson;
8-
911
part 'suggested_content.g.dart';
1012

1113
/// {@template suggested_content}
@@ -22,10 +24,9 @@ class SuggestedContent extends FeedItem {
2224
SuggestedContent({
2325
required this.displayType,
2426
required this.items,
25-
this.title,
27+
required super.action, // Add action to constructor, this.title,
2628
this.description,
2729
String? id,
28-
required super.action, // Add action to constructor
2930
}) : id = id ?? const Uuid().v4(),
3031
super(type: 'suggested_content');
3132

lib/src/models/feed/suggested_content_display_type.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import 'package:ht_shared/ht_shared.dart' show SuggestedContent;
2+
import 'package:ht_shared/src/models/feed/feed.dart' show SuggestedContent;
3+
import 'package:ht_shared/src/models/feed/suggested_content.dart' show SuggestedContent;
4+
import 'package:ht_shared/src/models/models.dart' show SuggestedContent;
15
import 'package:json_annotation/json_annotation.dart';
26

37
/// {@template suggested_content_display_type}

lib/src/models/news/category.dart

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ class Category extends FeedItem {
2121
/// If an [id] is not provided, a UUID v4 will be generated.
2222
Category({
2323
required this.name,
24-
String? id,
24+
required super.action, // Add action to constructor, String? id,
2525
this.description,
2626
this.iconUrl,
27-
required super.action, // Add action to constructor
2827
}) : id = id ?? const Uuid().v4(),
2928
super(type: 'category');
3029

@@ -56,14 +55,7 @@ class Category extends FeedItem {
5655
Map<String, dynamic> toJson() => _$CategoryToJson(this);
5756

5857
@override
59-
List<Object?> get props => [
60-
id,
61-
name,
62-
description,
63-
iconUrl,
64-
type,
65-
action,
66-
];
58+
List<Object?> get props => [id, name, description, iconUrl, type, action];
6759

6860
@override
6961
bool get stringify => true;

lib/src/models/news/country.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import 'package:ht_shared/src/models/feed/feed_item.dart';
2-
import 'package:json_annotation/json_annotation.dart';
3-
import 'package:uuid/uuid.dart';
4-
52
import 'package:ht_shared/src/models/feed/feed_item_action.dart'
63
show FeedItemAction, feedItemActionFromJson, feedItemActionToJson;
4+
import 'package:json_annotation/json_annotation.dart';
5+
import 'package:uuid/uuid.dart';
76

87
part 'country.g.dart';
98

@@ -20,13 +19,13 @@ class Country extends FeedItem {
2019
required this.isoCode,
2120
required this.name,
2221
required this.flagUrl,
23-
String? id,
24-
required super.action, // Add action to constructor
22+
required super.action, // Add action to constructor, String? id,
2523
}) : id = id ?? const Uuid().v4(),
2624
super(type: 'country');
2725

2826
/// Creates a Country instance from a JSON map.
29-
factory Country.fromJson(Map<String, dynamic> json) => _$CountryFromJson(json);
27+
factory Country.fromJson(Map<String, dynamic> json) =>
28+
_$CountryFromJson(json);
3029

3130
/// A unique identifier for the country instance, typically a UUID.
3231
final String id;

lib/src/models/news/headline.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@ class Headline extends FeedItem {
2626
/// {@macro headline}
2727
Headline({
2828
required this.title,
29-
this.description,
29+
required super.action, // Add action to constructor, this.description,
3030
this.url,
3131
this.imageUrl,
3232
this.publishedAt,
3333
this.source,
3434
this.category,
3535
String? id,
36-
required super.action, // Add action to constructor
3736
}) : assert(
3837
id == null || id.isNotEmpty,
3938
'id cannot be an empty string', // Updated assertion message

lib/src/models/news/source.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import 'package:ht_shared/src/models/feed/feed_item.dart';
2+
import 'package:ht_shared/src/models/feed/feed_item_action.dart'
3+
show FeedItemAction, feedItemActionFromJson, feedItemActionToJson;
24
import 'package:ht_shared/src/models/feed/source_type.dart';
35
import 'package:ht_shared/src/models/news/country.dart';
46
import 'package:json_annotation/json_annotation.dart';
57
import 'package:uuid/uuid.dart';
68

7-
import 'package:ht_shared/src/models/feed/feed_item_action.dart'
8-
show FeedItemAction, feedItemActionFromJson, feedItemActionToJson;
9-
109
part 'source.g.dart';
1110

1211
/// {@template source}
@@ -19,13 +18,12 @@ class Source extends FeedItem {
1918
/// {@macro source}
2019
Source({
2120
required this.name,
22-
this.description,
21+
required super.action, // Add action to constructor, this.description,
2322
this.url,
2423
SourceType? sourceType, // Renamed to avoid conflict with FeedItem.type
2524
this.language,
2625
this.headquarters,
2726
String? id,
28-
required super.action, // Add action to constructor
2927
}) : id = id ?? const Uuid().v4(),
3028
_sourceType = sourceType,
3129
super(type: 'source');

0 commit comments

Comments
 (0)