set system brightness

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-11-09 11:44:04 +08:00
parent 1291dc77c8
commit 13c220338c
9 changed files with 47 additions and 16 deletions

View File

@@ -143,7 +143,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
void dispose() {
videoPlayerServiceHandler?.onVideoDetailDispose(heroTag);
WidgetsBinding.instance.removeObserver(this);
if (Utils.isMobile) {
if (Platform.isAndroid && !plPlayerController.setSystemBrightness) {
ScreenBrightnessPlatform.instance.resetApplicationScreenBrightness();
}
PlPlayerController.setPlayCallBack(null);

View File

@@ -82,6 +82,14 @@ List<SettingsModel> get playSettings => [
setKey: SettingBoxKey.enableSlideVolumeBrightness,
defaultVal: true,
),
if (Platform.isAndroid)
const SettingsModel(
settingsType: SettingsType.sw1tch,
title: '调节系统亮度',
leading: Icon(Icons.brightness_6_outlined),
setKey: SettingBoxKey.setSystemBrightness,
defaultVal: false,
),
const SettingsModel(
settingsType: SettingsType.sw1tch,
title: '中间滑动进入/退出全屏',

View File

@@ -110,6 +110,7 @@ class VideoDetailController extends GetxController
PlPlayerController plPlayerController = PlPlayerController.getInstance()
..setCurrBrightness(-1.0);
bool get setSystemBrightness => plPlayerController.setSystemBrightness;
late VideoItem firstVideo;
late AudioItem firstAudio;

View File

@@ -326,7 +326,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
);
if (!Get.previousRoute.startsWith('/video')) {
if (Utils.isMobile) {
if (Platform.isAndroid && !videoDetailController.setSystemBrightness) {
ScreenBrightnessPlatform.instance.resetApplicationScreenBrightness();
}
PlPlayerController.setPlayCallBack(null);
@@ -371,7 +371,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
WidgetsBinding.instance.removeObserver(this);
if (Utils.isMobile) {
if (Platform.isAndroid && !videoDetailController.setSystemBrightness) {
ScreenBrightnessPlatform.instance.resetApplicationScreenBrightness();
}
@@ -418,7 +418,9 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
introController.startTimer();
if (Utils.isMobile && mounted) {
if (mounted &&
Platform.isAndroid &&
!videoDetailController.setSystemBrightness) {
if (videoDetailController.brightness != null) {
plPlayerController?.setCurrBrightness(
videoDetailController.brightness!,