Skip to content

Commit af033f0

Browse files
committed
Address review comments
1 parent d161407 commit af033f0

File tree

1 file changed

+131
-8
lines changed

1 file changed

+131
-8
lines changed

docs/ff-concepts/adding-customization/code-file.md

Lines changed: 131 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,67 @@ You can use custom class fields to display values directly in the UI, and call i
194194

195195
### Call In Action Flows
196196

197-
You can also add your custom class’s methods directly within an Action Flow. For example, you can trigger the `markHelpful()` method when a user taps a “Mark as Helpful” button to update a field or increment the helpful count of a review.
197+
You can also set fields and call methods of your custom classes directly within an Action Flow. This is useful when you want to update data or trigger custom logic as part of your app's behavior.
198+
199+
#### Set Field [Action]
200+
201+
Use the **Set Field** action to update a specific property of a custom class instance. For example, you can set `order.status = 'shipped'` when a user confirms an order, allowing the UI to reflect the change immediately.
202+
203+
<div style={{
204+
position: 'relative',
205+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
206+
height: 0,
207+
width: '100%'}}>
208+
<iframe
209+
src="https://demo.arcade.software/fpj0MWNYrIZFYe5vDAyj?embed&show_copy_link=true"
210+
title=""
211+
style={{
212+
position: 'absolute',
213+
top: 0,
214+
left: 0,
215+
width: '100%',
216+
height: '100%',
217+
colorScheme: 'light'
218+
}}
219+
frameborder="0"
220+
loading="lazy"
221+
webkitAllowFullScreen
222+
mozAllowFullScreen
223+
allowFullScreen
224+
allow="clipboard-write">
225+
</iframe>
226+
</div>
227+
<p></p>
228+
229+
#### Call Method [Action]
230+
231+
Use the **Call Method** action to invoke a method defined in your custom class. For instance, if your `Comment` class has a `markHelpful()` method, you can trigger it when a user taps a “Helpful” button to record the interaction.
232+
233+
<div style={{
234+
position: 'relative',
235+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
236+
height: 0,
237+
width: '100%'}}>
238+
<iframe
239+
src="https://demo.arcade.software/dVK7pbda7U6B4igmNUP7?embed&show_copy_link=true"
240+
title=""
241+
style={{
242+
position: 'absolute',
243+
top: 0,
244+
left: 0,
245+
width: '100%',
246+
height: '100%',
247+
colorScheme: 'light'
248+
}}
249+
frameborder="0"
250+
loading="lazy"
251+
webkitAllowFullScreen
252+
mozAllowFullScreen
253+
allowFullScreen
254+
allow="clipboard-write">
255+
</iframe>
256+
</div>
257+
<p></p>
198258
199259
## Using Static Classes
200260
@@ -216,13 +276,16 @@ Here are couple more examples to understand it better:
216276
217277
```jsx
218278
class StringFormatter {
219-
static String capitalize(String input) =>
220-
input[0].toUpperCase() + input.substring(1);
279+
static String lastFormatted = '';
280+
static int formatCount = 0;
281+
282+
static String capitalize(String input) =>
283+
input[0].toUpperCase() + input.substring(1);
221284
222-
static String toLowerCase(String input) => input.toLowerCase();
285+
static String toLowerCase(String input) => input.toLowerCase();
223286
224-
static String toSnakeCase(String input) =>
225-
input.replaceAll(' ', '_').toLowerCase();
287+
static String toSnakeCase(String input) =>
288+
input.replaceAll(' ', '_').toLowerCase();
226289
}
227290
```
228291
@@ -254,10 +317,70 @@ You can access the static class data and methods directly via the ****Set from V
254317
255318
![static-class-methods.avif](imgs/static-class-methods.avif)
256319
257-
### Call In Action Flows
320+
### Call Static Classes in Action Flows
258321
259-
[To come…]
322+
You can interact with static classes directly in an Action Flow using both the **Set Field** and **Call Method** actions. Static methods and fields belong to the class itself, not to a specific instance, which makes them perfect for utilities, configuration helpers, or global logic.
260323
324+
#### Set Static Field [Action]
325+
326+
Use the **Set Static Field** action to update a static field on a custom class. For example, if you have a class `MathHelper` with a static field `amount`, you can set it using an input value when a user enters a price. This allows you to store that value globally and use it across different calculations.
327+
328+
329+
<div style={{
330+
position: 'relative',
331+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
332+
height: 0,
333+
width: '100%'}}>
334+
<iframe
335+
src="https://demo.arcade.software/TcYX7f2OgBZaayKFsKhN?embed&show_copy_link=true"
336+
title=""
337+
style={{
338+
position: 'absolute',
339+
top: 0,
340+
left: 0,
341+
width: '100%',
342+
height: '100%',
343+
colorScheme: 'light'
344+
}}
345+
frameborder="0"
346+
loading="lazy"
347+
webkitAllowFullScreen
348+
mozAllowFullScreen
349+
allowFullScreen
350+
allow="clipboard-write">
351+
</iframe>
352+
</div>
353+
<p></p>
354+
355+
#### Call Static Method [Action]
356+
357+
Use the **Call Static Method** action to run a static method of your class. For instance, you can call `Logger.logEvent('user_login')` from an analytics helper class when a login action is triggered, without needing to create an instance of the class.
358+
359+
<div style={{
360+
position: 'relative',
361+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
362+
height: 0,
363+
width: '100%'}}>
364+
<iframe
365+
src="https://demo.arcade.software/TgpAbgq6mF8o1nG4sR2g?embed&show_copy_link=true"
366+
title=""
367+
style={{
368+
position: 'absolute',
369+
top: 0,
370+
left: 0,
371+
width: '100%',
372+
height: '100%',
373+
colorScheme: 'light'
374+
}}
375+
frameborder="0"
376+
loading="lazy"
377+
webkitAllowFullScreen
378+
mozAllowFullScreen
379+
allowFullScreen
380+
allow="clipboard-write">
381+
</iframe>
382+
</div>
383+
<p></p>
261384
262385
## Custom Enums
263386

0 commit comments

Comments
 (0)