• Greg Spencer's avatar
    Allow `TapRegion` to consume tap events (#136305) · 22b0a62a
    Greg Spencer authored
    ## Description
    
    In order for `MenuAnchor` menus to be able to not pass on the taps that close their menus, `TapRegion` needed a way to consume them.  This change adds a flag to the `TapRegion`, `consumeOutsideTap` that will consume taps that occur outside of the region if the flag is set (it is false by default). The same flag is added to `MenuAnchor` to allow selecting the behavior for menus.
    
    `TapRegion` consumes the tap event by registering with the gesture arena and immediately resolving the tap as accepted if any regions in a group have `consumeOutsideTap` set to true.
    
    This PR also deprecates `MenuAnchor.anchorTapClosesMenu`, since it is a much more limited version of the same feature that only applied to the anchor itself, and even then only applied to closing the menu, not passing along the tap.  The same functionality can now be implemented by handling a tap on the anchor widget and checking to see if the menu is open before closing it.
    
    ## Related Issues
     - https://github.com/flutter/flutter/issues/135327
    
    ## Tests
     - Added tests for `TapRegion` to make sure taps are consumed properly.
    22b0a62a
Name
Last commit
Last update
..
api Loading commit data...
flutter_view Loading commit data...
hello_world Loading commit data...
image_list Loading commit data...
layers Loading commit data...
platform_channel Loading commit data...
platform_channel_swift Loading commit data...
platform_view Loading commit data...
splash Loading commit data...
texture Loading commit data...
.clang-format Loading commit data...
README.md Loading commit data...
flutter_gallery.readme Loading commit data...