opt to top

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-18 22:41:44 +08:00
parent 40502e3bff
commit 34949b8a7f
4 changed files with 17 additions and 13 deletions

View File

@@ -6,7 +6,6 @@ import 'package:PiliPlus/models/space_archive/data.dart';
import 'package:PiliPlus/models/space_archive/episodic_button.dart';
import 'package:PiliPlus/models/space_archive/item.dart';
import 'package:PiliPlus/pages/common/common_list_controller.dart';
import 'package:PiliPlus/pages/member/controller.dart';
import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/utils/id_utils.dart';
import 'package:PiliPlus/utils/page_utils.dart';
@@ -46,7 +45,7 @@ class MemberVideoCtr
bool? hasPrev;
String? heroTag;
late final MemberController _ctr = Get.find<MemberController>(tag: heroTag);
// late final MemberController _ctr = Get.find<MemberController>(tag: heroTag);
@override
Future<void> onRefresh() async {
@@ -227,11 +226,10 @@ class MemberVideoCtr
@override
Future<void> onReload() {
isLocating.value = null;
if (_ctr.key.currentState?.outerController.hasClients == true) {
if (_ctr.key.currentState!.outerController.offset > _ctr.offset) {
_ctr.key.currentState!.outerController.jumpTo(_ctr.offset.toDouble());
}
}
// if (_ctr.key.currentState?.outerController.hasClients == true) {
// _ctr.key.currentState!.outerController
// .jumpTo(_ctr.key.currentState!.outerController.offset);
// }
return super.onReload();
}
}

View File

@@ -121,7 +121,7 @@ class _MemberVideoState extends State<MemberVideo>
(context, index) {
return const VideoCardHSkeleton();
},
childCount: 10,
childCount: 4,
),
),
),

View File

@@ -131,6 +131,16 @@ class VideoDetailController extends GetxController
max(max(Get.height, Get.width) * 0.65, min(Get.height, Get.width));
late double videoHeight = minVideoHeight;
void animToTop() {
if (scrollKey.currentState?.outerController.hasClients == true) {
scrollKey.currentState!.outerController.animateTo(
scrollKey.currentState!.outerController.offset,
duration: const Duration(milliseconds: 500),
curve: Curves.easeInOut,
);
}
}
void setVideoHeight() {
String direction = firstVideo.width != null && firstVideo.height != null
? firstVideo.width! > firstVideo.height!

View File

@@ -925,11 +925,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
children: [
buildTabbar(
showReply: videoDetailController.showReply,
onTap: () {
videoDetailController
.scrollKey.currentState?.outerController
.animToTop();
},
onTap: videoDetailController.animToTop,
),
Expanded(
child: videoTabBarView(