Questions tagged [gesturedetector]

A Flutter widget which detects different types of gestures.

480 questions
129
votes
19 answers

Flutter- GestureDetector not working with containers in stack

I have two containers in a stack and both containers have GestureDetector.The OnTap for the first container is working fine but it's not working with another container. The first container is the image and the second one is the green background…
Himanshu Yadav
  • 1,311
  • 2
  • 9
  • 9
36
votes
2 answers

How to add a gesture detector to a view in Android

I was struggling with adding a gesture detector to a subview in my project. Do I override the parent's onTouchEvent or the child's onTouchEvent? Do I make an OnTouchListener and add the gesture detector there? The documentation shows an example for…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
28
votes
4 answers

OnUp event on GestureDetector

My question is simple, where's the onUp event when implementing a GestureListener? I has a lot of events on the gesturedetector, and cannot just consume the onUp event of the listener, cause one of events are the onSingleTapConfirmed that needs it.
Marcos Vasconcelos
  • 18,136
  • 30
  • 106
  • 167
24
votes
3 answers

RecyclerView ItemTouchHelper Action Drag Ended

I need to listen to the user when he stops drag and drop on my RecyclerView (when he drops the selected item). Can I get this Information through my ItemTouchHelper? Thanks for helping Mark: At the moment i only now when the user still moves the…
Sebastian
  • 408
  • 1
  • 6
  • 11
18
votes
5 answers

Catch tap event on TextFormField

I am trying to catch the tap event on TextFormField into a flutter Form. I use a GestureDetector to do that with the TextFormField as child but nothing is firing when a click on it : @override Widget build(BuildContext context) { return new…
Vincenzo
  • 1,741
  • 2
  • 16
  • 26
14
votes
8 answers

Is there a better way to check Left/Right Drag in #flutter?

Is there a better way to check Left/Right Drag in #flutter. I have done it but somtime it works sometime it doesn't. new GestureDetector( onHorizontalDragEnd: (DragEndDetails details) { print("Drag Left - AddValue"); setState((){ …
Ajay Kumar
  • 15,250
  • 14
  • 54
  • 53
13
votes
1 answer

Flutter: GestureDetector apparently doesn't receive Drag events when it has a ListView in it

Am I missing something? The documentation says that events bubble up from the innermost child to the ancestors, but below code will not print "dragged" to the console. It does print "tapped" though. Applying NeverScrollablePhyiscs to the ListView…
footurist
  • 1,509
  • 2
  • 16
  • 23
13
votes
5 answers

Flutter Execute Method so long the button pressed

I want to execute a method while a user is pressing down on a button. In pseudocode: while (button.isPressed) { executeCallback(); } In other words, the executeCallback method should fire repeatedly as long as the user is pressing down on the…
DoctorDoom
  • 501
  • 2
  • 8
  • 21
12
votes
2 answers

Move Events AFTER LongPress

How can I listen the move events after the LongPress is caled in my GestureDetector? When the user LongClick he starts the selection mode, and can drag a square into the screen. But I noticed that the onScroll is not called after LongPress is…
Marcos Vasconcelos
  • 18,136
  • 30
  • 106
  • 167
12
votes
2 answers

Proper way to add GestureDector to Listview.builder card in Flutter?

I have an Expanded widget wrapped around a Listview.builder of Card. How can I make my card not only detect onTap but also pass variables to my new .dart file on Navigation. I'm currently getting a sizing error? Updated With Code Here is my…
Charles Jr
  • 8,333
  • 15
  • 53
  • 74
10
votes
1 answer

is there any way to stop gesture bubbling in flutter?

I have TabBarView with 3 children, one of them I have a container which has an onPanUpdate gesture. When I am trying to move container tab bar onHorizontalDragUpdate calls and tab bar changes tab but not container. Is there any way to prevent…
Narek
  • 211
  • 3
  • 5
10
votes
3 answers

Nested GestureDetector OnTap Functions

I have nested GestureDetetors but problem is that only the child GestureDetector's onTap is executed. I do not wish to override the child's onTap, rather, I want both the parent's and the child's onTap to execute. Here's my code: …
aLL
  • 1,596
  • 3
  • 17
  • 30
10
votes
2 answers

Android ListView with OnItemClickListener AND GestureDetector

I have a the following ListActivity: public class ShowDayActivity extends ListActivity implements OnItemClickListener { private GestureDetector gestureDetector; private View.OnTouchListener gestureListener; @Override public void…
Leopard2A5
  • 101
  • 1
  • 1
  • 4
10
votes
1 answer

How to add scrolling for a custom view in Android

I've just started writing a custom view in Android (for the first time) and I've realised that I need to implement a scrolling feature. The custom view also uses a header containing some text (which should stay fixed and not scroll). I've read…
Farbod Salamat-Zadeh
  • 19,687
  • 20
  • 75
  • 125
10
votes
2 answers

NullPointerException in GestureDetector.onTouchEvent

I have an activity using a GestureDetector in onTouch. Inside my layout, I also have a view implementing an onClickListener. On Android ICS, I get a NullPointerException while handling the TouchEvent. What is the cause of this error? I have seen…
Stefan Anca
  • 1,386
  • 14
  • 23
1
2 3
31 32