mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: later page: multi select
feat: fav detail page: multi select opt: reply item opt: load more Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -33,6 +33,7 @@ class FavController extends CommonController {
|
||||
@override
|
||||
bool customHandleResponse(Success response) {
|
||||
hasMore = response.response.hasMore;
|
||||
isEnd = response.response.list.isEmpty;
|
||||
if (currentPage != 1 && loadingState.value is Success) {
|
||||
response.response.list
|
||||
.insertAll(0, (loadingState.value as Success).response);
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'package:PiliPalaX/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPalaX/http/loading_state.dart';
|
||||
import 'package:PiliPalaX/pages/fav_search/view.dart';
|
||||
import 'package:PiliPalaX/utils/utils.dart';
|
||||
import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPalaX/common/widgets/http_error.dart';
|
||||
@@ -23,27 +22,6 @@ class FavPage extends StatefulWidget {
|
||||
class _FavPageState extends State<FavPage> {
|
||||
final FavController _favController = Get.put(FavController());
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_favController.scrollController.addListener(
|
||||
() {
|
||||
if (_favController.scrollController.position.pixels >=
|
||||
_favController.scrollController.position.maxScrollExtent - 300) {
|
||||
EasyThrottle.throttle('history', const Duration(seconds: 1), () {
|
||||
_favController.onLoadMore();
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_favController.scrollController.removeListener(() {});
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -124,14 +102,18 @@ class _FavPageState extends State<FavPage> {
|
||||
bottom: 80 + MediaQuery.paddingOf(context).bottom),
|
||||
sliver: SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithExtentAndRatio(
|
||||
mainAxisSpacing: StyleString.cardSpace,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
maxCrossAxisExtent: Grid.maxRowWidth * 2,
|
||||
childAspectRatio: StyleString.aspectRatio * 2.4,
|
||||
mainAxisExtent: 0),
|
||||
mainAxisSpacing: StyleString.cardSpace,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
maxCrossAxisExtent: Grid.maxRowWidth * 2,
|
||||
childAspectRatio: StyleString.aspectRatio * 2.4,
|
||||
mainAxisExtent: 0,
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
childCount: loadingState.response.length,
|
||||
(BuildContext context, int index) {
|
||||
if (index == loadingState.response.length - 1) {
|
||||
_favController.onLoadMore();
|
||||
}
|
||||
String heroTag =
|
||||
Utils.makeHeroTag(loadingState.response[index].fid);
|
||||
return FavItem(
|
||||
@@ -155,7 +137,7 @@ class _FavPageState extends State<FavPage> {
|
||||
_favController.loadingState.value =
|
||||
LoadingState.success(list);
|
||||
} else {
|
||||
Future.delayed(const Duration(milliseconds: 150), () {
|
||||
Future.delayed(const Duration(milliseconds: 255), () {
|
||||
_favController.onRefresh();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user