Any thoughts about how to make color-coded text messages based on sender?
I’m storing usernames and message strings in Firebase and want the output to look something like this:
In the Snap to Place (StP) interface, I could clone blocks with different properties or use a Data Viewer List (DVL) and change the properties of individual elements but in the Drag & Drop (DnD) interface, I don’t have either of those options.
But @tatiang you do have those options, it’s just not always apparent!
Check out this project! Specifically go to the screen ‘scr View notes’ and check out the blocks. I use the DVL without ever entering data into the table. I also manipulate the DVL components manually and apply values to them directly from a firebase call!
So, you’d make 1 chat row that has both left and right chat box with the correct color and based on who the logged in user is and the id associated with the message, color the boxes accordingly!
I still need to adjust the custom DVL layout sizing since it’s cutting off the messages but I was focused on the player name colors and that’s working great.
I’m using a row with two labels inside. The row is set to “fit contents” for the height and each label is as well. But they don’t expand to fit longer messages. Any ideas why?
Thanks, @muneer! It’s working. I’m still not sure why mine didn’t but at least I have something to work with now. Any particular reason you used two rows instead of one?
From experience, if you use only one row then you will need to use the magical wait block when manipulating the rows at run time just like what we do for cloning. When you use two rows inside each other it works without the wait block.
I save each chat message in a Firebase object that has the player name and message. Then I loop through that list every split second and populate a Data Viewer List with a custom layout where I change each row’s background color according to which player name it contains.
If you’re new to Thunkable, you can search for chat video tutorials and demo projects.