mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-20 09:06:36 +08:00
opt: load previous
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -54,7 +54,9 @@ class CustomTabBarViewClampingScrollPhysics extends ClampingScrollPhysics {
|
||||
}
|
||||
|
||||
class PositionRetainedScrollPhysics extends AlwaysScrollableScrollPhysics {
|
||||
const PositionRetainedScrollPhysics({super.parent});
|
||||
const PositionRetainedScrollPhysics({super.parent, this.shouldRetain = true});
|
||||
|
||||
final bool shouldRetain;
|
||||
|
||||
@override
|
||||
PositionRetainedScrollPhysics applyTo(ScrollPhysics? ancestor) {
|
||||
@@ -75,9 +77,9 @@ class PositionRetainedScrollPhysics extends AlwaysScrollableScrollPhysics {
|
||||
velocity: velocity,
|
||||
);
|
||||
|
||||
final diff = newPosition.maxScrollExtent - oldPosition.maxScrollExtent;
|
||||
late final diff = newPosition.maxScrollExtent - oldPosition.maxScrollExtent;
|
||||
|
||||
if (oldPosition.pixels == 0 && diff > 0) {
|
||||
if (shouldRetain && oldPosition.pixels == 0 && diff > 0) {
|
||||
return position + diff;
|
||||
} else {
|
||||
return position;
|
||||
|
||||
Reference in New Issue
Block a user