fix: zoneController error

This commit is contained in:
guozhigq
2024-04-16 00:11:36 +08:00
parent adba7b33d3
commit 76f0d5fba2
4 changed files with 18 additions and 30 deletions

View File

@ -42,12 +42,15 @@ class ZoneController extends GetxController {
// 返回顶部并刷新
void animateToTop() async {
if (scrollController.offset >=
MediaQuery.of(Get.context!).size.height * 5) {
scrollController.jumpTo(0);
} else {
await scrollController.animateTo(0,
duration: const Duration(milliseconds: 500), curve: Curves.easeInOut);
if (scrollController.hasClients) {
if (scrollController.offset >=
MediaQuery.of(Get.context!).size.height * 5) {
scrollController.jumpTo(0);
} else {
await scrollController.animateTo(0,
duration: const Duration(milliseconds: 500),
curve: Curves.easeInOut);
}
}
}
}