Here again to ask for help from anyone who can help me.
In a nutshell, what I want to do is: when I click on the button, extract the name entered in the textfield, separate the letters and with Page View show the image (which is in the firebase) corresponding to each letter.
I’ll leave the images of everything I find useful so that someone can help me.
I tried using a Custom Action but it didn’t work, maybe I’m using it wrong.
Images:
https://phpout.com/wp-content/uploads/2024/03/bmLjc.png
https://phpout.com/wp-content/uploads/2024/03/L8Qnl.png
https://phpout.com/wp-content/uploads/2024/03/PwqeY.png
If you need more information to help me, please ask.
2
Answers
You can convert the name to a list and use it in a loop like the following
Then create a map of alphabets and path to each image and you can use that for example
now you can render it like this
Based on your description, you are wanting to:
Here is what I did to accomplish what I believe you are looking for.
Page Updates
I have a local page state variable
letterImages
which I use to generate the children images of the PageView widget.Local Page State
PageView Setup
Action Flow
I set up the following action flow for the button:
letters
collection for all documentsletterImages
local state variable with thegetImages()
custom function which takes the input from theTextEntry
widget and the action outputallLetterDocs
list ofletters
documents as input:Here is the custom function and a short description of what it is doing:
The custom function splits the word into characters, loops through each character, connects the character to a document in the
letters
Firestore collection based on theletter
field (a field you didn’t previously have), extracts the URL from theimage_url
field and appends it to a new list, and then returns the list of ImagePaths.Firestore Schema
You will need to add the
letter
field to each of your Firestore documents so the custom function will work:Result
Here is a video showing the app in action.