mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: live room
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -165,10 +165,7 @@ class DynamicsController extends GetxController
|
||||
'roomid': liveRcmd.roomId,
|
||||
'watched_show': liveRcmd.watchedShow,
|
||||
});
|
||||
Utils.toDupNamed('/liveRoom?roomid=${liveItem.roomId}', arguments: {
|
||||
'liveItem': liveItem,
|
||||
'heroTag': liveItem.roomId.toString()
|
||||
});
|
||||
Utils.toDupNamed('/liveRoom?roomid=${liveItem.roomId}');
|
||||
break;
|
||||
|
||||
/// 合集查看
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/dynamics/up.dart';
|
||||
import 'package:PiliPlus/models/live/item.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
|
||||
@@ -142,16 +141,13 @@ class _UpPanelState extends State<UpPanel> {
|
||||
// );
|
||||
setState(() {});
|
||||
} else if (data.type == 'live') {
|
||||
LiveItemModel liveItem = LiveItemModel.fromJson({
|
||||
'title': data.title,
|
||||
'uname': data.uname,
|
||||
'face': data.face,
|
||||
'roomid': data.roomId,
|
||||
});
|
||||
Get.toNamed(
|
||||
'/liveRoom?roomid=${data.roomId}',
|
||||
arguments: {'liveItem': liveItem},
|
||||
);
|
||||
// LiveItemModel liveItem = LiveItemModel.fromJson({
|
||||
// 'title': data.title,
|
||||
// 'uname': data.uname,
|
||||
// 'face': data.face,
|
||||
// 'roomid': data.roomId,
|
||||
// });
|
||||
Get.toNamed('/liveRoom?roomid=${data.roomId}');
|
||||
}
|
||||
},
|
||||
onLongPress: () {
|
||||
|
||||
@@ -12,7 +12,6 @@ import 'package:PiliPlus/http/search.dart';
|
||||
import 'package:PiliPlus/http/user.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/common/business_type.dart';
|
||||
import 'package:PiliPlus/models/live/item.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -55,18 +54,15 @@ class HistoryItem extends StatelessWidget {
|
||||
"https://www.bilibili.com/read/cv${videoItem.history.oid}"));
|
||||
} else if (videoItem.history.business == 'live') {
|
||||
if (videoItem.liveStatus == 1) {
|
||||
LiveItemModel liveItem = LiveItemModel.fromJson({
|
||||
'face': videoItem.authorFace,
|
||||
'roomid': videoItem.history.oid,
|
||||
'pic': videoItem.cover,
|
||||
'title': videoItem.title,
|
||||
'uname': videoItem.authorName,
|
||||
'cover': videoItem.cover,
|
||||
});
|
||||
Get.toNamed(
|
||||
'/liveRoom?roomid=${videoItem.history.oid}',
|
||||
arguments: {'liveItem': liveItem},
|
||||
);
|
||||
// LiveItemModel liveItem = LiveItemModel.fromJson({
|
||||
// 'face': videoItem.authorFace,
|
||||
// 'roomid': videoItem.history.oid,
|
||||
// 'pic': videoItem.cover,
|
||||
// 'title': videoItem.title,
|
||||
// 'uname': videoItem.authorName,
|
||||
// 'cover': videoItem.cover,
|
||||
// });
|
||||
Get.toNamed('/liveRoom?roomid=${videoItem.history.oid}');
|
||||
} else {
|
||||
SmartDialog.showToast('直播未开播');
|
||||
}
|
||||
|
||||
@@ -223,11 +223,6 @@ class _LivePageState extends State<LivePage>
|
||||
onTap: () {
|
||||
Get.toNamed(
|
||||
'/liveRoom?roomid=${loadingState.response[index].roomId}',
|
||||
arguments: {
|
||||
'liveItem': loadingState.response[index],
|
||||
'heroTag':
|
||||
loadingState.response[index].roomId.toString()
|
||||
},
|
||||
);
|
||||
},
|
||||
onLongPress: () {
|
||||
|
||||
@@ -23,8 +23,7 @@ class LiveCardV extends StatelessWidget {
|
||||
margin: EdgeInsets.zero,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed('/liveRoom?roomid=${liveItem.roomId}',
|
||||
arguments: {'liveItem': liveItem, 'heroTag': heroTag});
|
||||
Get.toNamed('/liveRoom?roomid=${liveItem.roomId}');
|
||||
},
|
||||
onLongPress: () => imageSaveDialog(
|
||||
context: context,
|
||||
|
||||
@@ -23,8 +23,7 @@ class LiveCardVFollow extends StatelessWidget {
|
||||
margin: EdgeInsets.zero,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed('/liveRoom?roomid=${liveItem.roomId}',
|
||||
arguments: {'liveItem': liveItem, 'heroTag': heroTag});
|
||||
Get.toNamed('/liveRoom?roomid=${liveItem.roomId}');
|
||||
},
|
||||
onLongPress: () => imageSaveDialog(
|
||||
context: context,
|
||||
|
||||
@@ -16,17 +16,14 @@ import '../../models/live/room_info_h5.dart';
|
||||
import '../../utils/video_utils.dart';
|
||||
|
||||
class LiveRoomController extends GetxController {
|
||||
String cover = '';
|
||||
late int roomId;
|
||||
dynamic liveItem;
|
||||
late String heroTag;
|
||||
double volume = 0.0;
|
||||
// 静音状态
|
||||
RxBool volumeOff = false.obs;
|
||||
PlPlayerController plPlayerController =
|
||||
PlPlayerController.getInstance(videoType: 'live');
|
||||
Rx<RoomInfoH5Model> roomInfoH5 = RoomInfoH5Model().obs;
|
||||
// late bool enableCDN;
|
||||
|
||||
RxList<dynamic> messages = [].obs;
|
||||
RxBool disableAutoScroll = false.obs;
|
||||
@@ -38,19 +35,6 @@ class LiveRoomController extends GetxController {
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
roomId = int.parse(Get.parameters['roomid']!);
|
||||
if (Get.arguments != null) {
|
||||
liveItem = Get.arguments['liveItem'];
|
||||
heroTag = Get.arguments['heroTag'] ?? '';
|
||||
if (liveItem != null) {
|
||||
cover = (liveItem.pic != null && liveItem.pic != '')
|
||||
? liveItem.pic
|
||||
: (liveItem.cover != null && liveItem.cover != '')
|
||||
? liveItem.cover
|
||||
: null;
|
||||
}
|
||||
}
|
||||
// CDN优化
|
||||
// enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
|
||||
}
|
||||
|
||||
playerInit(source) async {
|
||||
|
||||
@@ -28,7 +28,7 @@ class LiveRoomPage extends StatefulWidget {
|
||||
class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
with WidgetsBindingObserver {
|
||||
late final int _roomId;
|
||||
final LiveRoomController _liveRoomController = Get.put(LiveRoomController());
|
||||
late final LiveRoomController _liveRoomController;
|
||||
late final PlPlayerController plPlayerController;
|
||||
late Future? _futureBuilder;
|
||||
late Future? _futureBuilderFuture;
|
||||
@@ -55,6 +55,10 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
_roomId = int.parse(Get.parameters['roomid'] ?? '-1');
|
||||
_liveRoomController = Get.put(
|
||||
LiveRoomController(),
|
||||
tag: Utils.makeHeroTag(_roomId),
|
||||
);
|
||||
PlPlayerController.setPlayCallBack(playCallBack);
|
||||
if (Platform.isAndroid) {
|
||||
floating = Floating();
|
||||
|
||||
@@ -472,10 +472,7 @@ class UserInfoCard extends StatelessWidget {
|
||||
left: 20,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(
|
||||
'/liveRoom?roomid=${live['roomid']}',
|
||||
arguments: {'heroTag': '${live['roomid']}'},
|
||||
);
|
||||
Get.toNamed('/liveRoom?roomid=${live['roomid']}');
|
||||
},
|
||||
child: Container(
|
||||
width: 85,
|
||||
@@ -487,6 +484,9 @@ class UserInfoCard extends StatelessWidget {
|
||||
Icon(
|
||||
Icons.equalizer_rounded,
|
||||
size: MediaQuery.textScalerOf(context).scale(16),
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSecondaryContainer,
|
||||
),
|
||||
Text(
|
||||
'直播中',
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/live/item.dart';
|
||||
import 'package:PiliPlus/models/member/info.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
|
||||
@@ -47,16 +46,15 @@ class ProfilePanel extends StatelessWidget {
|
||||
left: 14,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
LiveItemModel liveItem = LiveItemModel.fromJson({
|
||||
'title': memberInfo.liveRoom!.title,
|
||||
'uname': memberInfo.name,
|
||||
'face': memberInfo.face,
|
||||
'roomid': memberInfo.liveRoom!.roomId,
|
||||
'watched_show': memberInfo.liveRoom!.watchedShow,
|
||||
});
|
||||
// LiveItemModel liveItem = LiveItemModel.fromJson({
|
||||
// 'title': memberInfo.liveRoom!.title,
|
||||
// 'uname': memberInfo.name,
|
||||
// 'face': memberInfo.face,
|
||||
// 'roomid': memberInfo.liveRoom!.roomId,
|
||||
// 'watched_show': memberInfo.liveRoom!.watchedShow,
|
||||
// });
|
||||
Get.toNamed(
|
||||
'/liveRoom?roomid=${memberInfo.liveRoom!.roomId}',
|
||||
arguments: {'liveItem': liveItem},
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
|
||||
import '../../../utils/grid.dart';
|
||||
|
||||
@@ -53,15 +52,13 @@ class LiveItem extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String heroTag = Utils.makeHeroTag(liveItem.roomid);
|
||||
return Card(
|
||||
elevation: 1,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
margin: EdgeInsets.zero,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
Get.toNamed('/liveRoom?roomid=${liveItem.roomid}',
|
||||
arguments: {'liveItem': liveItem, 'heroTag': heroTag});
|
||||
Get.toNamed('/liveRoom?roomid=${liveItem.roomid}');
|
||||
},
|
||||
onLongPress: () => imageSaveDialog(
|
||||
context: context,
|
||||
|
||||
@@ -86,8 +86,7 @@ class PiliScheme {
|
||||
}
|
||||
} else if (host == 'live') {
|
||||
final String roomId = path.split('/').last;
|
||||
Utils.toDupNamed('/liveRoom?roomid=$roomId',
|
||||
arguments: <String, String?>{'liveItem': null, 'heroTag': roomId});
|
||||
Utils.toDupNamed('/liveRoom?roomid=$roomId');
|
||||
} else if (host == 'bangumi') {
|
||||
if (path.startsWith('/season')) {
|
||||
final String seasonId = path.split('/').last;
|
||||
@@ -307,10 +306,7 @@ class PiliScheme {
|
||||
debugPrint('bilibili.com');
|
||||
} else if (host.contains('live')) {
|
||||
int roomId = int.parse(path.split('/').last);
|
||||
Utils.toDupNamed(
|
||||
'/liveRoom?roomid=$roomId',
|
||||
arguments: {'liveItem': null, 'heroTag': roomId.toString()},
|
||||
);
|
||||
Utils.toDupNamed('/liveRoom?roomid=$roomId');
|
||||
return;
|
||||
} else if (host.contains('space')) {
|
||||
var mid = path.split('/').last;
|
||||
|
||||
Reference in New Issue
Block a user