Merge branch 'main' into opt-videoPlayerControl

This commit is contained in:
guozhigq
2024-12-09 09:42:17 +08:00
6 changed files with 43 additions and 15 deletions

View File

@ -626,4 +626,7 @@ class Api {
/// 修复标题和海报 /// 修复标题和海报
// /api/view?id=${aid} /all/video/av${aid} /video/av${aid}/ // /api/view?id=${aid} /all/video/av${aid} /video/av${aid}/
static const String fixTitleAndPic = '${HttpString.biliplusBaseUrl}/api/view'; static const String fixTitleAndPic = '${HttpString.biliplusBaseUrl}/api/view';
/// 专栏详情
static const String opusDetail = '/x/polymer/web-dynamic/v1/opus/detail';
} }

View File

@ -215,4 +215,25 @@ class DynamicsHttp {
}; };
} }
} }
static Future opusDetail({
required int opusId,
}) async {
var res = await Request().get(
Api.opusDetail,
data: {'id': opusId},
);
if (res.data['code'] == 0) {
return {
'status': true,
'data': res.data['data'],
};
} else {
return {
'status': false,
'data': [],
'msg': res.data['message'],
};
}
}
} }

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:pilipala/http/html.dart'; import 'package:pilipala/http/dynamics.dart';
import 'package:pilipala/http/reply.dart'; import 'package:pilipala/http/reply.dart';
import 'package:pilipala/models/common/reply_sort_type.dart'; import 'package:pilipala/models/common/reply_sort_type.dart';
import 'package:pilipala/models/video/reply/item.dart'; import 'package:pilipala/models/video/reply/item.dart';
@ -12,6 +12,7 @@ class DynamicDetailController extends GetxController {
DynamicDetailController(this.oid, this.type); DynamicDetailController(this.oid, this.type);
int? oid; int? oid;
int? type; int? type;
int? opusId;
dynamic item; dynamic item;
int? floor; int? floor;
String nextOffset = ""; String nextOffset = "";
@ -56,6 +57,12 @@ class DynamicDetailController extends GetxController {
if (reqType == 'init') { if (reqType == 'init') {
nextOffset = ''; nextOffset = '';
noMore.value = ''; noMore.value = '';
if (opusId != null && oid == 0) {
var res = await DynamicsHttp.opusDetail(opusId: opusId!);
if (res['status']) {
oid = int.parse(res['data']['item']['basic']['comment_id_str']);
}
}
} }
var res = await ReplyHttp.replyList( var res = await ReplyHttp.replyList(
oid: oid!, oid: oid!,
@ -110,15 +117,12 @@ class DynamicDetailController extends GetxController {
sortTypeTitle.value = _sortType.titles; sortTypeTitle.value = _sortType.titles;
sortTypeLabel.value = _sortType.labels; sortTypeLabel.value = _sortType.labels;
replyList.clear(); replyList.clear();
noMore.value = '';
isLoadingMore = false;
isEnd = false;
queryReplyList(reqType: 'init'); queryReplyList(reqType: 'init');
} }
// 根据jumpUrl获取动态html
reqHtmlByOpusId(int id) async {
var res = await HtmlHttp.reqHtml(id, 'opus');
oid = res['commentId'];
}
// 上拉加载 // 上拉加载
Future onLoad() async { Future onLoad() async {
queryReplyList(reqType: 'onLoad'); queryReplyList(reqType: 'onLoad');

View File

@ -89,9 +89,8 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
_dynamicDetailController = Get.put( _dynamicDetailController = Get.put(
DynamicDetailController(oid, replyType), DynamicDetailController(oid, replyType),
tag: opusId.toString()); tag: opusId.toString());
_dynamicDetailController.opusId = opusId;
_futureBuilderFuture = _dynamicDetailController.queryReplyList(); _futureBuilderFuture = _dynamicDetailController.queryReplyList();
await _dynamicDetailController.reqHtmlByOpusId(opusId!);
setState(() {});
} }
} else { } else {
oid = moduleDynamic.major!.draw!.id!; oid = moduleDynamic.major!.draw!.id!;

View File

@ -110,7 +110,8 @@ class _LiveRoomPageState extends State<LiveRoomPage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context); final mediaQuery = MediaQuery.of(context);
final isPortrait = mediaQuery.orientation == Orientation.portrait; final isPortrait = mediaQuery.orientation == Orientation.portrait;
final isLandscape = mediaQuery.orientation == Orientation.landscape; final RxBool isLandscape =
(mediaQuery.orientation == Orientation.landscape).obs;
final padding = mediaQuery.padding; final padding = mediaQuery.padding;
@ -194,7 +195,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
Obx( Obx(
() => SizedBox( () => SizedBox(
height: padding.top + height: padding.top +
(_liveRoomController.isPortrait.value || isLandscape (_liveRoomController.isPortrait.value || isLandscape.value
? 0 ? 0
: kToolbarHeight), : kToolbarHeight),
), ),
@ -205,14 +206,14 @@ class _LiveRoomPageState extends State<LiveRoomPage>
if (plPlayerController.isFullScreen.value == true) { if (plPlayerController.isFullScreen.value == true) {
plPlayerController.triggerFullScreen(status: false); plPlayerController.triggerFullScreen(status: false);
} }
if (isLandscape) { if (isLandscape.value) {
verticalScreen(); verticalScreen();
} }
}, },
child: Obx( child: Obx(
() => Container( () => Container(
width: Get.size.width, width: Get.size.width,
height: isLandscape height: isLandscape.value
? Get.size.height ? Get.size.height
: !_liveRoomController.isPortrait.value : !_liveRoomController.isPortrait.value
? Get.size.width * 9 / 16 ? Get.size.width * 9 / 16
@ -313,7 +314,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
), ),
// 消息列表 // 消息列表
Visibility( Visibility(
visible: !isLandscape, visible: !isLandscape.value,
child: Obx( child: Obx(
() => Align( () => Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,

View File

@ -73,7 +73,7 @@ class VideoReplyController extends GetxController {
/// 临时修复 /// 临时修复
final bool flag = replyList final bool flag = replyList
.any((ReplyItemModel reply) => reply.rpid == replies.first.rpid); .any((ReplyItemModel reply) => reply.rpid == replies.first.rpid);
if (replies.length == 1 && flag) { if (replies.length == 1 && flag && type == 'onLoad') {
replies.clear(); replies.clear();
isEnd = true; isEnd = true;
} }