@@ -36,8 +36,8 @@ class _InAppNotificationCenterPageState
3636 ..addListener (() {
3737 if (! _tabController.indexIsChanging) {
3838 context.read <InAppNotificationCenterBloc >().add (
39- InAppNotificationCenterTabChanged (_tabController.index),
40- );
39+ InAppNotificationCenterTabChanged (_tabController.index),
40+ );
4141 }
4242 });
4343 }
@@ -56,16 +56,18 @@ class _InAppNotificationCenterPageState
5656 appBar: AppBar (
5757 title: Text (l10n.notificationCenterPageTitle),
5858 actions: [
59- BlocBuilder <InAppNotificationCenterBloc ,
60- InAppNotificationCenterState >(
59+ BlocBuilder <
60+ InAppNotificationCenterBloc ,
61+ InAppNotificationCenterState
62+ >(
6163 builder: (context, state) {
6264 final hasUnread = state.notifications.any ((n) => ! n.isRead);
6365 return IconButton (
6466 onPressed: hasUnread
6567 ? () {
6668 context.read <InAppNotificationCenterBloc >().add (
67- const InAppNotificationCenterMarkAllAsRead (),
68- );
69+ const InAppNotificationCenterMarkAllAsRead (),
70+ );
6971 }
7072 : null ,
7173 icon: const Icon (Icons .done_all),
@@ -81,65 +83,69 @@ class _InAppNotificationCenterPageState
8183 ],
8284 ),
8385 ),
84- body: BlocConsumer <InAppNotificationCenterBloc ,
85- InAppNotificationCenterState >(
86- listener: (context, state) {
87- if (state.status == InAppNotificationCenterStatus .failure &&
88- state.error != null ) {
89- ScaffoldMessenger .of (context)
90- ..hideCurrentSnackBar ()
91- ..showSnackBar (
92- SnackBar (
93- content: Text (state.error! .message),
94- backgroundColor: Theme .of (context).colorScheme.error,
95- ),
96- );
97- }
98- },
99- builder: (context, state) {
100- if (state.status == InAppNotificationCenterStatus .loading &&
101- state.breakingNewsNotifications.isEmpty &&
102- state.digestNotifications.isEmpty) {
103- return LoadingStateWidget (
104- icon: Icons .notifications_none_outlined,
105- headline: l10n.notificationCenterLoadingHeadline,
106- subheadline: l10n.notificationCenterLoadingSubheadline,
107- );
108- }
86+ body:
87+ BlocConsumer <
88+ InAppNotificationCenterBloc ,
89+ InAppNotificationCenterState
90+ >(
91+ listener: (context, state) {
92+ if (state.status == InAppNotificationCenterStatus .failure &&
93+ state.error != null ) {
94+ ScaffoldMessenger .of (context)
95+ ..hideCurrentSnackBar ()
96+ ..showSnackBar (
97+ SnackBar (
98+ content: Text (state.error! .message),
99+ backgroundColor: Theme .of (context).colorScheme.error,
100+ ),
101+ );
102+ }
103+ },
104+ builder: (context, state) {
105+ if (state.status == InAppNotificationCenterStatus .loading &&
106+ state.breakingNewsNotifications.isEmpty &&
107+ state.digestNotifications.isEmpty) {
108+ return LoadingStateWidget (
109+ icon: Icons .notifications_none_outlined,
110+ headline: l10n.notificationCenterLoadingHeadline,
111+ subheadline: l10n.notificationCenterLoadingSubheadline,
112+ );
113+ }
109114
110- if (state.status == InAppNotificationCenterStatus .failure &&
111- state.breakingNewsNotifications.isEmpty &&
112- state.digestNotifications.isEmpty) {
113- return FailureStateWidget (
114- exception: state.error ??
115- OperationFailedException (
116- l10n.notificationCenterFailureHeadline,
117- ),
118- onRetry: () {
119- context.read <InAppNotificationCenterBloc >().add (
115+ if (state.status == InAppNotificationCenterStatus .failure &&
116+ state.breakingNewsNotifications.isEmpty &&
117+ state.digestNotifications.isEmpty) {
118+ return FailureStateWidget (
119+ exception:
120+ state.error ??
121+ OperationFailedException (
122+ l10n.notificationCenterFailureHeadline,
123+ ),
124+ onRetry: () {
125+ context.read <InAppNotificationCenterBloc >().add (
120126 const InAppNotificationCenterSubscriptionRequested (),
121127 );
122- },
123- );
124- }
128+ },
129+ );
130+ }
125131
126- return TabBarView (
127- controller: _tabController,
128- children: [
129- _NotificationList (
130- status: state.status,
131- notifications: state.breakingNewsNotifications,
132- hasMore: state.breakingNewsHasMore,
133- ),
134- _NotificationList (
135- status: state.status,
136- notifications: state.digestNotifications,
137- hasMore: state.digestHasMore,
138- ),
139- ],
140- );
141- },
142- ),
132+ return TabBarView (
133+ controller: _tabController,
134+ children: [
135+ _NotificationList (
136+ status: state.status,
137+ notifications: state.breakingNewsNotifications,
138+ hasMore: state.breakingNewsHasMore,
139+ ),
140+ _NotificationList (
141+ status: state.status,
142+ notifications: state.digestNotifications,
143+ hasMore: state.digestHasMore,
144+ ),
145+ ],
146+ );
147+ },
148+ ),
143149 );
144150 }
145151}
@@ -216,12 +222,8 @@ class _NotificationListState extends State<_NotificationList> {
216222 if (index >= widget.notifications.length) {
217223 return widget.status == InAppNotificationCenterStatus .loadingMore
218224 ? const Padding (
219- padding: EdgeInsets .symmetric (
220- vertical: AppSpacing .lg,
221- ),
222- child: Center (
223- child: CircularProgressIndicator (),
224- ),
225+ padding: EdgeInsets .symmetric (vertical: AppSpacing .lg),
226+ child: Center (child: CircularProgressIndicator ()),
225227 )
226228 : const SizedBox .shrink ();
227229 }
@@ -230,8 +232,8 @@ class _NotificationListState extends State<_NotificationList> {
230232 notification: notification,
231233 onTap: () async {
232234 context.read <InAppNotificationCenterBloc >().add (
233- InAppNotificationCenterMarkedAsRead (notification.id),
234- );
235+ InAppNotificationCenterMarkedAsRead (notification.id),
236+ );
235237
236238 final payload = notification.payload;
237239 final contentType = payload.data['contentType' ] as String ? ;
0 commit comments