mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-08-04 17:50:13 +08:00
fix: parse live info
opt: items Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -31,12 +31,7 @@ class VideoCardHGrpc extends StatelessWidget {
|
|||||||
final int aid = videoItem.smallCoverV5.base.args.aid.toInt();
|
final int aid = videoItem.smallCoverV5.base.args.aid.toInt();
|
||||||
String type = 'video';
|
String type = 'video';
|
||||||
final String heroTag = Utils.makeHeroTag(aid);
|
final String heroTag = Utils.makeHeroTag(aid);
|
||||||
return Stack(
|
return InkWell(
|
||||||
clipBehavior: Clip.none,
|
|
||||||
children: [
|
|
||||||
Semantics(
|
|
||||||
excludeSemantics: true,
|
|
||||||
child: InkWell(
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
onLongPress: () => imageSaveDialog(
|
onLongPress: () => imageSaveDialog(
|
||||||
title: videoItem.smallCoverV5.base.title,
|
title: videoItem.smallCoverV5.base.title,
|
||||||
@@ -62,8 +57,8 @@ class VideoCardHGrpc extends StatelessWidget {
|
|||||||
AspectRatio(
|
AspectRatio(
|
||||||
aspectRatio: StyleString.aspectRatio,
|
aspectRatio: StyleString.aspectRatio,
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (BuildContext context,
|
builder:
|
||||||
BoxConstraints boxConstraints) {
|
(BuildContext context, BoxConstraints boxConstraints) {
|
||||||
final double maxWidth = boxConstraints.maxWidth;
|
final double maxWidth = boxConstraints.maxWidth;
|
||||||
final double maxHeight = boxConstraints.maxHeight;
|
final double maxHeight = boxConstraints.maxHeight;
|
||||||
return Stack(
|
return Stack(
|
||||||
@@ -77,8 +72,7 @@ class VideoCardHGrpc extends StatelessWidget {
|
|||||||
height: maxHeight,
|
height: maxHeight,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (videoItem
|
if (videoItem.smallCoverV5.coverRightText1.isNotEmpty)
|
||||||
.smallCoverV5.coverRightText1.isNotEmpty)
|
|
||||||
PBadge(
|
PBadge(
|
||||||
text: Utils.timeFormat(
|
text: Utils.timeFormat(
|
||||||
videoItem.smallCoverV5.coverRightText1),
|
videoItem.smallCoverV5.coverRightText1),
|
||||||
@@ -104,9 +98,6 @@ class VideoCardHGrpc extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,12 +55,7 @@ class VideoCardVMemberHome extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Stack(
|
return Card(
|
||||||
clipBehavior: Clip.none,
|
|
||||||
children: [
|
|
||||||
Semantics(
|
|
||||||
excludeSemantics: true,
|
|
||||||
child: Card(
|
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
margin: EdgeInsets.zero,
|
margin: EdgeInsets.zero,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
@@ -103,9 +98,6 @@ class VideoCardVMemberHome extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,16 @@ class RoomInfoH5Model {
|
|||||||
Map? blockInfo;
|
Map? blockInfo;
|
||||||
|
|
||||||
RoomInfoH5Model.fromJson(Map<String, dynamic> json) {
|
RoomInfoH5Model.fromJson(Map<String, dynamic> json) {
|
||||||
roomInfo = RoomInfo.fromJson(json['room_info']);
|
roomInfo =
|
||||||
anchorInfo = AnchorInfo.fromJson(json['anchor_info']);
|
json['room_info'] == null ? null : RoomInfo.fromJson(json['room_info']);
|
||||||
|
anchorInfo = json['anchor_info'] == null
|
||||||
|
? null
|
||||||
|
: AnchorInfo.fromJson(json['anchor_info']);
|
||||||
isRoomFeed = json['is_room_feed'];
|
isRoomFeed = json['is_room_feed'];
|
||||||
watchedShow = json['watched_show'];
|
watchedShow = json['watched_show'];
|
||||||
likeInfoV3 = LikeInfoV3.fromJson(json['like_info_v3']);
|
likeInfoV3 = json['like_info_v3'] == null
|
||||||
|
? null
|
||||||
|
: LikeInfoV3.fromJson(json['like_info_v3']);
|
||||||
blockInfo = json['block_info'];
|
blockInfo = json['block_info'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,15 +87,18 @@ class RoomInfo {
|
|||||||
class AnchorInfo {
|
class AnchorInfo {
|
||||||
AnchorInfo({
|
AnchorInfo({
|
||||||
this.baseInfo,
|
this.baseInfo,
|
||||||
this.relationInfo,
|
// this.relationInfo,
|
||||||
});
|
});
|
||||||
|
|
||||||
BaseInfo? baseInfo;
|
BaseInfo? baseInfo;
|
||||||
RelationInfo? relationInfo;
|
// RelationInfo? relationInfo;
|
||||||
|
|
||||||
AnchorInfo.fromJson(Map<String, dynamic> json) {
|
AnchorInfo.fromJson(Map<String, dynamic> json) {
|
||||||
baseInfo = BaseInfo.fromJson(json['base_info']);
|
baseInfo =
|
||||||
relationInfo = RelationInfo.fromJson(json['relation_info']);
|
json['base_info'] == null ? null : BaseInfo.fromJson(json['base_info']);
|
||||||
|
// relationInfo = json['relation_info'] == null
|
||||||
|
// ? null
|
||||||
|
// : RelationInfo.fromJson(json['relation_info']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,20 +43,13 @@ class BangumiCardVMemberHome extends StatelessWidget {
|
|||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
aspectRatio: 0.75,
|
aspectRatio: 0.75,
|
||||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||||
final double maxWidth = boxConstraints.maxWidth;
|
return Hero(
|
||||||
final double maxHeight = boxConstraints.maxHeight;
|
|
||||||
return Stack(
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
children: [
|
|
||||||
Hero(
|
|
||||||
tag: heroTag,
|
tag: heroTag,
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
src: bangumiItem.cover,
|
src: bangumiItem.cover,
|
||||||
width: maxWidth,
|
width: boxConstraints.maxWidth,
|
||||||
height: maxHeight,
|
height: boxConstraints.maxHeight,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class LiveRoomController extends GetxController {
|
|||||||
RxBool volumeOff = false.obs;
|
RxBool volumeOff = false.obs;
|
||||||
PlPlayerController plPlayerController =
|
PlPlayerController plPlayerController =
|
||||||
PlPlayerController.getInstance(videoType: 'live');
|
PlPlayerController.getInstance(videoType: 'live');
|
||||||
Rx<RoomInfoH5Model> roomInfoH5 = RoomInfoH5Model().obs;
|
Rx<RoomInfoH5Model?> roomInfoH5 = Rx<RoomInfoH5Model?>(null);
|
||||||
|
|
||||||
RxList<dynamic> messages = [].obs;
|
RxList<dynamic> messages = [].obs;
|
||||||
RxBool disableAutoScroll = false.obs;
|
RxBool disableAutoScroll = false.obs;
|
||||||
@@ -50,6 +50,7 @@ class LiveRoomController extends GetxController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
roomId = int.parse(Get.parameters['roomid']!);
|
roomId = int.parse(Get.parameters['roomid']!);
|
||||||
|
queryLiveInfoH5();
|
||||||
if (Accounts.main.isLogin && !MineController.anonymity.value) {
|
if (Accounts.main.isLogin && !MineController.anonymity.value) {
|
||||||
VideoHttp.roomEntryAction(roomId: roomId);
|
VideoHttp.roomEntryAction(roomId: roomId);
|
||||||
}
|
}
|
||||||
@@ -131,7 +132,6 @@ class LiveRoomController extends GetxController {
|
|||||||
heroTag,
|
heroTag,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LiveMessageStream? msgStream;
|
LiveMessageStream? msgStream;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:PiliPlus/models/live/room_info_h5.dart';
|
||||||
import 'package:PiliPlus/pages/live_room/send_dm_panel.dart';
|
import 'package:PiliPlus/pages/live_room/send_dm_panel.dart';
|
||||||
import 'package:PiliPlus/pages/live_room/widgets/chat.dart';
|
import 'package:PiliPlus/pages/live_room/widgets/chat.dart';
|
||||||
import 'package:PiliPlus/pages/live_room/widgets/header_control.dart';
|
import 'package:PiliPlus/pages/live_room/widgets/header_control.dart';
|
||||||
@@ -36,7 +37,6 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
|||||||
late final int _roomId;
|
late final int _roomId;
|
||||||
late final LiveRoomController _liveRoomController;
|
late final LiveRoomController _liveRoomController;
|
||||||
late final PlPlayerController plPlayerController;
|
late final PlPlayerController plPlayerController;
|
||||||
late Future? _futureBuilder;
|
|
||||||
late Future? _futureBuilderFuture;
|
late Future? _futureBuilderFuture;
|
||||||
bool get isFullScreen => plPlayerController.isFullScreen.value;
|
bool get isFullScreen => plPlayerController.isFullScreen.value;
|
||||||
|
|
||||||
@@ -113,7 +113,6 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
void videoSourceInit() {
|
void videoSourceInit() {
|
||||||
_futureBuilder = _liveRoomController.queryLiveInfoH5();
|
|
||||||
plPlayerController = _liveRoomController.plPlayerController;
|
plPlayerController = _liveRoomController.plPlayerController;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,14 +221,14 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
|||||||
: Positioned.fill(
|
: Positioned.fill(
|
||||||
child: Opacity(
|
child: Opacity(
|
||||||
opacity: 0.6,
|
opacity: 0.6,
|
||||||
child: _liveRoomController.roomInfoH5.value.roomInfo
|
child: _liveRoomController.roomInfoH5.value?.roomInfo
|
||||||
?.appBackground?.isNotEmpty ==
|
?.appBackground?.isNotEmpty ==
|
||||||
true
|
true
|
||||||
? CachedNetworkImage(
|
? CachedNetworkImage(
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
width: Get.width,
|
width: Get.width,
|
||||||
height: Get.height,
|
height: Get.height,
|
||||||
imageUrl: _liveRoomController.roomInfoH5.value
|
imageUrl: _liveRoomController.roomInfoH5.value!
|
||||||
.roomInfo!.appBackground!.http2https,
|
.roomInfo!.appBackground!.http2https,
|
||||||
)
|
)
|
||||||
: Image.asset(
|
: Image.asset(
|
||||||
@@ -367,21 +366,16 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
|||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
toolbarHeight: isFullScreen ? 0 : null,
|
toolbarHeight: isFullScreen ? 0 : null,
|
||||||
titleTextStyle: TextStyle(color: Colors.white),
|
titleTextStyle: TextStyle(color: Colors.white),
|
||||||
title: FutureBuilder(
|
title: Obx(
|
||||||
future: _futureBuilder,
|
() {
|
||||||
builder: (context, snapshot) {
|
return _liveRoomController.roomInfoH5.value == null
|
||||||
if (snapshot.data == null) {
|
? const SizedBox.shrink()
|
||||||
return const SizedBox.shrink();
|
: Row(
|
||||||
}
|
|
||||||
Map data = snapshot.data as Map;
|
|
||||||
if (data['status']) {
|
|
||||||
return Obx(
|
|
||||||
() => Row(
|
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
dynamic uid =
|
dynamic uid = _liveRoomController
|
||||||
_liveRoomController.roomInfoH5.value.roomInfo?.uid;
|
.roomInfoH5.value!.roomInfo?.uid;
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
'/member?mid=$uid',
|
'/member?mid=$uid',
|
||||||
arguments: {
|
arguments: {
|
||||||
@@ -394,7 +388,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
|||||||
height: 34,
|
height: 34,
|
||||||
type: 'avatar',
|
type: 'avatar',
|
||||||
src: _liveRoomController
|
src: _liveRoomController
|
||||||
.roomInfoH5.value.anchorInfo!.baseInfo!.face,
|
.roomInfoH5.value!.anchorInfo!.baseInfo!.face,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
@@ -403,14 +397,15 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
_liveRoomController
|
_liveRoomController
|
||||||
.roomInfoH5.value.anchorInfo!.baseInfo!.uname!,
|
.roomInfoH5.value!.anchorInfo!.baseInfo!.uname!,
|
||||||
style: const TextStyle(fontSize: 14),
|
style: const TextStyle(fontSize: 14),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 1),
|
const SizedBox(height: 1),
|
||||||
if (_liveRoomController.roomInfoH5.value.watchedShow !=
|
if (_liveRoomController
|
||||||
|
.roomInfoH5.value!.watchedShow !=
|
||||||
null)
|
null)
|
||||||
Text(
|
Text(
|
||||||
_liveRoomController.roomInfoH5.value
|
_liveRoomController.roomInfoH5.value!
|
||||||
.watchedShow!['text_large'] ??
|
.watchedShow!['text_large'] ??
|
||||||
'',
|
'',
|
||||||
style: const TextStyle(fontSize: 12),
|
style: const TextStyle(fontSize: 12),
|
||||||
@@ -418,11 +413,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
@@ -452,27 +443,24 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (_liveRoomController.roomInfoH5.value != null)
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
try {
|
try {
|
||||||
|
RoomInfoH5Model roomInfo =
|
||||||
|
_liveRoomController.roomInfoH5.value!;
|
||||||
PageUtils.pmShare(
|
PageUtils.pmShare(
|
||||||
this.context,
|
this.context,
|
||||||
content: {
|
content: {
|
||||||
"cover": _liveRoomController
|
"cover": roomInfo.roomInfo!.cover!,
|
||||||
.roomInfoH5.value.roomInfo!.cover!,
|
|
||||||
"sourceID": _liveRoomController.roomId.toString(),
|
"sourceID": _liveRoomController.roomId.toString(),
|
||||||
"title": _liveRoomController
|
"title": roomInfo.roomInfo!.title!,
|
||||||
.roomInfoH5.value.roomInfo!.title!,
|
|
||||||
"url":
|
"url":
|
||||||
"https://live.bilibili.com/${_liveRoomController.roomId}",
|
"https://live.bilibili.com/${_liveRoomController.roomId}",
|
||||||
"authorID": _liveRoomController
|
"authorID": roomInfo.roomInfo!.uid.toString(),
|
||||||
.roomInfoH5.value.roomInfo!.uid
|
|
||||||
.toString(),
|
|
||||||
"source": "直播",
|
"source": "直播",
|
||||||
"desc": _liveRoomController
|
"desc": roomInfo.roomInfo!.title!,
|
||||||
.roomInfoH5.value.roomInfo!.title!,
|
"author": roomInfo.anchorInfo!.baseInfo!.uname,
|
||||||
"author": _liveRoomController
|
|
||||||
.roomInfoH5.value.anchorInfo!.baseInfo!.uname,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -45,15 +45,10 @@ class MemberFavItem extends StatelessWidget {
|
|||||||
aspectRatio: StyleString.aspectRatio,
|
aspectRatio: StyleString.aspectRatio,
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, boxConstraints) {
|
builder: (context, boxConstraints) {
|
||||||
return Stack(
|
return NetworkImgLayer(
|
||||||
clipBehavior: Clip.none,
|
|
||||||
children: [
|
|
||||||
NetworkImgLayer(
|
|
||||||
src: item['cover'],
|
src: item['cover'],
|
||||||
width: boxConstraints.maxWidth,
|
width: boxConstraints.maxWidth,
|
||||||
height: boxConstraints.maxHeight,
|
height: boxConstraints.maxHeight,
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -85,10 +85,7 @@ class SubVideoCardH extends StatelessWidget {
|
|||||||
|
|
||||||
Widget videoContent(context) {
|
Widget videoContent(context) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Stack(
|
child: Column(
|
||||||
clipBehavior: Clip.none,
|
|
||||||
children: [
|
|
||||||
Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -128,8 +125,6 @@ class SubVideoCardH extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -732,7 +732,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
return Stack(
|
return Stack(
|
||||||
fit: StackFit.passthrough,
|
fit: StackFit.passthrough,
|
||||||
key: _playerKey,
|
key: _playerKey,
|
||||||
clipBehavior: Clip.none,
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Obx(
|
Obx(
|
||||||
() => Video(
|
() => Video(
|
||||||
|
|||||||
Reference in New Issue
Block a user