mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
* Revert "fix: #779"
This reverts commit ddf7d82656.
* refix #779
This commit is contained in:
committed by
GitHub
parent
e8147680e6
commit
0dfc4e15bd
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -11,6 +12,17 @@ abstract mixin class ScrollOrRefreshMixin {
|
||||
void animateToTop() => scrollController.animToTop();
|
||||
|
||||
Future<void> onRefresh();
|
||||
|
||||
void toTopOrRefresh() {
|
||||
if (scrollController.hasClients) {
|
||||
if (scrollController.position.pixels == 0) {
|
||||
EasyThrottle.throttle(
|
||||
'topOrRefresh', const Duration(milliseconds: 500), onRefresh);
|
||||
} else {
|
||||
animateToTop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class CommonController<R, T> extends GetxController
|
||||
|
||||
Reference in New Issue
Block a user