|
| 1 | +--- |
| 2 | +title: Action Flow Editor |
| 3 | +tags: [ ] |
| 4 | +toc_max_heading_level: 5 |
| 5 | +sidebar_position: 1 |
| 6 | +--- |
| 7 | + |
| 8 | +# Actions |
| 9 | + |
| 10 | +Effectively managing user interactions is essential for developing interactive applications. |
| 11 | +Designing interactivity involves two steps: |
| 12 | + |
| 13 | +1. Listening for Interaction (**Action Triggers**) |
| 14 | +2. Responding to Interaction (**Actions**) |
| 15 | + |
| 16 | +Action Triggers represent a specific event, while Actions are functions executed in response to the |
| 17 | +triggered event. Common triggers are: |
| 18 | + |
| 19 | +- **On Tap**: Triggered on tapping on a widget or specifically buttons. |
| 20 | +- **On Selected:** Triggered on selecting an option from a dropdown list. |
| 21 | +- **On Page Load:** Triggered on loading a page |
| 22 | + |
| 23 | +Actions are tasks or operations that are performed in response to an event detected by a trigger. |
| 24 | + |
| 25 | +## Action Flow Editor |
| 26 | + |
| 27 | +The Action Flow Editor is a visual, node-based editor used to configure the functions that run in |
| 28 | +response to a trigger. This editor simplifies the process of creating and managing business logic. |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | +### Action Triggers |
| 33 | + |
| 34 | +The **Action Triggers** toolbar, located at the top of the editor, displays a list of available |
| 35 | +triggers. Each trigger has its own separate node editor, allowing you to create distinct logic |
| 36 | +flows for different events. When you switch between triggers, the node editor updates to display |
| 37 | +the logic specific to the selected action trigger. |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +:::warning[Exposed by FlutterFlow] |
| 42 | +Please note that Action Triggers are provided by FlutterFlow and are not user-generated. You can |
| 43 | +only work with the ones provided by FlutterFlow. |
| 44 | +::: |
| 45 | + |
| 46 | +Each trigger has its own separate node-editor, allowing you to create distinct logic flows for |
| 47 | +different events. When you switch between triggers, the node-editor will update to display the logic |
| 48 | +specific to the selected trigger. |
| 49 | + |
| 50 | +<div className="arcade-container" style={{ |
| 51 | + position: 'relative', |
| 52 | + paddingBottom: 'calc(55.670103092783506% + 41px)', // Preserves the original aspect ratio and padding |
| 53 | + height: 0, |
| 54 | + width: '100%' |
| 55 | +}}> |
| 56 | + <iframe |
| 57 | + src="https://demo.arcade.software/JvaQ229YQSXBXsNRdA3l?embed&show_copy_link=true" |
| 58 | + title="Switching Triggers" |
| 59 | + style={{ |
| 60 | + position: 'absolute', |
| 61 | + top: 0, |
| 62 | + left: 0, |
| 63 | + width: '100%', |
| 64 | + height: '100%', |
| 65 | + colorScheme: 'light', |
| 66 | + }} |
| 67 | + frameborder="0" |
| 68 | + loading="lazy" |
| 69 | + webkitAllowFullScreen |
| 70 | + mozAllowFullScreen |
| 71 | + allowFullScreen |
| 72 | + allow="clipboard-write"> |
| 73 | + </iframe> |
| 74 | +</div> |
| 75 | + |
| 76 | + |
| 77 | +:::info |
| 78 | +It's important to note that the logic defined in the node-editor is associated with the selected |
| 79 | +trigger. This means that the actions you set up will only be executed when that particular trigger |
| 80 | +is activated. |
| 81 | +::: |
| 82 | + |
| 83 | +### Node Editor |
| 84 | + |
| 85 | +This central area of the editor is where you define and visualize the logic/actions that will |
| 86 | +execute in response to the selected trigger. The actions are laid out in a flowchart-like manner, |
| 87 | +making it easy to understand and modify the flow of actions. |
| 88 | + |
| 89 | +Actions in the Node Editor are executed synchronously. This means that if an action returns a value, |
| 90 | +it will be available to subsequent actions within the flow. |
| 91 | + |
| 92 | +:::tip[Synchronous vs Asynchronous] |
| 93 | +**Synchronous actions** are executed one after another, with each action waiting for the previous |
| 94 | +one to complete. |
| 95 | +**Asynchronous actions** are executed independently and can run concurrently, allowing other |
| 96 | +following tasks to proceed without waiting for them to finish. |
| 97 | +::: |
| 98 | + |
| 99 | +### Creating An Action |
| 100 | + |
| 101 | +If there is no initial action or if there is an action and you want to add another one and press the |
| 102 | +plus icon, the following options will be available: |
| 103 | + |
| 104 | +1. **Add Action**: Adds a single action node to the flow. You can add multiple synchronous actions |
| 105 | + one after another. |
| 106 | + |
| 107 | +2. **Add Conditional Action**: Adds a conditional node with an input for a boolean expression and |
| 108 | + two action branches. The actions in each branch will be executed based on the evaluation of the |
| 109 | + boolean expression. |
| 110 | +3. **Add Loop**: Adds a loop flow that contains an input boolean expression and an action flow. The |
| 111 | + actions within the loop will be executed repeatedly as long as the expression evaluates to true ( |
| 112 | + similar to a while loop). |
| 113 | +4. **Add Parallel**: Adds two action flow branches that will be executed in parallel. |
| 114 | +5. **Paste Action(s)**: Allows you to paste actions previously copied to the clipboard. |
| 115 | + |
| 116 | +After creating an action node, you need to specify the action type in the Right Panel. Creating a |
| 117 | +node is equivalent to creating an empty function, and specifying the action type is like filling out |
| 118 | +the function body with the desired logic. |
| 119 | + |
| 120 | +<div className="arcade-container" style={{ |
| 121 | + position: 'relative', |
| 122 | + paddingBottom: 'calc(55.32786885245902% + 41px)', // Keeps the original aspect ratio and padding |
| 123 | + height: 0, |
| 124 | + width: '100%' |
| 125 | +}}> |
| 126 | + <iframe |
| 127 | + src="https://demo.arcade.software/AvnbHPyUl6FYbbnCAU8f?embed&show_copy_link=true" |
| 128 | + title="Create New Action" |
| 129 | + style={{ |
| 130 | + position: 'absolute', |
| 131 | + top: 0, |
| 132 | + left: 0, |
| 133 | + width: '100%', |
| 134 | + height: '100%', |
| 135 | + colorScheme: 'light', |
| 136 | + }} |
| 137 | + frameborder="0" |
| 138 | + loading="lazy" |
| 139 | + webkitAllowFullScreen |
| 140 | + mozAllowFullScreen |
| 141 | + allowFullScreen |
| 142 | + allow="clipboard-write"> |
| 143 | + </iframe> |
| 144 | +</div> |
| 145 | + |
| 146 | +### Right Panel |
| 147 | + |
| 148 | +The Right Panel serves two main purposes: |
| 149 | + |
| 150 | +1. **Selecting Actions**: Choose the specific actions you want to add to your action flow. |
| 151 | +2. **Configuring Actions**: Configure the properties, parameters, and return names of the selected |
| 152 | + action. |
| 153 | + |
| 154 | +<div className="arcade-container" style={{ |
| 155 | + position: 'relative', |
| 156 | + paddingBottom: 'calc(55.441478439425055% + 41px)', // Maintains the aspect ratio and additional padding |
| 157 | + height: 0, |
| 158 | + width: '100%' |
| 159 | +}}> |
| 160 | + <iframe |
| 161 | + src="https://demo.arcade.software/nfgVsa6x5Rb2uCtw5oIJ?embed&show_copy_link=true" |
| 162 | + title="Arcade Flow (Fri May 10 2024)" |
| 163 | + style={{ |
| 164 | + position: 'absolute', |
| 165 | + top: 0, |
| 166 | + left: 0, |
| 167 | + width: '100%', |
| 168 | + height: '100%', |
| 169 | + colorScheme: 'light', |
| 170 | + }} |
| 171 | + frameborder="0" |
| 172 | + loading="lazy" |
| 173 | + webkitAllowFullScreen |
| 174 | + mozAllowFullScreen |
| 175 | + allowFullScreen |
| 176 | + allow="clipboard-write"> |
| 177 | + </iframe> |
| 178 | +</div> |
| 179 | + |
| 180 | +### Widget Binding |
| 181 | + |
| 182 | +The icon in the upper left corner of the Action Flow Editor identifies the widget to which the |
| 183 | +current action flow is bound. |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | +### Issues |
| 188 | + |
| 189 | +The bug icon will display warnings and errors in any of the action flows bound to this widget. Note, |
| 190 | +these are neither issues in the whole project nor issues in all of the action flow but *only* issues |
| 191 | +generated from the action flows bound to *this* widget. This includes *all* the action flows on |
| 192 | +*all* the triggers and not just currently visible action flow on the selected trigger. |
| 193 | + |
| 194 | +<div className="arcade-container" style={{ |
| 195 | + position: 'relative', |
| 196 | + paddingBottom: 'calc(55.441478439425055% + 41px)', // Preserves the original aspect ratio and padding |
| 197 | + height: 0, |
| 198 | + width: '100%' |
| 199 | +}}> |
| 200 | + <iframe |
| 201 | + src="https://demo.arcade.software/RxkkYgCTWU2Zo2i7Tzuz?embed&show_copy_link=true" |
| 202 | + title="Issues" |
| 203 | + style={{ |
| 204 | + position: 'absolute', |
| 205 | + top: 0, |
| 206 | + left: 0, |
| 207 | + width: '100%', |
| 208 | + height: '100%', |
| 209 | + colorScheme: 'light', |
| 210 | + }} |
| 211 | + frameborder="0" |
| 212 | + loading="lazy" |
| 213 | + webkitAllowFullScreen |
| 214 | + mozAllowFullScreen |
| 215 | + allowFullScreen |
| 216 | + allow="clipboard-write"> |
| 217 | + </iframe> |
| 218 | +</div> |
| 219 | + |
| 220 | +### Action Blocks |
| 221 | + |
| 222 | +The diamond icon in the Action Flow Editor opens a menu where you can create and edit Action Blocks. |
| 223 | +**Action Blocks** are reusable action flows that can accept parameters and return values, promoting code |
| 224 | +reusability and modularity. |
| 225 | + |
| 226 | + |
0 commit comments