opt live room

tweak

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-07 12:31:28 +08:00
parent 5c1312bbcd
commit 7376fc788a
9 changed files with 169 additions and 131 deletions

View File

@@ -35,7 +35,7 @@ class DanmakuHttp {
//'aid': aid, //'aid': aid,
'bvid': bvid, 'bvid': bvid,
'progress': progress, 'progress': progress,
'color': colorful == true ? null : color, 'color': colorful == true ? 16777215 : color,
'fontsize': fontsize, 'fontsize': fontsize,
'pool': pool, 'pool': pool,
'rnd': DateTime.now().microsecondsSinceEpoch, 'rnd': DateTime.now().microsecondsSinceEpoch,

View File

@@ -91,26 +91,7 @@ class LiveRoomController extends GetxController {
if (res['status']) { if (res['status']) {
RoomPlayInfoData data = res['data']; RoomPlayInfoData data = res['data'];
if (data.liveStatus != 1) { if (data.liveStatus != 1) {
Get.dialog( _dialog(title: '当前直播间未开播');
AlertDialog(
title: const Text('当前直播间未开播'),
actions: [
TextButton(
onPressed: Get.back,
child: Text(
'关闭',
style: TextStyle(color: Get.theme.colorScheme.outline),
),
),
TextButton(
onPressed: () => Get
..back()
..back(),
child: const Text('退出'),
),
],
),
);
return; return;
} }
isPortrait.value = data.isPortrait ?? false; isPortrait.value = data.isPortrait ?? false;
@@ -145,8 +126,37 @@ class LiveRoomController extends GetxController {
roomId, roomId,
heroTag, heroTag,
); );
} else {
if (res['msg'] != null) {
_dialog(title: res['msg']);
} }
} }
}
void _dialog({
required String title,
}) {
Get.dialog(
AlertDialog(
title: Text(title),
actions: [
TextButton(
onPressed: Get.back,
child: Text(
'关闭',
style: TextStyle(color: Get.theme.colorScheme.outline),
),
),
TextButton(
onPressed: () => Get
..back()
..back(),
child: const Text('退出'),
),
],
),
);
}
LiveMessageStream? msgStream; LiveMessageStream? msgStream;
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();

View File

@@ -370,27 +370,28 @@ class _LiveRoomPageState extends State<LiveRoomPage>
RoomInfoH5Data? roomInfoH5 = _liveRoomController.roomInfoH5.value; RoomInfoH5Data? roomInfoH5 = _liveRoomController.roomInfoH5.value;
return roomInfoH5 == null return roomInfoH5 == null
? const SizedBox.shrink() ? const SizedBox.shrink()
: Row( : GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () =>
Get.toNamed('/member?mid=${roomInfoH5.roomInfo?.uid}'),
child: Row(
spacing: 10,
mainAxisSize: MainAxisSize.min,
children: [ children: [
GestureDetector( NetworkImgLayer(
onTap: () => Get.toNamed(
'/member?mid=${roomInfoH5.roomInfo?.uid}'),
child: NetworkImgLayer(
width: 34, width: 34,
height: 34, height: 34,
type: ImageType.avatar, type: ImageType.avatar,
src: roomInfoH5.anchorInfo!.baseInfo!.face, src: roomInfoH5.anchorInfo!.baseInfo!.face,
), ),
),
const SizedBox(width: 10),
Column( Column(
spacing: 1,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
roomInfoH5.anchorInfo!.baseInfo!.uname!, roomInfoH5.anchorInfo!.baseInfo!.uname!,
style: const TextStyle(fontSize: 14), style: const TextStyle(fontSize: 14),
), ),
const SizedBox(height: 1),
if (roomInfoH5.watchedShow?.textLarge?.isNotEmpty == if (roomInfoH5.watchedShow?.textLarge?.isNotEmpty ==
true) true)
Text( Text(
@@ -400,6 +401,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
], ],
), ),
], ],
),
); );
}, },
), ),

View File

@@ -47,7 +47,13 @@ class BottomControl extends StatelessWidget {
), ),
const Spacer(), const Spacer(),
Obx( Obx(
() => IconButton( () => SizedBox(
width: 35,
height: 35,
child: IconButton(
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
onPressed: () { onPressed: () {
plPlayerController.isOpenDanmu.value = plPlayerController.isOpenDanmu.value =
!plPlayerController.isOpenDanmu.value; !plPlayerController.isOpenDanmu.value;
@@ -63,6 +69,7 @@ class BottomControl extends StatelessWidget {
), ),
), ),
), ),
),
Obx( Obx(
() => Container( () => Container(
height: 30, height: 30,

View File

@@ -30,6 +30,7 @@ class LiveHeaderControl extends StatelessWidget {
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
titleSpacing: 14, titleSpacing: 14,
title: Row( title: Row(
spacing: 10,
children: [ children: [
if (title != null) if (title != null)
Expanded( Expanded(
@@ -55,7 +56,10 @@ class LiveHeaderControl extends StatelessWidget {
) )
else else
const Spacer(), const Spacer(),
IconButton( SizedBox(
width: 35,
height: 35,
child: IconButton(
tooltip: '发弹幕', tooltip: '发弹幕',
style: ButtonStyle( style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero), padding: WidgetStateProperty.all(EdgeInsets.zero),
@@ -67,9 +71,16 @@ class LiveHeaderControl extends StatelessWidget {
color: Colors.white, color: Colors.white,
), ),
), ),
),
Obx( Obx(
() => IconButton( () => SizedBox(
width: 35,
height: 35,
child: IconButton(
onPressed: plPlayerController.setOnlyPlayAudio, onPressed: plPlayerController.setOnlyPlayAudio,
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
icon: plPlayerController.onlyPlayAudio.value icon: plPlayerController.onlyPlayAudio.value
? const Icon( ? const Icon(
size: 18, size: 18,
@@ -83,9 +94,12 @@ class LiveHeaderControl extends StatelessWidget {
), ),
), ),
), ),
const SizedBox(width: 10), ),
if (Platform.isAndroid) ...[ if (Platform.isAndroid)
IconButton( SizedBox(
width: 35,
height: 35,
child: IconButton(
tooltip: '画中画', tooltip: '画中画',
style: ButtonStyle( style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero), padding: WidgetStateProperty.all(EdgeInsets.zero),
@@ -97,7 +111,8 @@ class LiveHeaderControl extends StatelessWidget {
plPlayerController.hiddenControls(false); plPlayerController.hiddenControls(false);
floating.enable( floating.enable(
plPlayerController.direction.value == 'vertical' plPlayerController.direction.value == 'vertical'
? const EnableManual(aspectRatio: Rational.vertical()) ? const EnableManual(
aspectRatio: Rational.vertical())
: const EnableManual(), : const EnableManual(),
); );
} }
@@ -109,9 +124,14 @@ class LiveHeaderControl extends StatelessWidget {
color: Colors.white, color: Colors.white,
), ),
), ),
const SizedBox(width: 10), ),
], SizedBox(
IconButton( width: 35,
height: 35,
child: IconButton(
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
onPressed: () => PageUtils.scheduleExit( onPressed: () => PageUtils.scheduleExit(
context, context,
plPlayerController.isFullScreen.value, plPlayerController.isFullScreen.value,
@@ -123,6 +143,7 @@ class LiveHeaderControl extends StatelessWidget {
color: Colors.white, color: Colors.white,
), ),
), ),
),
], ],
), ),
); );

View File

@@ -8,9 +8,11 @@ import 'package:PiliPlus/models/common/msg/msg_unread_type.dart';
import 'package:PiliPlus/models/common/nav_bar_config.dart'; import 'package:PiliPlus/models/common/nav_bar_config.dart';
import 'package:PiliPlus/utils/storage.dart'; import 'package:PiliPlus/utils/storage.dart';
import 'package:PiliPlus/utils/utils.dart'; import 'package:PiliPlus/utils/utils.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
class MainController extends GetxController { class MainController extends GetxController
with GetSingleTickerProviderStateMixin {
List<NavigationBarType> navigationBars = <NavigationBarType>[]; List<NavigationBarType> navigationBars = <NavigationBarType>[];
RxInt dynCount = 0.obs; RxInt dynCount = 0.obs;
@@ -44,6 +46,14 @@ class MainController extends GetxController {
setNavBarConfig(); setNavBarConfig();
controller = mainTabBarView
? TabController(
vsync: this,
initialIndex: selectedIndex.value,
length: navigationBars.length,
)
: PageController(initialPage: selectedIndex.value);
hideTabBar = hideTabBar =
GStorage.setting.get(SettingBoxKey.hideTabBar, defaultValue: true); GStorage.setting.get(SettingBoxKey.hideTabBar, defaultValue: true);
if (navigationBars.length > 1 && hideTabBar) { if (navigationBars.length > 1 && hideTabBar) {
@@ -174,6 +184,7 @@ class MainController extends GetxController {
@override @override
void onClose() { void onClose() {
bottomBarStream?.close(); bottomBarStream?.close();
controller.dispose();
super.onClose(); super.onClose();
} }
} }

View File

@@ -37,7 +37,7 @@ class MainApp extends StatefulWidget {
} }
class _MainAppState extends State<MainApp> class _MainAppState extends State<MainApp>
with SingleTickerProviderStateMixin, RouteAware, WidgetsBindingObserver { with RouteAware, WidgetsBindingObserver {
final MainController _mainController = Get.put(MainController()); final MainController _mainController = Get.put(MainController());
late final _homeController = Get.put(HomeController()); late final _homeController = Get.put(HomeController());
late final _dynamicController = Get.put(DynamicsController()); late final _dynamicController = Get.put(DynamicsController());
@@ -50,13 +50,6 @@ class _MainAppState extends State<MainApp>
void initState() { void initState() {
super.initState(); super.initState();
_lastSelectTime = DateTime.now().millisecondsSinceEpoch; _lastSelectTime = DateTime.now().millisecondsSinceEpoch;
_mainController.controller = _mainController.mainTabBarView
? TabController(
vsync: this,
initialIndex: _mainController.selectedIndex.value,
length: _mainController.navigationBars.length,
)
: PageController(initialPage: _mainController.selectedIndex.value);
enableMYBar = enableMYBar =
GStorage.setting.get(SettingBoxKey.enableMYBar, defaultValue: true); GStorage.setting.get(SettingBoxKey.enableMYBar, defaultValue: true);
useSideBar = useSideBar =

View File

@@ -1,14 +1,12 @@
import 'dart:math'; import 'dart:math';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models_new/space/space/tab2.dart'; import 'package:PiliPlus/models_new/space/space/tab2.dart';
import 'package:PiliPlus/pages/common/common_data_controller.dart';
import 'package:PiliPlus/pages/member/controller.dart'; import 'package:PiliPlus/pages/member/controller.dart';
import 'package:PiliPlus/utils/extension.dart'; 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';
class MemberContributeCtr extends CommonDataController class MemberContributeCtr extends GetxController
with GetSingleTickerProviderStateMixin { with GetSingleTickerProviderStateMixin {
MemberContributeCtr({ MemberContributeCtr({
required this.heroTag, required this.heroTag,
@@ -49,11 +47,6 @@ class MemberContributeCtr extends CommonDataController
} }
} }
@override
Future<LoadingState> customGetData() {
throw UnimplementedError();
}
@override @override
void onClose() { void onClose() {
tabController?.dispose(); tabController?.dispose();

View File

@@ -1451,6 +1451,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
if (_shouldShowSeasonPanel) '播放列表', if (_shouldShowSeasonPanel) '播放列表',
]; ];
if (videoDetailController.tabCtr.length != tabs.length) { if (videoDetailController.tabCtr.length != tabs.length) {
videoDetailController.tabCtr.dispose();
videoDetailController.tabCtr = TabController( videoDetailController.tabCtr = TabController(
vsync: this, vsync: this,
length: tabs.length, length: tabs.length,