Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset user brightness / Turn off plugin #14

Open
kuroisuna opened this issue May 20, 2019 · 4 comments
Open

Reset user brightness / Turn off plugin #14

kuroisuna opened this issue May 20, 2019 · 4 comments

Comments

@kuroisuna
Copy link

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 😁.

@pikaju
Copy link

pikaju commented Jun 6, 2019

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.

@karansingla007
Copy link

#17
please see this PR @pikaju

@pikaju
Copy link

pikaju commented Sep 11, 2019

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

@Ndivhuwo
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants