virtual_mouse 0.0.2 copy "virtual_mouse: ^0.0.2" to clipboard
virtual_mouse: ^0.0.2 copied to clipboard

A package to simulate mouse events in Flutter

Virtual Mouse #

This package was created to solve a common problem in applications developed for TV and WebView. Interacting directly with the rendered components.

Platforms #

  • ✅ Android
  • ✅ IOs

[Note] The library tries to simulate the behavior of a click on the screen based on the cursor positions and coordinates. Restricting its use only to devices with gestures and touches on the screen.

Virtual

Register your virtual mouse #

  VirtualMouse(
    onKeyEvent: (event) {
      // KeyEvent current when pressed
    },
    onKeyPressed: (key) {
      // KeyPressed current state (pressed/unpressed)
    },
    onMove: (offset, size) {
      // Cursor position and Size screen dimension.
    },
    child: Column(
      children: [
        /// Add the components for Interactions
      ],
    ),
  ),

Note that a String cacheName will be returned by the function registerCursor, which can be used to set this cursor to system or delete this cursor.

Set on custom cursor #

The Mouse is waiting to receive a componente extends on CustomPainter. Default is Painter basic with red arrow.

  VirtualMouse(
    pointer: MyCustomPointer()
    //....
  )
class MyCustomPointer extends CustomPainter {}

VirtualMouse Propreties #

Property Description
child (Required) The child widget to be rendered inside the virtual mouse cursor.
node (Optional) The focus node to be used in the virtual mouse cursor
autoFocus (Optional) If the virtual mouse cursor should be focused when the widget is rendered. The default is true.
velocity (Optional) The velocity of the virtual mouse cursor movement incremented. The default is 1.0
duration (Optional) The duration of the virtual mouse cursor movement in milliseconds. The default is 10.
angle (Optional) The angle of the pointer in degrees. The default is -40.0.
pointerColor (Optional) The color of the pointer. The default is Colors.red.
pointer (Optional) Custom pointer to be used in the virtual mouse cursor.
onKeyPressed (Function) Callback to be called when a key is pressed. The key pressed is passed as argument.
onKeyEvent (Function) Callback to be called when any key is pressed. The keyEvend is passed as argument.
onMove (Function) Callback to be called when the mouse is moved to a new position.
2
likes
150
points
45
downloads

Publisher

verified publisheralexandrehenrique.com.br

Weekly Downloads

A package to simulate mouse events in Flutter

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on virtual_mouse