flutter_inner_drawer icon indicating copy to clipboard operation
flutter_inner_drawer copied to clipboard

Add drawerEdgeDragWidth

Open tarastataryn opened this issue 4 years ago • 11 comments

Is it possible to add new property, that specifies the width of the area within which a horizontal swipe will open the drawer (like drawerEdgeDragWidth in default scaffold Drawer).

tarastataryn avatar Dec 13 '19 22:12 tarastataryn

@arastataryn yes, it's possible. why would you like to change this value?

Dn-a avatar Dec 14 '19 09:12 Dn-a

for example, I have full screen map in my app, and I want to drag it around, but it captures gesture and opens drawer (when I swipe left/right), instead of the interacting with the map

tarastataryn avatar Dec 14 '19 20:12 tarastataryn

@tarastataryn if that's what I imagine it is, you should look here GestureRecognizer and Example

Dn-a avatar Dec 14 '19 20:12 Dn-a

@tarastataryn solved?

Dn-a avatar Dec 16 '19 20:12 Dn-a

Hi @Dn-a,

I'm trying to do the same thing and came across the same problem.

What is happening is the GuestureDetector inside the build method is receiving the drag events which need instead be intercepted by the map thus stopping you panning around the map.

GestureDetector(
  key: _gestureDetectorKey,
  onTap: () {},
  onHorizontalDragDown: widget.swipe ? _handleDragDown : null,
  onHorizontalDragUpdate: widget.swipe ? _move : null,
  onHorizontalDragEnd: widget.swipe ? _settle : null,
...
}

I think the way you could implement this is to have the Gesture detectors (you'll probably want one one each side) at the same level in the widget hierarchy as the first stack and give them a specific width for the grab tabs.

James

JamesMcIntosh avatar Dec 21 '19 04:12 JamesMcIntosh

@JamesMcIntosh gesturerecognizer does just that, I use it in my app to intercept google maps gestureDetector and it works perfectly ...Google maps

Dn-a avatar Dec 21 '19 10:12 Dn-a

Ah, that improves the situation a lot but if I try to horizontally pan anywhere on the map the situation still occurs with the drawer taking precedence. The only way I can get the map to scroll horizontally if if I start with a vertical scroll which I then turn into a horizontal scroll without lifting my finger...

JamesMcIntosh avatar Dec 21 '19 10:12 JamesMcIntosh

@JamesMcIntosh you have to try them all

gestureRecognizers: Set()
        ..add(Factory<PanGestureRecognizer>(() => PanGestureRecognizer()))
        ..add(Factory<ScaleGestureRecognizer>(() => ScaleGestureRecognizer()))
        ..add(Factory<TapGestureRecognizer>(() => TapGestureRecognizer()))
        ..add(Factory<VerticalDragGestureRecognizer>(
            () => VerticalDragGestureRecognizer())),

Dn-a avatar Dec 21 '19 11:12 Dn-a

Yes, that's exactly what I have and HorizontalDragGestureRecognizer.

@Dn-a, are you able to pan the map horizontally without opening the drawer?

JamesMcIntosh avatar Dec 21 '19 11:12 JamesMcIntosh

@JamesMcIntosh yes...have you solved?

Dn-a avatar Jan 20 '20 11:01 Dn-a

Hi @Dn-a, it's still causing me an issue, I will try and strip it back to make a standalone example.

JamesMcIntosh avatar Jan 20 '20 22:01 JamesMcIntosh