flutter_joystick 0.0.2 flutter_joystick: ^0.0.2 copied to clipboard
A virtual joystick for Flutter applications. Highly flexible and customizable.
Flutter Joystick #
A virtual joystick for Flutter applications.
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 Area #
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 #
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 . |
Donate #
If you found this package helpful and would like to thank me: