fix: video page

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-11-27 16:01:34 +08:00
parent db8d3bab51
commit e405395347
7 changed files with 66 additions and 34 deletions

View File

@@ -90,7 +90,9 @@ class NetworkImgLayer extends StatelessWidget {
imageBuilder: imageBuilder,
errorListener: (value) {
thumbnail = false;
if (context.mounted) {
(context as Element).markNeedsBuild();
}
},
),
),

View File

@@ -805,7 +805,7 @@ class VideoHttp {
'cid': cid,
});
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
return {'status': true, 'data': res.data['data']['total']};
} else {
return {'status': false, 'data': null, 'msg': res.data['message']};
}

View File

@@ -554,6 +554,8 @@ class VideoDetailController extends GetxController
},
options: _options,
);
segmentList.clear();
_segmentProgressList = null;
_handleSBData(result);
}

View File

@@ -567,6 +567,9 @@ class VideoIntroController extends GetxController
this.bvid = bvid;
lastPlayCid.value = cid;
queryVideoIntro();
if (isShowOnlineTotal) {
queryOnlineTotal();
}
}
void startTimer() {
@@ -588,15 +591,15 @@ class VideoIntroController extends GetxController
// 查看同时在看人数
Future queryOnlineTotal() async {
// var result = await VideoHttp.onlineTotal(
// aid: IdUtils.bv2av(bvid),
// bvid: bvid,
// cid: lastPlayCid.value,
// );
dynamic result = await GrpcRepo.playerOnline(
dynamic result = await VideoHttp.onlineTotal(
aid: IdUtils.bv2av(bvid),
bvid: bvid,
cid: lastPlayCid.value,
);
// dynamic result = await GrpcRepo.playerOnline(
// aid: IdUtils.bv2av(bvid),
// cid: lastPlayCid.value,
// );
if (result['status']) {
total.value = result['data'];
}

View File

@@ -158,7 +158,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
late final _coinKey = GlobalKey<ActionItemState>();
late final _favKey = GlobalKey<ActionItemState>();
late final _expandableCtr = ExpandableController(initialExpanded: false);
final _expandableCtr = ExpandableController(initialExpanded: false);
@override
void initState() {

View File

@@ -501,6 +501,11 @@ class _VideoDetailPageState extends State<VideoDetailPage>
Orientation.portrait),
onPopInvokedWithResult:
(bool didPop, Object? result) {
if (plPlayerController?.controlsLock.value ==
true) {
plPlayerController?.onLockControl(false);
return;
}
if (isFullScreen) {
plPlayerController!
.triggerFullScreen(status: false);
@@ -562,6 +567,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
child: PopScope(
canPop: !isFullScreen,
onPopInvokedWithResult: (bool didPop, Object? result) {
if (plPlayerController?.controlsLock.value == true) {
plPlayerController?.onLockControl(false);
return;
}
if (isFullScreen) {
plPlayerController!.triggerFullScreen(status: false);
}
@@ -614,6 +623,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
child: PopScope(
canPop: !isFullScreen,
onPopInvokedWithResult: (bool didPop, Object? result) {
if (plPlayerController?.controlsLock.value == true) {
plPlayerController?.onLockControl(false);
return;
}
if (isFullScreen) {
plPlayerController!.triggerFullScreen(status: false);
}
@@ -668,6 +681,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
child: PopScope(
canPop: !isFullScreen,
onPopInvokedWithResult: (bool didPop, Object? result) {
if (plPlayerController?.controlsLock.value == true) {
plPlayerController?.onLockControl(false);
return;
}
if (isFullScreen) {
plPlayerController!.triggerFullScreen(status: false);
}
@@ -745,6 +762,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
child: PopScope(
canPop: !isFullScreen,
onPopInvokedWithResult: (bool didPop, Object? result) {
if (plPlayerController?.controlsLock.value == true) {
plPlayerController?.onLockControl(false);
return;
}
if (isFullScreen) {
plPlayerController!.triggerFullScreen(status: false);
}

View File

@@ -1437,7 +1437,8 @@ class _HeaderControlState extends State<HeaderControl> {
constraints: BoxConstraints(
maxWidth: boxConstraints.maxWidth / 2 - 60,
maxHeight: 25),
child: Marquee(
child: Obx(
() => Marquee(
text: videoIntroController.videoDetail.value.title!,
style: const TextStyle(
color: Colors.white,
@@ -1459,14 +1460,17 @@ class _HeaderControlState extends State<HeaderControl> {
decelerationCurve: Curves.easeOut,
),
),
),
if (videoIntroController.isShowOnlineTotal)
Text(
Obx(
() => Text(
'${videoIntroController.total.value}人正在看',
style: const TextStyle(
color: Colors.white,
fontSize: 11,
),
)
),
),
],
),
const Spacer(),