搜索插件、代码仓与 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 项

源码仓库

使用此插件的项目