FLUTTER ECOSYSTEM

leanflutter/screen_retriever

このプラグインにより、Flutter デスクトップアプリは画面サイズ、ディスプレイ、カーソルの位置などの情報を取得できます。

screen_retriever のプロジェクト画像
Stars
60
Forks
44
最終プッシュ(UTC)
2026/07/04
プロジェクト状態
公開中
LeanFlutter GitHub avatar
GITHUB Organization

LeanFlutter ↗

To make the flutter even simpler

言語C++CMakeDartSwiftCRuby

技術トピック

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 1 件

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

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 https://img.shields.io/discord/884679008049037342.svg

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

💻
https://raw.githubusercontent.com/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg Add your contributions

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

License

MIT