搜尋套件、儲存庫與 APP 分類

套件詳情v1.8.2

wakelock_plus

一個插件,可讓您保持裝置螢幕常亮,也就是防止在 Android、iOS、macOS、Windows、Linux 和 Web 上的螢幕進入睡眠狀態。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
268萬
喜歡數
649
Pub 分數
160

安裝套件

flutter pub add wakelock_plus

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

wakelock_plus 是一個 Flutter 插件,可防止裝置螢幕進入睡眠狀態,讓螢幕在 Android、iOS、Web、macOS、Windows 和 Linux 等多個平台持續亮起。非常適合需要持續顯示螢幕的應用程式,例如影片播放器、導航應用或 kiosk 模式。該套件提供簡單的 API 來啟用或停用喚醒鎖,確保在不同平台上的行為一致。輕量級且可順暢整合至現有的 Flutter 專案中。

適用情境

  • 影片播放
  • 導航應用
  • 自助服務模式
  • 數位看板
  • 互動式教學
  • 長時間執行的程序

主要特色

  • 跨平台支援
  • 簡單 API
  • 低電量影響
  • 應用退出時自動釋放
  • 平台特定優化
  • 無需原生程式碼

適合對象

  • 媒體應用
  • 銷售點系統
  • 教育工具
  • 展示應用
  • 需要持續顯示的應用程式

使用建議

  • 可能增加電池耗損
  • 部分平台需要使用者權限
  • 不適用於背景任務
  • 可能干擾系統電源管理
  • 在不需要時應停用
  • 如果過度使用,可能會產生可用性問題

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Wakelock Plus

GitHub stars Pub version

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);

所屬分類

依賴

依賴清單 6 項

原始碼儲存庫

使用此套件的專案

所在榜單