mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-17 15:46:14 +08:00
opt member video
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -45,14 +45,13 @@ class CustomTabBarViewClampingScrollPhysics extends ClampingScrollPhysics {
|
||||
SpringDescription get spring => CustomSpringDescription();
|
||||
}
|
||||
|
||||
class PositionRetainedScrollPhysics extends AlwaysScrollableScrollPhysics {
|
||||
const PositionRetainedScrollPhysics({super.parent, this.shouldRetain = true});
|
||||
|
||||
final bool shouldRetain;
|
||||
class MemberVideoScrollPhysics extends AlwaysScrollableScrollPhysics {
|
||||
const MemberVideoScrollPhysics(
|
||||
{super.parent = const ClampingScrollPhysics()});
|
||||
|
||||
@override
|
||||
PositionRetainedScrollPhysics applyTo(ScrollPhysics? ancestor) {
|
||||
return PositionRetainedScrollPhysics(parent: buildParent(ancestor));
|
||||
MemberVideoScrollPhysics applyTo(ScrollPhysics? ancestor) {
|
||||
return MemberVideoScrollPhysics(parent: buildParent(ancestor));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -62,20 +61,15 @@ class PositionRetainedScrollPhysics extends AlwaysScrollableScrollPhysics {
|
||||
required bool isScrolling,
|
||||
required double velocity,
|
||||
}) {
|
||||
final position = super.adjustPositionForNewDimensions(
|
||||
if (newPosition.maxScrollExtent < oldPosition.maxScrollExtent) {
|
||||
return 0;
|
||||
}
|
||||
return super.adjustPositionForNewDimensions(
|
||||
oldPosition: oldPosition,
|
||||
newPosition: newPosition,
|
||||
isScrolling: isScrolling,
|
||||
velocity: velocity,
|
||||
);
|
||||
|
||||
late final diff = newPosition.maxScrollExtent - oldPosition.maxScrollExtent;
|
||||
|
||||
if (shouldRetain && oldPosition.pixels == 0 && diff > 0) {
|
||||
return position + diff;
|
||||
} else {
|
||||
return position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ class MemberVideoCtr
|
||||
required this.seriesId,
|
||||
this.username,
|
||||
this.title,
|
||||
this.heroTag,
|
||||
});
|
||||
|
||||
ContributeType type;
|
||||
@@ -44,9 +43,6 @@ class MemberVideoCtr
|
||||
bool? isLoadPrevious;
|
||||
bool? hasPrev;
|
||||
|
||||
String? heroTag;
|
||||
// late final MemberController _ctr = Get.find<MemberController>(tag: heroTag);
|
||||
|
||||
@override
|
||||
Future<void> onRefresh() async {
|
||||
if (isLocating.value == true) {
|
||||
@@ -226,10 +222,6 @@ class MemberVideoCtr
|
||||
@override
|
||||
Future<void> onReload() {
|
||||
isLocating.value = null;
|
||||
// if (_ctr.key.currentState?.outerController.hasClients == true) {
|
||||
// _ctr.key.currentState!.outerController
|
||||
// .jumpTo(_ctr.key.currentState!.outerController.offset);
|
||||
// }
|
||||
return super.onReload();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:PiliPlus/common/skeleton/video_card_h.dart';
|
||||
import 'package:PiliPlus/common/widgets/custom_sliver_persistent_header_delegate.dart';
|
||||
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/common/widgets/video_card/video_card_h_member_video.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/common/member/contribute_type.dart';
|
||||
@@ -49,7 +50,6 @@ class _MemberVideoState extends State<MemberVideo>
|
||||
seriesId: widget.seriesId,
|
||||
username: Get.find<MemberController>(tag: widget.heroTag).username,
|
||||
title: widget.title,
|
||||
heroTag: widget.heroTag,
|
||||
),
|
||||
tag:
|
||||
'${widget.heroTag}${widget.type.name}${widget.seasonId}${widget.seriesId}',
|
||||
@@ -65,10 +65,7 @@ class _MemberVideoState extends State<MemberVideo>
|
||||
refreshIndicator(
|
||||
onRefresh: _controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
// physics: PositionRetainedScrollPhysics(
|
||||
// shouldRetain: _controller.isLocating.value == true,
|
||||
// parent: const ClampingScrollPhysics(),
|
||||
// ),
|
||||
physics: const MemberVideoScrollPhysics(),
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.only(
|
||||
@@ -121,7 +118,7 @@ class _MemberVideoState extends State<MemberVideo>
|
||||
(context, index) {
|
||||
return const VideoCardHSkeleton();
|
||||
},
|
||||
childCount: 4,
|
||||
childCount: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user