Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-12-16 14:22:47 +08:00
parent 13818533a7
commit 0baf3fcd36
283 changed files with 803 additions and 1550 deletions

View File

@@ -0,0 +1,26 @@
import 'package:flutter/widgets.dart';
extension ScrollControllerExt on ScrollController {
void animToTop() => animTo(0);
void animTo(
double offset, {
Duration duration = const Duration(milliseconds: 500),
}) {
if (!hasClients) return;
if ((offset - this.offset).abs() >= position.viewportDimension * 7) {
jumpTo(offset);
} else {
animateTo(
offset,
duration: duration,
curve: Curves.easeInOut,
);
}
}
void jumpToTop() {
if (!hasClients) return;
jumpTo(0);
}
}