• 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
..
android Loading commit data...
ios Loading commit data...
lib Loading commit data...
linux Loading commit data...
macos Loading commit data...
test Loading commit data...
test_driver Loading commit data...
web Loading commit data...
windows Loading commit data...
.metadata Loading commit data...
README.md Loading commit data...
analysis_options.yaml Loading commit data...
pubspec.yaml Loading commit data...