@@ -55,15 +55,8 @@ class _InAppNotificationCenterPageState
5555 Widget build (BuildContext context) {
5656 final l10n = AppLocalizationsX (context).l10n;
5757
58- return BlocProvider (
59- create: (context) => InAppNotificationCenterBloc (
60- inAppNotificationRepository: context
61- .read <DataRepository <InAppNotification >>(),
62- appBloc: context.read <AppBloc >(),
63- logger: context.read <Logger >(),
64- )..add (const InAppNotificationCenterSubscriptionRequested ()),
65- child: Scaffold (
66- appBar: AppBar (
58+ return Scaffold (
59+ appBar: AppBar (
6760 title: Text (l10n.notificationCenterPageTitle),
6861 actions: [
6962 BlocBuilder <
@@ -93,59 +86,57 @@ class _InAppNotificationCenterPageState
9386 ],
9487 ),
9588 ),
96- body:
97- BlocConsumer <
98- InAppNotificationCenterBloc ,
99- InAppNotificationCenterState
100- >(
101- listener: (context, state) {
102- if (state.status == InAppNotificationCenterStatus .failure &&
103- state.error != null ) {
104- ScaffoldMessenger .of (context)
105- ..hideCurrentSnackBar ()
106- ..showSnackBar (
107- SnackBar (
108- content: Text (state.error! .message),
109- backgroundColor: Theme .of (context).colorScheme.error,
110- ),
111- );
112- }
113- },
114- builder: (context, state) {
115- if (state.status == InAppNotificationCenterStatus .loading) {
116- return LoadingStateWidget (
117- icon: Icons .notifications_none_outlined,
118- headline: l10n.notificationCenterLoadingHeadline,
119- subheadline: l10n.notificationCenterLoadingSubheadline,
120- );
121- }
122-
123- if (state.status == InAppNotificationCenterStatus .failure) {
124- return FailureStateWidget (
125- exception:
126- state.error ??
127- OperationFailedException (
128- l10n.notificationCenterFailureHeadline,
129- ),
130- onRetry: () {
131- context.read <InAppNotificationCenterBloc >().add (
132- const InAppNotificationCenterSubscriptionRequested (),
133- );
134- },
135- );
136- }
137-
138- return TabBarView (
139- controller: _tabController,
140- children: [
141- _NotificationList (
142- notifications: state.breakingNewsNotifications,
143- ),
144- _NotificationList (notifications: state.digestNotifications),
145- ],
89+ body: BlocConsumer <
90+ InAppNotificationCenterBloc ,
91+ InAppNotificationCenterState
92+ >(
93+ listener: (context, state) {
94+ if (state.status == InAppNotificationCenterStatus .failure &&
95+ state.error != null ) {
96+ ScaffoldMessenger .of (context)
97+ ..hideCurrentSnackBar ()
98+ ..showSnackBar (
99+ SnackBar (
100+ content: Text (state.error! .message),
101+ backgroundColor: Theme .of (context).colorScheme.error,
102+ ),
103+ );
104+ }
105+ },
106+ builder: (context, state) {
107+ if (state.status == InAppNotificationCenterStatus .loading) {
108+ return LoadingStateWidget (
109+ icon: Icons .notifications_none_outlined,
110+ headline: l10n.notificationCenterLoadingHeadline,
111+ subheadline: l10n.notificationCenterLoadingSubheadline,
112+ );
113+ }
114+
115+ if (state.status == InAppNotificationCenterStatus .failure) {
116+ return FailureStateWidget (
117+ exception:
118+ state.error ??
119+ OperationFailedException (
120+ l10n.notificationCenterFailureHeadline,
121+ ),
122+ onRetry: () {
123+ context.read <InAppNotificationCenterBloc >().add (
124+ const InAppNotificationCenterSubscriptionRequested (),
146125 );
147126 },
148- ),
127+ );
128+ }
129+
130+ return TabBarView (
131+ controller: _tabController,
132+ children: [
133+ _NotificationList (
134+ notifications: state.breakingNewsNotifications,
135+ ),
136+ _NotificationList (notifications: state.digestNotifications),
137+ ],
138+ );
139+ },
149140 ),
150141 );
151142 }
0 commit comments