From 17a87d23366419ff1ea7ccb226ce18ad6adc9395 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sun, 24 Nov 2024 22:08:45 +0800 Subject: [PATCH] fix: liveRoom layout error --- lib/http/init.dart | 11 ++++++---- lib/pages/live_room/view.dart | 41 +++++++++++++++++++---------------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/lib/http/init.dart b/lib/http/init.dart index 03de43b7..9c0f368c 100644 --- a/lib/http/init.dart +++ b/lib/http/init.dart @@ -68,7 +68,7 @@ class Request { // 从cookie中获取 csrf token static Future getCsrf() async { List cookies = await cookieManager.cookieJar - .loadForRequest(Uri.parse(HttpString.apiBaseUrl)); + .loadForRequest(Uri.parse(HttpString.baseUrl)); String token = ''; if (cookies.where((e) => e.name == 'bili_jct').isNotEmpty) { token = cookies.firstWhere((e) => e.name == 'bili_jct').value; @@ -82,9 +82,12 @@ class Request { } final List cookies = await cookieManager.cookieJar - .loadForRequest(Uri.parse(HttpString.baseUrl)); - buvid = cookies.firstWhere((cookie) => cookie.name == 'buvid3').value; - if (buvid == null) { + .loadForRequest(Uri.parse(HttpString.apiBaseUrl)); + buvid = cookies + .firstWhere((cookie) => cookie.name == 'buvid3', + orElse: () => Cookie('buvid3', '')) + .value; + if (buvid == null || buvid!.isEmpty) { try { var result = await Request().get( "${HttpString.apiBaseUrl}/x/frontend/finger/spi", diff --git a/lib/pages/live_room/view.dart b/lib/pages/live_room/view.dart index 11864391..ced55e37 100644 --- a/lib/pages/live_room/view.dart +++ b/lib/pages/live_room/view.dart @@ -312,25 +312,28 @@ class _LiveRoomPageState extends State ), ), // 消息列表 - Obx( - () => Align( - alignment: Alignment.bottomCenter, - child: Container( - margin: EdgeInsets.only( - bottom: 90 + padding.bottom, - ), - height: Get.size.height - - (padding.top + - kToolbarHeight + - (_liveRoomController.isPortrait.value - ? Get.size.width - : Get.size.width * 9 / 16) + - 100 + - padding.bottom), - child: buildMessageListUI( - context, - _liveRoomController, - _scrollController, + Visibility( + visible: !isLandscape, + child: Obx( + () => Align( + alignment: Alignment.bottomCenter, + child: Container( + margin: EdgeInsets.only( + bottom: 90 + padding.bottom, + ), + height: Get.size.height - + (padding.top + + kToolbarHeight + + (_liveRoomController.isPortrait.value + ? Get.size.width + : Get.size.width * 9 / 16) + + 100 + + padding.bottom), + child: buildMessageListUI( + context, + _liveRoomController, + _scrollController, + ), ), ), ),