artur-ios-dev / flutter_control_pad Goto Github PK
View Code? Open in Web Editor NEWA control pad with a virtual joystick and buttons.
Home Page: https://pub.dev/packages/control_pad
License: GNU General Public License v3.0
A control pad with a virtual joystick and buttons.
Home Page: https://pub.dev/packages/control_pad
License: GNU General Public License v3.0
Hey,
Is there a way to call setState in the onDirecitonChanged callback or is there another way to do it ?
Thanks :)
Is there a way I can get a continues stream of data(angle and distance) from the joystick view instead of just the angle and distance when there is a change in the joystick position?
how i can connect with my audrino car so i can move car by this joystick
The original post suggested to use Debouncer although it makes more sense to use Throttler since debouncer would send only last event after X time since the last event.
Acceptance Criteria:
onDirectionChanged
should be called not more often than the given timeI forgot to mention, please use the debouncer class instead of checking for interval by datetime. Currently the IDE shows a warning because the datetime is not immutable. If you like I can provide the code of how is can be implemented..
Originally posted by @gitboss in #11 (comment)
Configurable arrows on the control pad to add other actions.
When onDirectionChanged is set the inner circle stops moving but executes callback well
How to get the x and y of the joystick? there are only two results on directionchanged.
Please add options to set the opacity and color of the Joy stick. A better example showing the local and global offsets on the screen would be much appreciated.
The code works with stable channel as well by getting the local position using the following code :
RenderBox getBox = context.findRenderObject();
getBox.globalToLocal(details.globalPosition))
Can you please confirm if the offsets received with the above code are correct?
Hi.
I'm trying using this joystick to test.
However, I cannot build JoystickView() because of an error.
Error is :
The getter 'localPosition' isn't defined for the class 'DragUpdateDetails'
There is no 'localPosition' variable in DragUpdateDetails.
The error occurs on details.localPosition
in joystick_view.dart
Are you going to fix this error?
Thank you!
Is it possible to create more stages than 0, 0.5, 1.0? I've used this in an app where I'm controlling motors to drive. I would love a function where I can drive my motors faster / slower according to the Y value of the control pad.
Thanks in advance
I'v noticed that when using this widget inside of an other gesture detector the Gesture Manager Arena will choose the Horizontal or Vertical Gesture before the Pan gesture of the Joystick.
I did some digging, looks like a possible solution is to Build a CustomPanGestureRecognizer within a RawGestureDetector. I tried implementing this but was unsuccessful due to my lack of understanding off GestureDetection in flutter. Here is a starting point that might help you. I'd be very interested in seeing this through as it relies on a rather large project I am building.
The Joy Stick View is within a multipage application and I use Flutter Swiper to navigate between pages.
You can see from the log that the Pan is winner when the gesture is a Verical Direction, but when it is in a Horizontal Direction the Pan does not win.
Here is a log of the Arena Manager
I/flutter (24667): Gesture arena 1271 ❙ ★ Opening new gesture arena. I/flutter (24667): Gesture arena 1271 ❙ Adding: PanGestureRecognizer#d3ee9(debugOwner: GestureDetector, start behavior: start) I/flutter (24667): Gesture arena 1271 ❙ Adding: HorizontalDragGestureRecognizer#1757e(start behavior: start) I/flutter (24667): Gesture arena 1271 ❙ Adding: TapGestureRecognizer#9cb38(debugOwner: GestureDetector, state: ready, button: 1) I/flutter (24667): Gesture arena 1271 ❙ Closing with 3 members. I/flutter (24667): Gesture arena 1271 ❙ Rejecting: TapGestureRecognizer#9cb38(debugOwner: GestureDetector, state: possible, button: 1) I/flutter (24667): Gesture arena 1271 ❙ Accepting: PanGestureRecognizer#d3ee9(debugOwner: GestureDetector, start behavior: start) I/flutter (24667): Gesture arena 1271 ❙ Self-declared winner: PanGestureRecognizer#d3ee9(debugOwner: GestureDetector, start behavior: start) D/ViewRootImpl@a3d787b[MainActivity](24667): ViewPostIme pointer 1 D/ViewRootImpl@a3d787b[MainActivity](24667): ViewPostIme pointer 0 I/flutter (24667): Gesture arena 1272 ❙ ★ Opening new gesture arena. I/flutter (24667): Gesture arena 1272 ❙ Adding: PanGestureRecognizer#d3ee9(debugOwner: GestureDetector, start behavior: start) I/flutter (24667): Gesture arena 1272 ❙ Adding: HorizontalDragGestureRecognizer#1757e(start behavior: start) I/flutter (24667): Gesture arena 1272 ❙ Adding: TapGestureRecognizer#9cb38(debugOwner: GestureDetector, state: ready, button: 1) I/flutter (24667): Gesture arena 1272 ❙ Closing with 3 members. I/flutter (24667): Gesture arena 1272 ❙ Rejecting: TapGestureRecognizer#9cb38(debugOwner: GestureDetector, state: possible, button: 1, sent tap down) I/flutter (24667): Gesture arena 1272 ❙ Accepting: HorizontalDragGestureRecognizer#1757e(start behavior: start) I/flutter (24667): Gesture arena 1272 ❙ Self-declared winner: HorizontalDragGestureRecognizer#1757e(start behavior: start)
It should be possible to pass a Duration
parameter which will indicate how often the events are registered (callback is called).
Acceptance criteria:
final Duration interval
to the JoystickView
_processGesture
in the onPanUpdate
callback should be called only when the last gesture was processed earlier than frequency
's valuemay I know how should the Arduino BLE controller (control pad) be connected to the robot? can I get the code?
Is there any way i can change the colour of outer circle?
don't support null safety
Hello,
can I scale the control pad? I would like to use a smaller one.
Update README with an example and improve the overall layout.
Hello,
Can you please update the package to support Null Safety / SDK 2.12 / Flutter 2?
Thanks!
add final bool
in a JoystickView
that will indicate if arrows should be shown on the top of the Joystick.
Acceptance criteria:
visible
)Is there a way to change the background shadow color?
How can we set the default start position of the inner circle at one of the ends or any position instead of the center?
ButtonsView will be a view that can contain 1 or more buttons with configurable action (callback). It should be possible to choose either a grid or a circular layout for the buttons.
Hi.
When I call setstate on my StatefulWidget, the joystickInnerPosition of the JoystickView returns to the center point.
Timer.periodic(Duration(milliseconds: 500), (as) {
if (mounted) {
setState(() {
_carState = _carState;
});
}
});
Hi there!
I'm new at flutter and I'm wondering to know how can I use its controller in flutter, Could you please enrich your example via how to use its controller?
If you were to use an AnimatedPositioned widget on your joystick the effects would look more realistic when the joystick was returning to center
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.