wakelock_plus
Flutter 插件,可在 Android、iOS、macOS、Windows、Linux 和 Web 上保持设备屏幕常亮。
- 星标
- 110
- 复刻
- 97
- 最近推送(UTC)
- 2026年9月1日
- 项目状态
- 未归档
原始 README
以下为英文项目原文快照,最新内容请访问 GitHub。
Wakelock Plus
A continuation of the original Flutter plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping.
Supported platforms
| Platform | wakelock_plus support |
|---|---|
| Android | ✅ |
| iOS | ✅ |
| Web | ✅ |
| macOS | ✅ |
| Windows | ✅ |
| Linux | ✅ |
Getting started
To learn more about the plugin and getting started, you can view the main package's README.
Plugin structure
This plugin plugin uses the federated plugins approach.
Android, iOS, macOS (via Hybrid Implementation), and Web use Platform Channels in their implementations. Windows and Linux are handled through Dart-only platform implementations.
The basic API is defined using pigeon. The pigeon files can be found in the pigeons directory
in the main package. The API is defined in Dart in the wakelock_plus_platform_interface package.
The packages in this repo are the following:
| Package | Implementations |
|---|---|
wakelock_plus |
Main plugin package + Android, iOS, macOS, Windows, Linux, and Web implementations |
wakelock_plus_platform_interface |
Basic API definition & message handling |
Contributing
If you want to contribute to this plugin, follow the contributing guide.
Origin
As stated before, this plugin is a continuation of the original wakelock plugin.
That plugin was originally based on screen.
Specifically, the wakelock functionality was extracted into the wakelock plugin due to lack of
maintenance by the author of the screen plugin.
For this library, the functionality remains the same as the original plugin, but has been completely refreshed (using latest Flutter standards and platform integration) with support for all six platforms currently supported by Flutter (Android, iOS, macOS, Windows, Linux, and Web).
Migrating from the wakelock Plugin
Simply replace the import statement with the one below:
import 'package:wakelock_plus/wakelock_plus.dart';
As well as replacing all the calls to Wakelock with WakelockPlus:
WakelockPlus.enable();
//...
WakelockPlus.disable();
//...
WakelockPlus.toggle(enable: true);
如何选择适合项目的代码仓?
先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
- 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
- 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
- 使用前在 GitHub 核对 README、许可证与 Issues。
来源与维护
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗