fix: anim to top

This commit is contained in:
bggRGjQaUbCoE
2024-08-30 14:07:46 +08:00
parent d9eab8de47
commit ecefc4bdd5
9 changed files with 31 additions and 69 deletions

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
extension ImageExtension on num {
int cacheSize(BuildContext context) {
@@ -8,10 +9,12 @@ extension ImageExtension on num {
extension ScrollControllerExt on ScrollController {
void animToTop() {
animateTo(
0,
duration: const Duration(milliseconds: 500),
curve: Curves.ease,
);
if (!hasClients) return;
if (offset >= MediaQuery.of(Get.context!).size.height * 5) {
jumpTo(0);
} else {
animateTo(0,
duration: const Duration(milliseconds: 500), curve: Curves.easeInOut);
}
}
}