@@ -43,20 +43,12 @@ class _FavoriteFolderDetailScreenState extends State<FavoriteFolderDetailScreen>
4343 FavoriteFolderDetailLayoutMode .nineGrid;
4444 bool _loading = false ;
4545 final EasyRefreshController _refreshController = EasyRefreshController ();
46- final ScrollController _scrollController = ScrollController ();
4746 bool _noMore = false ;
4847
4948 @override
5049 void initState () {
5150 super .initState ();
5251 favoriteFolderId = widget.favoriteFolderId;
53- _scrollController.addListener (() {
54- if (! _noMore &&
55- _scrollController.position.pixels >
56- _scrollController.position.maxScrollExtent - kLoadExtentOffset) {
57- _fetchDetail ();
58- }
59- });
6052 }
6153
6254 _fetchDetail ({bool refresh = false }) async {
@@ -184,37 +176,40 @@ class _FavoriteFolderDetailScreenState extends State<FavoriteFolderDetailScreen>
184176 }
185177
186178 Widget _buildNineGrid (int startIndex, int count) {
187- return GridView .extent (
188- controller: _scrollController,
189- padding: const EdgeInsets .only (top: 12 , left: 12 , right: 12 ),
190- shrinkWrap: true ,
191- maxCrossAxisExtent: 160 ,
192- mainAxisSpacing: 6 ,
193- crossAxisSpacing: 6 ,
194- physics: const NeverScrollableScrollPhysics (),
195- children: List .generate (count, (index) {
196- int trueIndex = startIndex + index;
197- return GestureDetector (
198- child: FavoriteFolderPostItemBuilder .buildNineGridPostItem (
199- context, _posts[trueIndex],
200- wh: 160 ),
201- onTap: () {
202- if (FavoriteFolderPostItemBuilder .isInvalid (_posts[trueIndex])) {
203- IToast .showTop ("无效内容" );
204- } else {
205- RouteUtil .pushCupertinoRoute (
206- context,
207- PostDetailScreen (
208- favoritePostDetailData: _posts[trueIndex],
209- isArticle: FavoriteFolderPostItemBuilder .getPostType (
210- _posts[index]) ==
211- PostType .article,
212- ),
213- );
214- }
215- },
216- );
217- }),
179+ return ItemBuilder .buildLoadMoreNotification (
180+ child: GridView .extent (
181+ padding: const EdgeInsets .only (top: 12 , left: 12 , right: 12 ),
182+ shrinkWrap: true ,
183+ maxCrossAxisExtent: 160 ,
184+ mainAxisSpacing: 6 ,
185+ crossAxisSpacing: 6 ,
186+ physics: const NeverScrollableScrollPhysics (),
187+ children: List .generate (count, (index) {
188+ int trueIndex = startIndex + index;
189+ return GestureDetector (
190+ child: FavoriteFolderPostItemBuilder .buildNineGridPostItem (
191+ context, _posts[trueIndex],
192+ wh: 160 ),
193+ onTap: () {
194+ if (FavoriteFolderPostItemBuilder .isInvalid (_posts[trueIndex])) {
195+ IToast .showTop ("无效内容" );
196+ } else {
197+ RouteUtil .pushCupertinoRoute (
198+ context,
199+ PostDetailScreen (
200+ favoritePostDetailData: _posts[trueIndex],
201+ isArticle: FavoriteFolderPostItemBuilder .getPostType (
202+ _posts[index]) ==
203+ PostType .article,
204+ ),
205+ );
206+ }
207+ },
208+ );
209+ }),
210+ ),
211+ noMore: _noMore,
212+ onLoad: _onLoad,
218213 );
219214 }
220215
0 commit comments