Merge branch 'fix-replyRepeat'
This commit is contained in:
@ -19,6 +19,7 @@ import 'package:pilipala/utils/utils.dart';
|
|||||||
import 'package:pilipala/utils/video_utils.dart';
|
import 'package:pilipala/utils/video_utils.dart';
|
||||||
import 'package:screen_brightness/screen_brightness.dart';
|
import 'package:screen_brightness/screen_brightness.dart';
|
||||||
|
|
||||||
|
import '../../../utils/id_utils.dart';
|
||||||
import 'widgets/header_control.dart';
|
import 'widgets/header_control.dart';
|
||||||
|
|
||||||
class VideoDetailController extends GetxController
|
class VideoDetailController extends GetxController
|
||||||
@ -61,7 +62,7 @@ class VideoDetailController extends GetxController
|
|||||||
Box localCache = GStrorage.localCache;
|
Box localCache = GStrorage.localCache;
|
||||||
Box setting = GStrorage.setting;
|
Box setting = GStrorage.setting;
|
||||||
|
|
||||||
int oid = 0;
|
RxInt oid = 0.obs;
|
||||||
// 评论id 请求楼中楼评论使用
|
// 评论id 请求楼中楼评论使用
|
||||||
int fRpid = 0;
|
int fRpid = 0;
|
||||||
|
|
||||||
@ -135,13 +136,14 @@ class VideoDetailController extends GetxController
|
|||||||
defaultValue: VideoDecodeFormats.values.last.code);
|
defaultValue: VideoDecodeFormats.values.last.code);
|
||||||
cacheAudioQa = setting.get(SettingBoxKey.defaultAudioQa,
|
cacheAudioQa = setting.get(SettingBoxKey.defaultAudioQa,
|
||||||
defaultValue: AudioQuality.hiRes.code);
|
defaultValue: AudioQuality.hiRes.code);
|
||||||
|
oid.value = IdUtils.bv2av(Get.parameters['bvid']!);
|
||||||
}
|
}
|
||||||
|
|
||||||
showReplyReplyPanel() {
|
showReplyReplyPanel() {
|
||||||
PersistentBottomSheetController? ctr =
|
PersistentBottomSheetController? ctr =
|
||||||
scaffoldKey.currentState?.showBottomSheet((BuildContext context) {
|
scaffoldKey.currentState?.showBottomSheet((BuildContext context) {
|
||||||
return VideoReplyReplyPanel(
|
return VideoReplyReplyPanel(
|
||||||
oid: oid,
|
oid: oid.value,
|
||||||
rpid: fRpid,
|
rpid: fRpid,
|
||||||
closePanel: () => {
|
closePanel: () => {
|
||||||
fRpid = 0,
|
fRpid = 0,
|
||||||
|
@ -476,6 +476,7 @@ class VideoIntroController extends GetxController {
|
|||||||
final VideoDetailController videoDetailCtr =
|
final VideoDetailController videoDetailCtr =
|
||||||
Get.find<VideoDetailController>(tag: heroTag);
|
Get.find<VideoDetailController>(tag: heroTag);
|
||||||
videoDetailCtr.bvid = bvid;
|
videoDetailCtr.bvid = bvid;
|
||||||
|
videoDetailCtr.oid.value = aid;
|
||||||
videoDetailCtr.cid.value = cid;
|
videoDetailCtr.cid.value = cid;
|
||||||
videoDetailCtr.danmakuCid.value = cid;
|
videoDetailCtr.danmakuCid.value = cid;
|
||||||
videoDetailCtr.queryVideoUrl();
|
videoDetailCtr.queryVideoUrl();
|
||||||
|
@ -53,9 +53,13 @@ class VideoReplyController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future queryReplyList({type = 'init'}) async {
|
Future queryReplyList({type = 'init'}) async {
|
||||||
|
if (isLoadingMore) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
isLoadingMore = true;
|
isLoadingMore = true;
|
||||||
if (type == 'init') {
|
if (type == 'init') {
|
||||||
currentPage = 0;
|
currentPage = 0;
|
||||||
|
noMore.value = '';
|
||||||
}
|
}
|
||||||
if (noMore.value == '没有更多了') {
|
if (noMore.value == '没有更多了') {
|
||||||
return;
|
return;
|
||||||
|
@ -16,11 +16,13 @@ import 'widgets/reply_item.dart';
|
|||||||
|
|
||||||
class VideoReplyPanel extends StatefulWidget {
|
class VideoReplyPanel extends StatefulWidget {
|
||||||
final String? bvid;
|
final String? bvid;
|
||||||
|
final int? oid;
|
||||||
final int rpid;
|
final int rpid;
|
||||||
final String? replyLevel;
|
final String? replyLevel;
|
||||||
|
|
||||||
const VideoReplyPanel({
|
const VideoReplyPanel({
|
||||||
this.bvid,
|
this.bvid,
|
||||||
|
this.oid,
|
||||||
this.rpid = 0,
|
this.rpid = 0,
|
||||||
this.replyLevel,
|
this.replyLevel,
|
||||||
super.key,
|
super.key,
|
||||||
@ -48,16 +50,17 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
int oid = widget.bvid != null ? IdUtils.bv2av(widget.bvid!) : 0;
|
// int oid = widget.bvid != null ? IdUtils.bv2av(widget.bvid!) : 0;
|
||||||
heroTag = Get.arguments['heroTag'];
|
heroTag = Get.arguments['heroTag'];
|
||||||
replyLevel = widget.replyLevel ?? '1';
|
replyLevel = widget.replyLevel ?? '1';
|
||||||
if (replyLevel == '2') {
|
if (replyLevel == '2') {
|
||||||
_videoReplyController = Get.put(
|
_videoReplyController = Get.put(
|
||||||
VideoReplyController(oid, widget.rpid.toString(), replyLevel),
|
VideoReplyController(widget.oid, widget.rpid.toString(), replyLevel),
|
||||||
tag: widget.rpid.toString());
|
tag: widget.rpid.toString());
|
||||||
} else {
|
} else {
|
||||||
_videoReplyController =
|
_videoReplyController = Get.put(
|
||||||
Get.put(VideoReplyController(oid, '', replyLevel), tag: heroTag);
|
VideoReplyController(widget.oid, '', replyLevel),
|
||||||
|
tag: heroTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
fabAnimationCtr = AnimationController(
|
fabAnimationCtr = AnimationController(
|
||||||
@ -75,7 +78,8 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
|||||||
() {
|
() {
|
||||||
if (scrollController.position.pixels >=
|
if (scrollController.position.pixels >=
|
||||||
scrollController.position.maxScrollExtent - 300) {
|
scrollController.position.maxScrollExtent - 300) {
|
||||||
EasyThrottle.throttle('replylist', const Duration(seconds: 2), () {
|
EasyThrottle.throttle('replylist', const Duration(milliseconds: 200),
|
||||||
|
() {
|
||||||
_videoReplyController.onLoad();
|
_videoReplyController.onLoad();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -570,8 +570,11 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
VideoReplyPanel(
|
Obx(
|
||||||
bvid: videoDetailController.bvid,
|
() => VideoReplyPanel(
|
||||||
|
bvid: videoDetailController.bvid,
|
||||||
|
oid: videoDetailController.oid.value,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user