mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-30 04:58:41 +00:00
@@ -36,6 +36,7 @@ import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/size_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
import 'package:PiliPlus/utils/mobile_observer.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
@@ -72,7 +73,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
addObserverMobile(this);
|
||||
_liveRoomController = Get.put(
|
||||
LiveRoomController(heroTag),
|
||||
tag: heroTag,
|
||||
@@ -94,7 +95,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
|
||||
@override
|
||||
Future<void> didPopNext() async {
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
addObserverMobile(this);
|
||||
plPlayerController
|
||||
..isLive = true
|
||||
..danmakuController = _liveRoomController.danmakuController;
|
||||
@@ -121,7 +122,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
|
||||
@override
|
||||
void didPushNext() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
removeObserverMobile(this);
|
||||
plPlayerController.removeStatusLister(playerListener);
|
||||
_liveRoomController
|
||||
..danmakuController?.clear()
|
||||
@@ -148,8 +149,8 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
removeObserverMobile(this);
|
||||
videoPlayerServiceHandler?.onVideoDetailDispose(heroTag);
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
if (Platform.isAndroid && !plPlayerController.setSystemBrightness) {
|
||||
ScreenBrightnessPlatform.instance.resetApplicationScreenBrightness();
|
||||
}
|
||||
|
||||
@@ -196,26 +196,27 @@ class _LiveHeaderControlState extends State<LiveHeaderControl>
|
||||
);
|
||||
},
|
||||
),
|
||||
Obx(() {
|
||||
final continuePlayInBackground =
|
||||
plPlayerController.continuePlayInBackground.value;
|
||||
return ComBtn(
|
||||
height: 30,
|
||||
tooltip: '${continuePlayInBackground ? '关闭' : ''}后台播放',
|
||||
onTap: plPlayerController.setContinuePlayInBackground,
|
||||
icon: continuePlayInBackground
|
||||
? const Icon(
|
||||
size: 18,
|
||||
Icons.play_circle,
|
||||
color: Colors.white,
|
||||
)
|
||||
: const Icon(
|
||||
size: 18,
|
||||
Icons.play_circle_outline,
|
||||
color: Colors.white,
|
||||
),
|
||||
);
|
||||
}),
|
||||
if (PlatformUtils.isMobile)
|
||||
Obx(() {
|
||||
final continuePlayInBackground =
|
||||
plPlayerController.continuePlayInBackground.value;
|
||||
return ComBtn(
|
||||
height: 30,
|
||||
tooltip: '${continuePlayInBackground ? '关闭' : ''}后台播放',
|
||||
onTap: plPlayerController.setContinuePlayInBackground,
|
||||
icon: continuePlayInBackground
|
||||
? const Icon(
|
||||
size: 18,
|
||||
Icons.play_circle,
|
||||
color: Colors.white,
|
||||
)
|
||||
: const Icon(
|
||||
size: 18,
|
||||
Icons.play_circle_outline,
|
||||
color: Colors.white,
|
||||
),
|
||||
);
|
||||
}),
|
||||
ComBtn(
|
||||
height: 30,
|
||||
tooltip: '定时关闭',
|
||||
|
||||
@@ -14,6 +14,7 @@ import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/extension/context_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/size_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/mobile_observer.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
@@ -48,7 +49,7 @@ class _MainAppState extends PopScopeState<MainApp>
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
addObserverMobile(this);
|
||||
if (PlatformUtils.isDesktop) {
|
||||
windowManager
|
||||
..addListener(this)
|
||||
@@ -80,7 +81,7 @@ class _MainAppState extends PopScopeState<MainApp>
|
||||
|
||||
@override
|
||||
void didPopNext() {
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
addObserverMobile(this);
|
||||
_mainController
|
||||
..checkUnreadDynamic()
|
||||
..checkDefaultSearch(true)
|
||||
@@ -90,7 +91,7 @@ class _MainAppState extends PopScopeState<MainApp>
|
||||
|
||||
@override
|
||||
void didPushNext() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
removeObserverMobile(this);
|
||||
super.didPushNext();
|
||||
}
|
||||
|
||||
@@ -110,7 +111,7 @@ class _MainAppState extends PopScopeState<MainApp>
|
||||
trayManager.removeListener(this);
|
||||
windowManager.removeListener(this);
|
||||
}
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
removeObserverMobile(this);
|
||||
PiliScheme.listener?.cancel();
|
||||
GStorage.close();
|
||||
super.dispose();
|
||||
|
||||
@@ -54,6 +54,7 @@ import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/scroll_controller_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
import 'package:PiliPlus/utils/mobile_observer.dart';
|
||||
import 'package:PiliPlus/utils/num_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
@@ -162,7 +163,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
videoSourceInit();
|
||||
autoScreen();
|
||||
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
addObserverMobile(this);
|
||||
}
|
||||
|
||||
// 获取视频资源,初始化播放器
|
||||
@@ -372,7 +373,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
PlPlayerController.updatePlayCount();
|
||||
}
|
||||
}
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
removeObserverMobile(this);
|
||||
if (PlatformUtils.isMobile) {
|
||||
showStatusBar();
|
||||
}
|
||||
@@ -385,7 +386,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
super.didPushNext();
|
||||
isShowing = false;
|
||||
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
removeObserverMobile(this);
|
||||
|
||||
if (Platform.isAndroid && !videoDetailController.setSystemBrightness) {
|
||||
ScreenBrightnessPlatform.instance.resetApplicationScreenBrightness();
|
||||
@@ -418,7 +419,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
|
||||
isShowing = true;
|
||||
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
addObserverMobile(this);
|
||||
|
||||
plPlayerController?.isLive = false;
|
||||
if (videoDetailController.plPlayerController.playerStatus.isPlaying &&
|
||||
|
||||
Reference in New Issue
Block a user