opt handle res

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-29 17:17:35 +08:00
parent b643cb1bd0
commit 924d51d41b
198 changed files with 3715 additions and 2001 deletions

View File

@@ -41,7 +41,7 @@ class LiveRoomController extends GetxController {
bool showDanmaku = true;
int? currentQn;
late List<Map> acceptQnList = <Map>[];
late List<({int code, String desc})> acceptQnList = [];
RxString currentQnDesc = ''.obs;
String? savedDanmaku;
@@ -87,20 +87,20 @@ class LiveRoomController extends GetxController {
}
var res = await LiveHttp.liveRoomInfo(roomId: roomId, qn: currentQn);
if (res['status']) {
isPortrait.value = res['data'].isPortrait ?? false;
RoomInfoModel data = res['data'];
isPortrait.value = data.isPortrait ?? false;
List<CodecItem> codec =
res['data'].playurlInfo.playurl.stream.first.format.first.codec;
data.playurlInfo!.playurl!.stream!.first.format!.first.codec!;
CodecItem item = codec.first;
// 以服务端返回的码率为准
currentQn = item.currentQn!;
List acceptQn = item.acceptQn!;
acceptQnList = acceptQn.map((e) {
return {
'code': e,
'desc': LiveQuality.values
acceptQnList = item.acceptQn!.map((e) {
return (
code: e as int,
desc: LiveQuality.values
.firstWhere((element) => element.code == e)
.description,
};
);
}).toList();
currentQnDesc.value = LiveQuality.values
.firstWhere((element) => element.code == currentQn)

View File

@@ -369,14 +369,14 @@ class _LiveRoomPageState extends State<LiveRoomPage>
titleTextStyle: const TextStyle(color: Colors.white),
title: Obx(
() {
return _liveRoomController.roomInfoH5.value == null
RoomInfoH5Model? roomInfoH5 = _liveRoomController.roomInfoH5.value;
return roomInfoH5 == null
? const SizedBox.shrink()
: Row(
children: [
GestureDetector(
onTap: () {
dynamic uid = _liveRoomController
.roomInfoH5.value!.roomInfo?.uid;
dynamic uid = roomInfoH5.roomInfo?.uid;
Get.toNamed(
'/member?mid=$uid',
arguments: {
@@ -388,8 +388,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
width: 34,
height: 34,
type: ImageType.avatar,
src: _liveRoomController
.roomInfoH5.value!.anchorInfo!.baseInfo!.face,
src: roomInfoH5.anchorInfo!.baseInfo!.face,
),
),
const SizedBox(width: 10),
@@ -397,18 +396,14 @@ class _LiveRoomPageState extends State<LiveRoomPage>
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_liveRoomController
.roomInfoH5.value!.anchorInfo!.baseInfo!.uname!,
roomInfoH5.anchorInfo!.baseInfo!.uname!,
style: const TextStyle(fontSize: 14),
),
const SizedBox(height: 1),
if (_liveRoomController
.roomInfoH5.value!.watchedShow !=
null)
if (roomInfoH5.watchedShow?.textLarge?.isNotEmpty ==
true)
Text(
_liveRoomController.roomInfoH5.value!
.watchedShow!['text_large'] ??
'',
roomInfoH5.watchedShow!.textLarge!,
style: const TextStyle(fontSize: 12),
),
],

View File

@@ -113,10 +113,10 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
return PopupMenuItem<int>(
height: 35,
padding: const EdgeInsets.only(left: 30),
value: e['code'],
onTap: () => liveRoomCtr.changeQn(e['code']),
value: e.code,
onTap: () => liveRoomCtr.changeQn(e.code),
child: Text(
e['desc'],
e.desc,
style:
const TextStyle(color: Colors.white, fontSize: 13),
),