Flutter Joystick

Pub License Pub likes Pub popularity Pub points Flutter platform

Buy Me A Coffee PayPal

A virtual joystick for Flutter applications.

Joystick

Joystick

Joystick(listener: (details) {
...
})

Joystick arguments:

Parameter Description
listener callback, which is called with period frequency when the stick is dragged. Listener parameter details contains the stick offset from the center of the base (can be from -1.0 to +1.0).
period frequency of calling listener from the moment the stick is dragged, by default 100 milliseconds.
mode possible directions mode of the joystick stick, by default all

Possible joystick modes:

Mode Description
all allow move the stick in any direction: vertical, horizontal and diagonal
vertical allow move the stick only in vertical direction
horizontal allow move the stick only in horizontal direction
horizontalAndVertical allow move the stick only in horizontal and vertical directions, not diagonal

Joystick Vertical Joystick Horizontal Joystick Horizontal And Vertical

Joystick Area

Joystick

JoystickArea allows to render a joystick anywhere in this area where user clicks.

JoystickArea(
  listener: (details) {
    ...
  },
  child: ...
)

JoystickArea has the same arguments as Joystick (listener, period, mode, etc.).

Additional JoystickArea arguments:

Parameter Description
initialJoystickAlignment Initial joystick alignment relative to the joystick area, by default Alignment.bottomCenter.
child The child contained by the joystick area.

Customization

Square Joystick

Joystick and JoystickArea have additional arguments that allow to customize their appearance and behaviour.

Parameter Description
base Widget that renders joystick base, by default JoystickBase.
stick Widget that renders joystick stick, it places in the center of base widget, by default JoystickStick.
stickOffsetCalculator Calculate offset of the stick based on the stick drag start position and the current stick position. The package currently only supports circle and rectangle joystick shapes. By default CircleStickOffsetCalculator.

Your donation motivates me to work more on plugins and packages. If you found this package helpful and would like to thank me:

Donate Buy Me A Coffee PayPal

Libraries

flutter_joystick