使用 flutter 应用更改设备亮度
我需要使用 flutter 应用程序更改设备的亮度。我搜索了互联网,大多数答案都建议使用 screen 包。将其添加到项目并运行应用程序后,日志显示此特定包使用了已弃用的 flutter 功能。因此,这个包不会帮助我让我的应用程序无缝运行。请建议其他一些方法来完成此任务,例如使用 flutter 属性本身,而不是使用某些第 3 方包,因为它们中的大多数甚至都没有经过验证,这对于产品来说并不可取。
I need to change the brightness of the device using the flutter app. I searched the internet and most of the answers suggested using screen package. After adding it to the project and running the app the logs said that this particular package uses features of flutter that have been deprecated. So, this package won't help me to get my app running seamlessly. Please suggest some other way to get this done like by using the flutter properties itself and not using some 3rd party packages as most of them are not even verified which is not preferable for a product.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这看起来像是该包正在使用旧版本的已折旧 API;你可以看看这个PR,它似乎升级了这个包并使其与新的 API 更加兼容。
或者,您可以使用 此包 screen_brightness,它似乎有更好的支持并使用 联合方法,这将支持更多平台。
一个例子可以是:
在 pubspec.yaml 文件中添加以下行
,然后
This seems like the package is using an old version of the depreciated API; you can look at this PR, which appears to upgrade this package and make it more compatible with new APIs.
Alternately, you can use this package screen_brightness, which seems to have better support and use the Federated approach, which will support more platforms.
An example could be:
Add the following lines in your pubspec.yaml file
and then