Closed
Description
Hello,
I'm using bloc and Tabbars
final List<Widget> _views = [
const DayView(),
const WeekView(),
const MonthView(),
];
Widget get _calendar =>
BlocBuilder<DataBloc, DataState>(builder: (context, state) {
// if the data is fetched convert the appointments in events
List<CalendarEventData<Appointment>> events = [];
if (state is FetchedData) {
events = (state.data as List<Appointment>)
.map((appointment) => _appointmentToEvent(appointment))
.toList(growable: false);
}
// Create the content
return CalendarControllerProvider(
controller: EventController()..addAll(events),
child: TabBarView(children: _views),
);
});
I have three tabs: Day, Week and Month.
The WeekView is the middle tab and is the one selected by default.
As I'm using bloc the function _calendar
will be called two time: on fetching data with events empty and on fetched data with events filled.
The WeekView calendar is drawn proper but without events. If I change tab and select once of the others I see the events on calendars DayView and also MonthView. Now when back to Week pressing on tab I see the events listed proper inside the calendar WeekView.
Thanks for your support.
Sam