Last updated:
0 purchases
screen retriever
screen_retriever #
This plugin allows Flutter desktop apps to Retrieve information about screen size, displays, cursor position, etc.
English | 简体中文
Platform Support
Quick Start
Installation
Usage
Listening events
Who's using it?
API
ScreenRetriever
License
Platform Support #
Linux
macOS
Windows
✔️
✔️
✔️
Quick Start #
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
screen_retriever: ^0.2.0
copied to clipboard
Or
dependencies:
screen_retriever:
git:
url: https://github.com/leanflutter/screen_retriever.git
path: packages/screen_retriever
ref: main
copied to clipboard
Usage #
Display? _primaryDisplay;
List<Display> _displayList = [];
void _init() async {
_primaryDisplay = await screenRetriever.getPrimaryDisplay();
_displayList = await screenRetriever.getAllDisplays();
setState(() {});
}
copied to clipboard
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);
}
}
copied to clipboard
Please see the example app of this plugin for a full example.
Who's using it? #
Biyi (比译) - 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<Display> - An array of displays that are currently available.
✔️
✔️
✔️
License #
MIT
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.