You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/resources/control-flow/functions/action-triggers.md
+7-6
Original file line number
Diff line number
Diff line change
@@ -59,7 +59,7 @@ Here’s an example of showing a message on button click using the **On Tap** tr
59
59
60
60
### Widget Specific Triggers
61
61
62
-
Widget specific triggers are available on certain widgets. Here are they:
62
+
Certain widgets offer specific triggers that activate based on user interactions or device events. These triggers enable developers to define custom behaviors for various situations. Below are examples of widget-specific triggers:
63
63
64
64
-**On Submit**: Triggered on the TextField widget when the user presses "submit" or "done," finalizing text entry.
65
65
-**On Page Load**: Available on the page widget, this trigger activates as soon as the page loads, useful for tasks like data fetching or content updates.
@@ -84,9 +84,10 @@ The lifecycle of gesture triggers involves four key stages: **Start**, **Update*
84
84
85
85
Tap gestures have a simpler lifecycle, focusing primarily on detecting taps and whether they complete or get canceled. Here's how the tap lifecycle works:
86
86
87
-
1.**Start**: This stage begins when the user places their finger on the screen to initiate a tap. For example: `onTapDown` is triggered when the user touches the screen to start a tap.
88
-
2.**End/Stop**: The tap gesture is completed when the user lifts their finger from the screen. For example: `onTapUp` is triggered when the user completes the tap by lifting their finger.
89
-
3.**Cancel**: If the user moves their finger too much before lifting it, the tap is canceled, preventing the completion of the action. For example: `onTapCancel` is triggered when a tap gesture is canceled.
87
+
1.**Down**: This stage begins when the user places their finger on the screen to initiate a tap. For example: `onTapDown` is triggered when the user touches the screen to start a tap.
88
+
2.**Up**: The tap gesture is completed when the user lifts their finger from the screen. For example: `onTapUp` is triggered when the user completes the tap by lifting their finger.
89
+
3.**Tap**: After both of the above actions are successfully completed, `onTap` is triggered indicating a full tap gesture has occurred.
90
+
3.**Cancel**: If the user moves their finger too much before lifting it, the tap is canceled, preventing the completion of the action. For example: `onTapCancel` will be called, and `onTap` will not be triggered.
90
91
91
92
Here’s how the lifecycle flows for tap gestures:
92
93
@@ -188,8 +189,8 @@ You can access the Gesture Detector data after adding the relevant gesture detec
188
189
189
190
-**Global Position X**: The x-coordinate of the pointer relative to the left edge of the screen when the gesture was triggered.
190
191
-**Global Position Y**: The y-coordinate of the pointer relative to the top edge of the screen when the gesture was triggered.
191
-
-**Local Position X**: The x-coordinate of the pointer relative to the left edge of the widget that detected the gesture.
192
-
-**Local Position Y**: The y-coordinate of the pointer relative to the top edge of the widget that detected the gesture.
192
+
-**Local Position X**: The x-coordinate of the pointer relative to the left edge of the widget that has the action triggers applied.
193
+
-**Local Position Y**: The y-coordinate of the pointer relative to the top edge of the widget that has the action triggers applied.
193
194
-**Delta X**: The horizontal distance the pointer moved during the gesture.
194
195
-**Delta Y**: The vertical distance the pointer moved during the gesture.
0 commit comments