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

套件詳情v0.3.1

screen_retriever

此外掛程式允許Flutter桌面應用程式取得螢幕大小、顯示器、游標位置等資訊。

macOSWindowsLinux
近 30 天下載
116萬
喜歡數
74
Pub 分數
160

安裝套件

flutter pub add screen_retriever

套件介紹

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

screen_retriever 套件讓 Flutter 桌面應用程式能夠存取連接顯示器的詳細資訊,包括螢幕尺寸、解析度以及主要顯示器細節。它還提供跨多台監視器的即時游標位置追蹤功能。此套件專為 macOS、Windows 和 Linux 設計,為開發需要多螢幕感知功能的應用程式(例如自訂 UI、生產力工具或需要精確螢幕佈局處理的媒體播放器)提供輕量級解決方案。該外掛可與 Flutter 的桌面生態系統無縫整合。

適用情境

  • 多顯示器應用程式佈局
  • 光標位置追蹤
  • 顯示解析度檢測
  • 桌面UI自定義
  • 螢幕感知媒體播放
  • 視窗定位工具

主要特色

  • 跨平台桌面支援
  • 即時游標追蹤
  • 顯示元資料檢索
  • 輕量且高效
  • 簡單的 API 結合
  • 支援多螢幕

適合對象

  • 桌面應用程式開發者
  • 多螢幕UI設計工具
  • 生產力工具創作者
  • 媒體播放器開發者
  • 自定義視窗管理器

使用建議

  • 需要目標桌面平台
  • 僅限 macOS、Windows 和 Linux
  • 不支援行動裝置或網頁
  • 某些系統可能需要權限處理
  • 高頻率更新中的效能影響

原始 README

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

⚠️ Migration Notice: This plugin is being migrated to libnativeapi/nativeapi-flutter

The new version is based on a unified C++ core library (libnativeapi/nativeapi), providing more complete and consistent cross-platform native API support. r

screen_retriever

pub version

This plugin allows Flutter desktop apps to Retrieve information about screen size, displays, cursor position, etc.



English | 简体中文


Platform Support

Linux macOS Windows
✔️ ✔️ ✔️

Documentation

Quick Start

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  screen_retriever: ^0.2.0

Or

dependencies:
  screen_retriever:
    git:
      url: https://github.com/leanflutter/screen_retriever.git
      path: packages/screen_retriever
      ref: main
Usage
Display? _primaryDisplay;
List<Display> _displayList = [];

void _init() async {
  _primaryDisplay = await screenRetriever.getPrimaryDisplay();
  _displayList = await screenRetriever.getAllDisplays();
  setState(() {});
}
Listening events
class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> with ScreenListener {
  @override
  void initState() {
    screenRetriever.addListener(this);
    super.initState();
  }

  @override
  void dispose() {
    screenRetriever.removeListener(this);
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // ...
  }

  @override
  void onScreenEvent(String eventName) {
    String log = 'Event received: $eventName)';
    print(log);
  }
}

Please see the example app of this plugin for a full example.

Who's using it?

  • Biyi (比译) - A convenient translation and dictionary app.
  • FastForge - An efficient tool for rapid application development and prototyping.

API

ScreenRetriever
Method Description Linux macOS Windows
getCursorScreenPoint Returns Offset - The current absolute position of the mouse pointer. ✔️ ✔️ ✔️
getPrimaryDisplay Returns Display - The primary display. ✔️ ✔️ ✔️
getAllDisplays Returns List<Display> - An array of displays that are currently available. ✔️ ✔️ ✔️

Contributors ✨

Thanks goes to these wonderful people (emoji key):

LiJianying
LiJianying

💻
Christian Padilla
Christian Padilla

💻
J-P Nurmi
J-P Nurmi

💻
Kingtous
Kingtous

💻
fufesou
fufesou

💻
lukasz-lukasz-lukasz
lukasz-lukasz-lukasz

💻
Add your contributions

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT

所屬分類

依賴

依賴清單 3 項

原始碼儲存庫

使用此套件的專案