Skip to content

Commit

Permalink
Merge pull request #175 from sparcs-kaist/bug@infinite-loading-maximu…
Browse files Browse the repository at this point in the history
…m-scroll

Fix #115, Fix infinite loading if maximum scrolled
  • Loading branch information
sboh1214 authored Apr 4, 2024
2 parents 9d99f22 + 47256c8 commit ad2294c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 43 deletions.
33 changes: 18 additions & 15 deletions lib/pages/liked_review_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class LikedReviewPage extends StatelessWidget {
Widget build(BuildContext context) {
final user = context.watch<InfoModel>().user;
final reviews = context.watch<LikedReviewModel>().likedReviews(user);
final reviewPage = context.watch<LikedReviewModel>().page;

return OTLScaffold(
child: OTLLayout(
Expand Down Expand Up @@ -77,23 +78,25 @@ class LikedReviewPage extends StatelessWidget {
childCount: reviews.length,
),
),
SliverList(
delegate: SliverChildListDelegate([
Padding(
padding: const EdgeInsets.only(
top: 4.0, bottom: 12.0),
child: const Center(
child: SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
color: OTLColor.grayE,
strokeWidth: 2,
if (reviewPage * 10 == reviews.length) ...[
SliverList(
delegate: SliverChildListDelegate([
Padding(
padding: const EdgeInsets.only(
top: 4.0, bottom: 12.0),
child: const Center(
child: SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
color: OTLColor.grayE,
strokeWidth: 2,
),
),
),
),
)
]))
)
]))
]
],
),
),
Expand Down
62 changes: 34 additions & 28 deletions lib/pages/review_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class LatestReviewsPage extends StatelessWidget {
Widget build(BuildContext context) {
final _scrollController = context.watch<HallOfFameModel>().scrollController;
final latestReviews = context.watch<LatestReviewsModel>().latestReviews;
final latestReviewPage = context.watch<LatestReviewsModel>().page;

return Expanded(
child: RefreshIndicator(
Expand All @@ -111,22 +112,24 @@ class LatestReviewsPage extends StatelessWidget {
childCount: latestReviews.length,
),
),
SliverList(
delegate: SliverChildListDelegate([
Padding(
padding: const EdgeInsets.only(top: 4.0, bottom: 12.0),
child: const Center(
child: SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
color: OTLColor.grayE,
strokeWidth: 2,
if (latestReviewPage * 10 == latestReviews.length) ...[
SliverList(
delegate: SliverChildListDelegate([
Padding(
padding: const EdgeInsets.only(top: 4.0, bottom: 12.0),
child: const Center(
child: SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
color: OTLColor.grayE,
strokeWidth: 2,
),
),
),
),
)
]))
)
]))
]
],
),
),
Expand All @@ -142,6 +145,7 @@ class HallOfFamePage extends StatelessWidget {
Widget build(BuildContext context) {
final _scrollController = context.watch<HallOfFameModel>().scrollController;
final hallOfFames = context.watch<HallOfFameModel>().hallOfFame;
final hallOfFamesPage = context.watch<HallOfFameModel>().page;

return Expanded(
child: RefreshIndicator(
Expand All @@ -168,22 +172,24 @@ class HallOfFamePage extends StatelessWidget {
childCount: hallOfFames.length,
),
),
SliverList(
delegate: SliverChildListDelegate([
Padding(
padding: const EdgeInsets.only(top: 4.0, bottom: 12.0),
child: const Center(
child: SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
color: OTLColor.grayE,
strokeWidth: 2,
if (hallOfFamesPage * 10 == hallOfFames.length) ...[
SliverList(
delegate: SliverChildListDelegate([
Padding(
padding: const EdgeInsets.only(top: 4.0, bottom: 12.0),
child: const Center(
child: SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
color: OTLColor.grayE,
strokeWidth: 2,
),
),
),
),
)
]))
)
]))
]
],
),
),
Expand Down

0 comments on commit ad2294c

Please sign in to comment.