1 Star 0 Fork 0

寸井月 / flutter_joystick

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Flutter Joystick

Pub Version License Pub Likes Pub Popularity Pub Points Flutter Platform

Buy Me A Coffee PayPal

Flutter Joystick is a virtual joystick package for Flutter applications that provides interactive joystick components for user interface design.

Table of Contents

  1. Joystick
  2. Joystick Area
  3. Customization
  4. Donate

Joystick

Joystick

The Joystick widget is a virtual joystick that allows users to drag a stick within a defined area. You can customize its behavior and appearance. Here's how you can use it:

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

Joystick Arguments:

Parameter Description
listener A callback function that is invoked at a specified frequency (period) when the joystick stick is dragged. The listener parameter, details, provides the stick's offset from the center of the base (ranging from -1.0 to +1.0).
period (Optional) The frequency at which the listener callback is triggered from the moment the stick is dragged. The default is 100 milliseconds.
mode (Optional) The possible direction mode of the joystick stick. The default mode is all, allowing movement in any direction: vertical, horizontal, and diagonal.

This information clarifies the purpose and usage of each parameter for the Joystick widget.

Mode Description
all Allows movement of the joystick stick in any direction: vertical, horizontal, and diagonal.
vertical Restricts movement of the joystick stick to the vertical direction only.
horizontal Restricts movement of the joystick stick to the horizontal direction only.
horizontalAndVertical Restricts movement of the joystick stick to both horizontal and vertical directions, but not diagonal.

These modes define how the joystick stick can be moved, providing flexibility in tailoring the joystick's behavior to specific requirements.

Joystick Vertical Joystick Horizontal Joystick Horizontal And Vertical

Joystick Area

Joystick

The JoystickArea widget allows you to render a joystick anywhere within a designated area when the user interacts with it. It shares similar properties with the Joystick widget.

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

Additional JoystickArea Arguments:

Parameter Description
initialJoystickAlignment (Optional) Sets the initial alignment of the joystick within the joystick area. By default, it is aligned to Alignment.bottomCenter.
child (Optional) The widget that is contained within the joystick area, allowing you to place other elements or widgets alongside the joystick.

These arguments provide additional customization options for the JoystickArea widget, allowing you to control the initial alignment and include child widgets for a more versatile user interface.

Customization

Square Joystick

Customization Options:

Both the Joystick and JoystickArea widgets offer a range of customization options, allowing you to personalize their appearance and behavior to suit your specific requirements.

Parameter Description
base (Optional) The widget responsible for rendering the joystick's base. The default is JoystickBase.
stick (Optional) The widget that defines the appearance of the joystick stick. It is centered within the base widget. The default is JoystickStick.
stickOffsetCalculator (Optional) Determines the stick's offset based on the starting position of the stick drag and its current position. The package currently supports circle and rectangle joystick shapes. The default is CircleStickOffsetCalculator.

These customization parameters empower you to create distinctive and unique joystick experiences for your Flutter applications.

Donate

If you find this package helpful and want to support the developer, consider making a donation:

Donate Buy Me A Coffee PayPal

Your contributions are greatly appreciated and motivate further development of plugins and packages.

MIT License Copyright (c) 2021 Pavel Zaichyk Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sillysnnall/flutter_joystick.git
git@gitee.com:sillysnnall/flutter_joystick.git
sillysnnall
flutter_joystick
flutter_joystick
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891