TransparentPointer
TransparentPointer is the solution to "How to pass through all gestures between two widgets in Stack" problem.
For example, if there is an Button
inside Container
with
GestureDetector
then tapping on
a button won't be "visible" to a gesture detector behind it. With
TransparentPointer
a tapping event doesn't stop on a button, but goes up to the
parent, similar to event bubbling in HTML/JS.
Example#
Basic Example#
import flet as ft
def main(page: ft.Page):
page.add(
ft.Stack(
expand=True,
controls=[
ft.GestureDetector(
on_tap=lambda _: print("TAP!"),
multi_tap_touches=3,
on_multi_tap=lambda e: print("MULTI TAP:", e.correct_touches),
on_multi_long_press=lambda _: print("Multi tap long press"),
),
ft.TransparentPointer(
content=ft.Container(
content=ft.Button("Test button"),
padding=50,
)
),
],
)
)
ft.run(main)