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();
|
SpringDescription get spring => CustomSpringDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
class PositionRetainedScrollPhysics extends AlwaysScrollableScrollPhysics {
|
class MemberVideoScrollPhysics extends AlwaysScrollableScrollPhysics {
|
||||||
const PositionRetainedScrollPhysics({super.parent, this.shouldRetain = true});
|
const MemberVideoScrollPhysics(
|
||||||
|
{super.parent = const ClampingScrollPhysics()});
|
||||||
final bool shouldRetain;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PositionRetainedScrollPhysics applyTo(ScrollPhysics? ancestor) {
|
MemberVideoScrollPhysics applyTo(ScrollPhysics? ancestor) {
|
||||||
return PositionRetainedScrollPhysics(parent: buildParent(ancestor));
|
return MemberVideoScrollPhysics(parent: buildParent(ancestor));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -62,20 +61,15 @@ class PositionRetainedScrollPhysics extends AlwaysScrollableScrollPhysics {
|
|||||||
required bool isScrolling,
|
required bool isScrolling,
|
||||||
required double velocity,
|
required double velocity,
|
||||||
}) {
|
}) {
|
||||||
final position = super.adjustPositionForNewDimensions(
|
if (newPosition.maxScrollExtent < oldPosition.maxScrollExtent) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return super.adjustPositionForNewDimensions(
|
||||||
oldPosition: oldPosition,
|
oldPosition: oldPosition,
|
||||||
newPosition: newPosition,
|
newPosition: newPosition,
|
||||||
isScrolling: isScrolling,
|
isScrolling: isScrolling,
|
||||||
velocity: velocity,
|
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,
|
required this.seriesId,
|
||||||
this.username,
|
this.username,
|
||||||
this.title,
|
this.title,
|
||||||
this.heroTag,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ContributeType type;
|
ContributeType type;
|
||||||
@@ -44,9 +43,6 @@ class MemberVideoCtr
|
|||||||
bool? isLoadPrevious;
|
bool? isLoadPrevious;
|
||||||
bool? hasPrev;
|
bool? hasPrev;
|
||||||
|
|
||||||
String? heroTag;
|
|
||||||
// late final MemberController _ctr = Get.find<MemberController>(tag: heroTag);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onRefresh() async {
|
Future<void> onRefresh() async {
|
||||||
if (isLocating.value == true) {
|
if (isLocating.value == true) {
|
||||||
@@ -226,10 +222,6 @@ class MemberVideoCtr
|
|||||||
@override
|
@override
|
||||||
Future<void> onReload() {
|
Future<void> onReload() {
|
||||||
isLocating.value = null;
|
isLocating.value = null;
|
||||||
// if (_ctr.key.currentState?.outerController.hasClients == true) {
|
|
||||||
// _ctr.key.currentState!.outerController
|
|
||||||
// .jumpTo(_ctr.key.currentState!.outerController.offset);
|
|
||||||
// }
|
|
||||||
return super.onReload();
|
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/custom_sliver_persistent_header_delegate.dart';
|
||||||
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||||
import 'package:PiliPlus/common/widgets/refresh_indicator.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/common/widgets/video_card/video_card_h_member_video.dart';
|
||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/models/common/member/contribute_type.dart';
|
import 'package:PiliPlus/models/common/member/contribute_type.dart';
|
||||||
@@ -49,7 +50,6 @@ class _MemberVideoState extends State<MemberVideo>
|
|||||||
seriesId: widget.seriesId,
|
seriesId: widget.seriesId,
|
||||||
username: Get.find<MemberController>(tag: widget.heroTag).username,
|
username: Get.find<MemberController>(tag: widget.heroTag).username,
|
||||||
title: widget.title,
|
title: widget.title,
|
||||||
heroTag: widget.heroTag,
|
|
||||||
),
|
),
|
||||||
tag:
|
tag:
|
||||||
'${widget.heroTag}${widget.type.name}${widget.seasonId}${widget.seriesId}',
|
'${widget.heroTag}${widget.type.name}${widget.seasonId}${widget.seriesId}',
|
||||||
@@ -65,10 +65,7 @@ class _MemberVideoState extends State<MemberVideo>
|
|||||||
refreshIndicator(
|
refreshIndicator(
|
||||||
onRefresh: _controller.onRefresh,
|
onRefresh: _controller.onRefresh,
|
||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
// physics: PositionRetainedScrollPhysics(
|
physics: const MemberVideoScrollPhysics(),
|
||||||
// shouldRetain: _controller.isLocating.value == true,
|
|
||||||
// parent: const ClampingScrollPhysics(),
|
|
||||||
// ),
|
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverPadding(
|
SliverPadding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
@@ -121,7 +118,7 @@ class _MemberVideoState extends State<MemberVideo>
|
|||||||
(context, index) {
|
(context, index) {
|
||||||
return const VideoCardHSkeleton();
|
return const VideoCardHSkeleton();
|
||||||
},
|
},
|
||||||
childCount: 4,
|
childCount: 10,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user