filter list on a page with dropdown - Custom code not working

I'm trying to filter a list on a page with a drop-down according to the following filter values:
Today: shows only vents occurring on the day the user looks at the list
This Week: shows events for the week
This month: shows events for the month
All: shows all events



I have created a collection called Calendar and linked the app wth a backend query and as can be seen from the images above works well. I have no ideas what to do next as the dropdown isn't taking values directly fro th collection, it's fultering on date ranges so I'm guessing custom code will be required and i have no idea how to write custome code for this feature in dart for FF and the cose I was able to enerate with VChat GPT below, even when i use the one generated by FF codepilot. Any suggestions or pointers on how to fix this? or maybe even a simpler way to implement the filter option would be highly appreciated.

Thank you very much in advance.


2 replies