# fluttertpc_screen_retriever **Repository Path**: getmoon/fluttertpc_screen_retriever ## Basic Information - **Project Name**: fluttertpc_screen_retriever - **Description**: Flutter三方插件,允许 Flutter 桌面应用检索关于屏幕大小,显示,光标位置等信息,该仓库是ohos适配库. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: https://gitee.com/openharmony-sig/fluttertpc_screen_retriever - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 3 - **Created**: 2025-02-06 - **Last Updated**: 2025-02-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # screen_retriever [![pub version][pub-image]][pub-url] [![][discord-image]][discord-url] [pub-image]: https://img.shields.io/pub/v/screen_retriever.svg [pub-url]: https://pub.dev/packages/screen_retriever [discord-image]: https://img.shields.io/discord/884679008049037342.svg [discord-url]: https://discord.gg/zPa6EZ2jqb This plugin allows Flutter desktop apps to Retrieve information about screen size, displays, cursor position, etc. --- English | [简体中文](./README-ZH.md) --- - [Platform Support](#platform-support) - [Quick Start](#quick-start) - [Installation](#installation) - [Usage](#usage) - [Listening events](#listening-events) - [Who's using it?](#whos-using-it) - [API](#api) - [ScreenRetriever](#screenretriever) - [License](#license) ## Platform Support | Linux | macOS | Windows | | :---: | :---: | :-----: | | ✔️ | ✔️ | ✔️ | ## Quick Start ### Installation Add this to your package's pubspec.yaml file: ```yaml dependencies: screen_retriever: ^0.2.0 ``` Or ```yaml dependencies: screen_retriever: git: url: https://github.com/leanflutter/screen_retriever.git path: packages/screen_retriever ref: main ``` ### Usage ```dart Display? _primaryDisplay; List _displayList = []; void _init() async { _primaryDisplay = await screenRetriever.getPrimaryDisplay(); _displayList = await screenRetriever.getAllDisplays(); setState(() {}); } ``` ### Listening events ```dart class HomePage extends StatefulWidget { const HomePage({Key? key}) : super(key: key); @override State createState() => _HomePageState(); } class _HomePageState extends State 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 (比译)](https://biyidev.com/) - A convenient translation and dictionary app. ## 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` - An array of displays that are currently available. | ✔️ | ✔️ | ✔️ | ## License [MIT](./LICENSE)