Questions tagged [gesturedetector]

A Flutter widget which detects different types of gestures.

359 questions
58
votes
11 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
  • 601
  • 1
  • 6
  • 9
31
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
  • 364,799
  • 232
  • 1,155
  • 1,198
26
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
  • 17,773
  • 29
  • 104
  • 165
20
votes
2 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
  • 368
  • 5
  • 11
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
  • 17,773
  • 29
  • 104
  • 165
12
votes
5 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
  • 9,400
  • 8
  • 40
  • 48
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
  • 18,039
  • 16
  • 66
  • 118
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,336
  • 14
  • 23
9
votes
1 answer

How to make a View follow my finger using onScroll and GestureDetector - Android

I have a RelativeLayout with a TextView in the middle. I've got it to detect onFling, onDown, and onScroll events using SimpleOnGestureListener(). I would like the TextView to follow my finger around the screen (can be just in the x axis), and when…
Sandy
  • 2,210
  • 6
  • 34
  • 56
9
votes
2 answers

How can I detect tap on the screen?

More specific where do I attach OnGestureListener so that I can detect onSingleTapUp everywhere on the screen, even if an ImageView take up half the screen. Now I have the Listener on the Activity that has an ImageView. But the Listener only fire…
Erik
  • 4,514
  • 10
  • 55
  • 112
9
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
  • 111
  • 1
  • 2
9
votes
6 answers

Trouble with detecting gestures over ListView

I have an Activity that contains a ViewFlipper. The ViewFlipper includes 2 layouts, both of which are essentially just ListViews. So the idea here is that I have two lists and to navigate from one to the other I would use a horizontal swipe. I have…
Andrew
  • 19,726
  • 30
  • 93
  • 171
9
votes
1 answer

Set GestureDetector to all child views

I would like to add a GestureDetector to all views (view groups) of an activity without assigning it manually to every single view. Right now onFling() is only activated when swiping over the background but not when swiping on e.g. button1. package…
Paradiesstaub
  • 2,010
  • 2
  • 15
  • 28
8
votes
4 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…
toregua
  • 1,492
  • 1
  • 12
  • 25
1
2 3
23 24