Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-11-22 18:50:07 +08:00
parent 64f66dd58f
commit 57b2f48c72
22 changed files with 134 additions and 88 deletions

View File

@@ -205,4 +205,10 @@ class HistoryController extends GetxController {
},
);
}
@override
void onClose() {
scrollController.dispose();
super.onClose();
}
}

View File

@@ -21,17 +21,16 @@ class HistoryPage extends StatefulWidget {
class _HistoryPageState extends State<HistoryPage> {
final HistoryController _historyController = Get.put(HistoryController());
Future? _futureBuilderFuture;
late ScrollController scrollController;
@override
void initState() {
super.initState();
_futureBuilderFuture = _historyController.queryHistoryList();
scrollController = _historyController.scrollController;
scrollController.addListener(
_historyController.scrollController.addListener(
() {
if (scrollController.position.pixels >=
scrollController.position.maxScrollExtent - 300) {
if (_historyController.scrollController.position.pixels >=
_historyController.scrollController.position.maxScrollExtent -
300) {
if (!_historyController.isLoadingMore.value) {
EasyThrottle.throttle('history', const Duration(seconds: 1), () {
_historyController.onLoad();
@@ -61,8 +60,7 @@ class _HistoryPageState extends State<HistoryPage> {
@override
void dispose() {
scrollController.removeListener(() {});
scrollController.dispose();
_historyController.scrollController.removeListener(() {});
super.dispose();
}