Sunday, March 3, 2024
HomeiOS Developmentandroid - TableCalendar Not Updating State Accurately

android – TableCalendar Not Updating State Accurately


I’ve a listing, so one thing like

var x = [DateTime(xxxx), DateTime(xxxx)];

And I need to present customers the times they labored out, so I need the times in that listing to seem inexperienced, let’s imagine. Nonetheless, after I navigate to a brand new month and generally simply navigate in any respect, the inexperienced circle disappears. I do know my operate is used accurately, as a result of the font dimension differs from the default textual content, however it would not present the circle. I included photos of the problem and the code for the calendar is linked beneath. Thanks!

                           Container(
                              width: dimension.width * .9,
                              baby: TableCalendar(
                                firstDay: DateTime.utc(1900, 10, 16),
                                lastDay: DateTime.utc(2200, 3, 14),
                                availableGestures:
                                    AvailableGestures.horizontalSwipe,
                                focusedDay: _focusedDay,
                                calendarFormat: _calendarFormat,
                                selectedDayPredicate: (day) {
                                  return isSameDay(_selectedDay, day);
                                },
                                key: _calendarKey,
                                daysOfWeekStyle: DaysOfWeekStyle(
                                    weekdayStyle: TextStyle(
                                        shade: AppColors(theme).secondaryText),
                                    weekendStyle: TextStyle(
                                        shade: AppColors(theme).secondaryText)),
                                calendarStyle: CalendarStyle(
                                    selectedDecoration: BoxDecoration(
                                        shade: AppColors(theme).darkGreen,
                                        form: BoxShape.circle),
                                    isTodayHighlighted: false,
                                    todayTextStyle: TextStyle(
                                      shade: AppColors(theme).primaryText,
                                    ),
                                    defaultTextStyle: TextStyle(
                                        shade: AppColors(theme).primaryText,
                                        fontSize: 20),
                                    weekendTextStyle: TextStyle(
                                        shade: AppColors(theme).primaryText,
                                        fontSize: 20),
                                    outsideTextStyle: TextStyle(
                                        shade: AppColors(theme).primaryText),
                                    outsideDecoration: BoxDecoration(
                                      form: BoxShape.circle,
                                    )),
                                onDaySelected: (selectedDay, focusedDay) {
                                  setState(() {
                                    _selectedDay = selectedDay;
                                    _focusedDay = focusedDay;
                                    sortExercises();
                                  });
                                },
                                
                                calendarBuilders: CalendarBuilders(
                                    defaultBuilder: (context, day, focusedDay) {
                                  bool workedOut = worked_out_days.any(
                                      (workedOutDay) =>
                                          isSameDay(workedOutDay, day));
                                  return workedOut
                                      ? Container(
                                          margin: const EdgeInsets.all(4.0),
                                          ornament: BoxDecoration(
                                            shade: AppColors(theme).footerGrey,
                                            form: BoxShape.circle,
                                          ),
                                          baby: Middle(
                                            baby: Textual content(
                                              '${day.day}',
                                              type: TextStyle(
                                                shade: AppColors(theme)
                                                    .primaryText,
                                              ),
                                            ),
                                          ),
                                        )
                                      : null;
                                }),
                                headerStyle: HeaderStyle(
                                    leftChevronVisible: false,
                                    rightChevronVisible: false,
                                    formatButtonVisible: false,
                                    titleCentered: true,
                                    headerMargin: EdgeInsets.solely(backside: 15),
                                    titleTextStyle: TextStyle(
                                        shade: AppColors(theme).primaryText,
                                        fontSize: 20)),
                                onPageChanged: (focusedDay) {
                                  setState(() {
                                    _focusedDay = focusedDay;
                                  });
                                },
                              ))

You possibly can see within the picture the 25, 26, 27, 28, and 29 for feb is chosen (with a gray circle), however after I go to march, just one and a pair of are chosen, not 25, 26, 27, 28, and 29.

enter image description here



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments