Create Custom Dynamic Swipeable Week View Calendar Component

Custom Code

Hello, I am trying to make a custom week view calendar, similar to the default calendar widget but due to my requirements I need a custom one. I need it to look like this, placed in something like a PageView where users can swipe to see the next and previous weeks (preferably infinitely, if not then for like 500 pages or so). Users can select a date, and the component updates its selected date and the page to return the date selected. I also need to be able to customize which day of the week is at the start of the 7 days (eg. some people might start their weeks on sunday, while others might choose monday or another day).


I have tried to use custom code to return a list of calendar dates, and the start date of the week. I know nothing about coding, I've been using chatGPT and the Code Copilot feature and nothing is working. The list of dates is generating, but I keep getting an error when trying in test mode.

I get this error:

Error: The argument type 'int' can't be assigned to the parameter type 'DateTime?'.

- 'DateTime' is from 'dart:core'.

(valueOrDefault<int>(

^

lib/flutter_flow/custom_functions.dart:23:41: Error: A value of type 'List<int>' can't be assigned to a variable of type 'num'.

- 'List' is from 'dart:core'.

Duration(days: (inputDate.weekday - startDay) % 7),

^

lib/flutter_flow/custom_functions.dart:23:51: Error: The argument type 'num' can't be assigned to the parameter type 'int'.

Duration(days: (inputDate.weekday - startDay) % 7),

^

lib/flutter_flow/custom_functions.dart:32:14: Error: The argument type 'int' can't be assigned to the parameter type 'List<int>?'.

- 'List' is from 'dart:core'.

.weekday, // This will store the day of the week (1=Monday, 7=Sunday)

^


I have no idea what to do, this is how my code looks and how my data is structured. Please advise on how I can accomplish this properly to have users select start day of week, select day,, generate children from variable in proper way, and make sure everything functions as expected and is able to compile. I don't understand parameters well, and I've been trying to base my strategy off of this video series but it's not really helping.

Thanks!

What have you tried so far?

Everything. ChatGPT (which doesn't really understand flutterflow, but seems to understand flutter), Code Copilot, YouTube. Nothings really working.

Did you check FlutterFlow's Documentation for this topic?
Yes
2
3 replies