mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: load previous
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -10,7 +10,6 @@ Widget errorWidget({errMsg, callback}) => HttpError(
|
||||
);
|
||||
|
||||
Widget scrollErrorWidget({errMsg, callback}) => CustomScrollView(
|
||||
controller: ScrollController(),
|
||||
slivers: [
|
||||
HttpError(
|
||||
errMsg: errMsg,
|
||||
|
||||
@@ -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