Skip to content

Commit

Permalink
fix: #456
Browse files Browse the repository at this point in the history
  • Loading branch information
w568w committed Nov 29, 2024
1 parent 144fd82 commit 9b5e8db
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions lib/page/danke/course_group_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,31 +206,6 @@ class CourseGroupDetailState extends State<CourseGroupDetail> {
_courseGroupFuture ??= _fetchCourseGroup();
_reviewListFuture ??= _loadContent();

WidgetsBinding.instance.addPostFrameCallback((_) async {
if (mounted) {
if (locateReview != null) {
// Scroll to the specific floor.
final floorToJump = locateReview!;
_listViewController.scheduleLoadedCallback(
() async => await _listViewController.scrollToItem(floorToJump),
rebuild: true);
locateReview = null;
}

if (shouldScrollToEnd) {
try {
// Scroll to end.
_listViewController.scheduleLoadedCallback(
() async => await _listViewController.scrollToEnd(),
rebuild: true);
shouldScrollToEnd = false;
} catch (_) {
// we don't care if we failed to scroll to the end.
}
}
}
});

return PlatformScaffold(
iosContentPadding: false,
iosContentBottomPadding: false,
Expand Down Expand Up @@ -294,6 +269,31 @@ class CourseGroupDetailState extends State<CourseGroupDetail> {
child: FutureWidget<CourseGroup?>(
future: _courseGroupFuture,
successBuilder: (context, snapshot) {
WidgetsBinding.instance.addPostFrameCallback((_) async {
if (mounted) {
if (locateReview != null) {
// Scroll to the specific floor.
final floorToJump = locateReview!;
_listViewController.scheduleLoadedCallback(
() async => await _listViewController.scrollToItem(floorToJump),
rebuild: true);
locateReview = null;
}

if (shouldScrollToEnd) {
try {
// Scroll to end.
_listViewController.scheduleLoadedCallback(
() async => await _listViewController.scrollToEnd(),
rebuild: true);
shouldScrollToEnd = false;
} catch (_) {
// we don't care if we failed to scroll to the end.
}
}
}
});

return PagedListView<CourseReview>(
pagedController: _listViewController,
withScrollbar: true,
Expand Down

0 comments on commit 9b5e8db

Please sign in to comment.