From 9b5e8dbaf337d6e96675dba252f0cd1d6760cb5d Mon Sep 17 00:00:00 2001 From: w568w <1278297578@qq.com> Date: Fri, 29 Nov 2024 19:17:47 +0800 Subject: [PATCH] fix: #456 --- lib/page/danke/course_group_detail.dart | 50 ++++++++++++------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/page/danke/course_group_detail.dart b/lib/page/danke/course_group_detail.dart index 615f5ddd..c90ec3b7 100644 --- a/lib/page/danke/course_group_detail.dart +++ b/lib/page/danke/course_group_detail.dart @@ -206,31 +206,6 @@ class CourseGroupDetailState extends State { _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, @@ -294,6 +269,31 @@ class CourseGroupDetailState extends State { child: FutureWidget( 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( pagedController: _listViewController, withScrollbar: true,