Skip to content

Event funneling #217

Description

@FlutterIssues

Issue by HansMuller
Wednesday Oct 21, 2015 at 23:09 GMT
Originally opened as https://github.com/flutter/engine/issues/1726


If I add a single event handling child to a larger container that just adds some decoration, sometimes I'd like to be able to say that events that occur within the container should be delivered to the event handling child. As if they'd actually targeted the child.

For example: put a button inside a container that adds some padding and a border. It would be nice if it were possible to funnel gestures that landed outside the button but within the container, to the button. So that the entire thing acted like the button.

Activity

  1. FlutterIssues commented on Nov 9, 2015

    @FlutterIssues
    Author

    Comment by krisgiesing
    Tuesday Nov 03, 2015 at 21:31 GMT


    I think this would only matter if the child is stateful. If it's stateless, the parent can just wrap the whole container in a GestureRecognizer and ignore the callback parameter to the child. (It does somewhat undermine the utility of the callback, though.)

  2. Hixie commented on Dec 16, 2015

    @Hixie
    Contributor

    There's several ways we could do this:

    • at the rendering layer, we could have a renderbox which in its handleEvent method visited children recursively (asserting if it hit a node with multiple children) until it found a RenderPointerListener descendant, and just proxied the results to that object.
    • at the widget layer, we could do something similar with a widget that had a Listener, and onPointerDown hunted for a GestureDetector and forwarded pointer down to that object's _handlePointerDown method. Or alternatively, forwarded events from its Listener to a descendant Listener's callbacks.
    • at the widget layer, we could have a method which did either of those options but using a GlobalKey instead of a walk.
  3. modified the milestone: on Dec 16, 2015
  4. Hixie commented on Jun 6, 2017

    @Hixie
    Contributor

    We're addressing this problem by dedicated widgets, e.g. RadioListTile.

  5. github-actions commented on Aug 17, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilityframeworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions