Skip to content

Commit 933873d

Browse files
authored
Merge pull request #252 from kareemabdeen/fix/discover-posts-view-stuck-loading-no-user-feedback-mobile-web
Removed the indefinite loading state when there are no posts ✅
2 parents 5f86b73 + 7d13376 commit 933873d

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

lib/presentation/discover/desktop/discover_view_desktop.dart

+13-5
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,7 @@ class _DiscoverViewDesktopState extends State<DiscoverViewDesktop> {
271271
posts.insertAll(posts.length, state.posts);
272272
}
273273
return posts.isEmpty
274-
? const Center(
275-
child: CircularProgressIndicator(
276-
color: AppColor.appPrimary,
277-
),
278-
)
274+
? NoPostsYet()
279275
: SingleChildScrollView(
280276
child: Padding(
281277
padding: const EdgeInsets.all(18.0),
@@ -321,4 +317,16 @@ class _DiscoverViewDesktopState extends State<DiscoverViewDesktop> {
321317
),
322318
);
323319
}
320+
321+
Widget NoPostsYet() {
322+
return Center(
323+
child: Text(
324+
"You Have No Posts Yet",
325+
style: AppTextStyles.s18(
326+
color: AppColor.appSecondary,
327+
fontType: FontType.MEDIUM,
328+
),
329+
),
330+
);
331+
}
324332
}

lib/presentation/discover/mobile/discover_view_mobile.dart

+13-3
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,7 @@ class _DiscoverViewMobileState extends State<DiscoverViewMobile> {
239239
posts.insertAll(posts.length, state.posts);
240240
}
241241
return posts.isEmpty
242-
? const Center(
243-
child: CircularProgressIndicator(),
244-
)
242+
? NoPostsYet()
245243
: SingleChildScrollView(
246244
child: Column(
247245
children: [
@@ -308,4 +306,16 @@ class _DiscoverViewMobileState extends State<DiscoverViewMobile> {
308306
),
309307
);
310308
}
309+
310+
Widget NoPostsYet() {
311+
return Center(
312+
child: Text(
313+
"You have no posts yet",
314+
style: AppTextStyles.s14(
315+
color: AppColor.appLightGrey,
316+
fontType: FontType.REGULAR,
317+
),
318+
),
319+
);
320+
}
311321
}

0 commit comments

Comments
 (0)