flutter_screen icon indicating copy to clipboard operation
flutter_screen copied to clipboard

Reset user brightness / Turn off plugin

Open kuroisuna opened this issue 5 years ago • 4 comments

It might be related to this comment: https://github.com/clovisnicolas/flutter_screen/issues/8#issuecomment-487923284

It would be great to have a way to reset the user brightness, but more like turning off the plugin.

This is because (as the related comment says) it becomes impossible to manually change the brightness.

// on initState, get original brightness.
_userBrightnessRatio = await Screen.brightness;
...
// This correctly sets the original brightness back, but
// there is no way to change it using the user preferences.
// You need to close the app to be able to change it.
Screen.setBrightness(_userBrightnessRatio);

Do you believe there is a way to do this? I thought of adding the proper method to the https://github.com/clovisnicolas/flutter_screen/blob/master/android/src/main/java/flutter/plugins/screen/screen/ScreenPlugin.java file. I would be willing to create a PR if we could find a solution 😁.

kuroisuna avatar May 20 '19 00:05 kuroisuna

Please someone work on this. I can't do the iOS part and I also can't find the solution for it, perhaps the problem does not even exist on iOS? On Android, you can set the brightness to BRIGHTNESS_OVERRIDE_NONE (which is -1.0f), and that will disable the override.

pikaju avatar Jun 06 '19 18:06 pikaju

https://github.com/clovisnicolas/flutter_screen/pull/17 please see this PR @Pikaju

karansingla007 avatar Sep 09 '19 10:09 karansingla007

@singlakaran I'm not the owner of this repository so I can't merge

pikaju avatar Sep 11 '19 00:09 pikaju

It might be related to this comment: #8 (comment)

It would be great to have a way to reset the user brightness, but more like turning off the plugin.

This is because (as the related comment says) it becomes impossible to manually change the brightness.

// on initState, get original brightness.
_userBrightnessRatio = await Screen.brightness;
...
// This correctly sets the original brightness back, but
// there is no way to change it using the user preferences.
// You need to close the app to be able to change it.
Screen.setBrightness(_userBrightnessRatio);

Do you believe there is a way to do this? I thought of adding the proper method to the https://github.com/clovisnicolas/flutter_screen/blob/master/android/src/main/java/flutter/plugins/screen/screen/ScreenPlugin.java file. I would be willing to create a PR if we could find a solution 😁.

This solution works for resetting on iOS, but on Android reset using BRIGHTNESS_OVERRIDE_NONE (which is -1)

Ndivhuwo avatar Jul 29 '20 10:07 Ndivhuwo