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