Best way to set App State Variable to Image Path for use on another page

Actions & Logic

Hi all,

I have a gridview with 20 images (in container) in it and only one can be selected. These images will be static so will be saved in media assets.

Current Setup works but don't believe it's very efficient:

- On each container within the grid view, I have an action that sets a page state variable "selectedFilmPageState" to the hardcoded path of each image.

- Then, on my Submit button, I set an App State property "selectedFilmImg" to "selectedFilmPageState". Then, navigate to a different page, "Selections".

- On the "Selections" page, I set the Film Selection widget to selectedFilmImg.

This all works fine, but I feel like there is a better way than having the SAME Action Chain on each container with different hardcoded values. Is there a way to set a property on the container (or image) itself and then just use that property in the action chains?

What have you tried so far?

Current Setup works but don't believe it's very efficient:

- On each container within the grid view, I have an action that sets a page state variable "selectedFilmPageState" to the hardcoded path of each image.

- Then, on my Submit button, I set an App State property "selectedFilmImg" to "selectedFilmPageState". Then, navigate to a different page, "Selections".

- On the "Selections" page, I set the Film Selection widget to selectedFilmImg.

This all works fine, but I feel like there is a better way than having the SAME Action Chain on each container with different hardcoded values. Is there a way to set a property on the container (or image) itself and then just use that property in the action chains?

Did you check FlutterFlow's Documentation for this topic?
No
1 reply