mod: 点击底栏返回顶部

This commit is contained in:
guozhigq
2023-04-19 10:51:00 +08:00
parent 06494b100e
commit 9bac8553a5
2 changed files with 36 additions and 1 deletions

View File

@ -11,6 +11,7 @@ class HomeController extends GetxController {
int crossAxisCount = 2;
RxList<RecVideoItemModel> videoList = [RecVideoItemModel()].obs;
bool isLoadingMore = false;
bool flag = false;
@override
void onInit() {
@ -49,4 +50,15 @@ class HomeController extends GetxController {
await Future.delayed(const Duration(milliseconds: 500));
queryRcmdFeed('onLoad');
}
// 返回顶部并刷新
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);
}
}
}