@@ -42,36 +42,7 @@ class EntityDetailsPage extends StatelessWidget {
4242
4343 @override
4444 Widget build (BuildContext context) {
45- return BlocProvider <EntityDetailsBloc >(
46- // Explicitly type BlocProvider
47- create: (context) {
48- final topicsRepository = context.read <DataRepository <Topic >>();
49- final sourcesRepository = context.read <DataRepository <Source >>();
50- final countriesRepository = context.read <DataRepository <Country >>();
51- final feedDecoratorService = FeedDecoratorService (
52- topicsRepository: topicsRepository,
53- sourcesRepository: sourcesRepository,
54- );
55- final entityDetailsBloc =
56- EntityDetailsBloc (
57- headlinesRepository: context.read <DataRepository <Headline >>(),
58- topicRepository: topicsRepository,
59- sourceRepository: sourcesRepository,
60- countryRepository: countriesRepository,
61- accountBloc: context.read <AccountBloc >(),
62- appBloc: context.read <AppBloc >(),
63- feedDecoratorService: feedDecoratorService,
64- )..add (
65- EntityDetailsLoadRequested (
66- entityId: args.entityId,
67- contentType: args.contentType,
68- adThemeStyle: AdThemeStyle .fromTheme (Theme .of (context)),
69- ),
70- );
71- return entityDetailsBloc;
72- },
73- child: EntityDetailsView (args: args),
74- );
45+ return EntityDetailsView (args: args);
7546 }
7647}
7748
@@ -104,10 +75,10 @@ class _EntityDetailsViewState extends State<EntityDetailsView> {
10475 void _onScroll () {
10576 if (_isBottom) {
10677 context.read <EntityDetailsBloc >().add (
107- EntityDetailsLoadMoreHeadlinesRequested (
108- adThemeStyle: AdThemeStyle .fromTheme (Theme .of (context)),
109- ),
110- );
78+ EntityDetailsLoadMoreHeadlinesRequested (
79+ adThemeStyle: AdThemeStyle .fromTheme (Theme .of (context)),
80+ ),
81+ );
11182 }
11283 }
11384
@@ -167,12 +138,12 @@ class _EntityDetailsViewState extends State<EntityDetailsView> {
167138 return FailureStateWidget (
168139 exception: state.exception! ,
169140 onRetry: () => context.read <EntityDetailsBloc >().add (
170- EntityDetailsLoadRequested (
171- entityId: widget.args.entityId,
172- contentType: widget.args.contentType,
173- adThemeStyle: AdThemeStyle .fromTheme (theme),
174- ),
175- ),
141+ EntityDetailsLoadRequested (
142+ entityId: widget.args.entityId,
143+ contentType: widget.args.contentType,
144+ adThemeStyle: AdThemeStyle .fromTheme (theme),
145+ ),
146+ ),
176147 );
177148 }
178149
@@ -198,11 +169,11 @@ class _EntityDetailsViewState extends State<EntityDetailsView> {
198169 final description = state.entity is Topic
199170 ? (state.entity! as Topic ).description
200171 : state.entity is Source
201- ? (state.entity! as Source ).description
202- : state.entity is Country
203- ? (state.entity! as Country )
204- .name // Using name as description for country
205- : null ;
172+ ? (state.entity! as Source ).description
173+ : state.entity is Country
174+ ? (state.entity! as Country )
175+ .name // Using name as description for country
176+ : null ;
206177
207178 final followButton = IconButton (
208179 icon: Icon (
@@ -214,16 +185,16 @@ class _EntityDetailsViewState extends State<EntityDetailsView> {
214185 : l10n.followButtonLabel,
215186 onPressed: () {
216187 context.read <EntityDetailsBloc >().add (
217- const EntityDetailsToggleFollowRequested (),
218- );
188+ const EntityDetailsToggleFollowRequested (),
189+ );
219190 },
220191 );
221192
222193 final entityIconUrl = (state.entity is Topic )
223194 ? (state.entity! as Topic ).iconUrl
224195 : (state.entity is Country )
225- ? (state.entity! as Country ).flagUrl
226- : null ;
196+ ? (state.entity! as Country ).flagUrl
197+ : null ;
227198
228199 final Widget appBarTitleWidget = Row (
229200 mainAxisSize: MainAxisSize .min,
@@ -330,8 +301,7 @@ class _EntityDetailsViewState extends State<EntityDetailsView> {
330301 horizontal: AppSpacing .paddingMedium,
331302 ),
332303 sliver: SliverList .separated (
333- itemCount:
334- state.feedItems.length +
304+ itemCount: state.feedItems.length +
335305 (state.hasMoreHeadlines &&
336306 state.status == EntityDetailsStatus .loadingMore
337307 ? 1
0 commit comments