fix: zoneController error

This commit is contained in:
guozhigq
2024-04-16 00:11:36 +08:00
parent 1c692a7ba0
commit 0b8d329ec8
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);
}
}
}
}