-
Notifications
You must be signed in to change notification settings - Fork 893
Description
Unhandled Exception: LateInitializationError: Field '_currentViewVisibleDates@1268355329' has not been initialized.
#0 _SfCalendarState._currentViewVisibleDates (package:syncfusion_flutter_calendar/src/calendar/sfcalendar.dart)
#1 _SfCalendarState._updateVisibleAppointments (package:syncfusion_flutter_calendar/src/calendar/sfcalendar.dart:4254:37)
#2 _SfCalendarState._getAppointment (package:syncfusion_flutter_calendar/src/calendar/sfcalendar.dart:4244:5)
#3 _SfCalendarState.initState. (package:syncfusion_flutter_calendar/src/calendar/sfcalendar.dart:2880:42)
#4 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:948:45)
#5 Future._propagateToListeners (dart:async/future_impl.dart:977:13)
#6 Future._completeWithValue (dart:async/future_impl.dart:720:5)
return Material(
color: Colors.transparent,
child: ListView(
children: [
// Calendar - constrained height so it behaves nicely in lists
ConstrainedBox(
constraints: const BoxConstraints(maxHeight: 660),
child: StreamBuilder(
stream: boardData.stream,
builder: (context, data) {
return DayAppCalendar(
dataSource: MeetingDataSource(
data.data?.map((e) => e.toMeeting()).toList() ?? []),
onDateSelected: (d) {
// update the Rx date, which will auto-bind boardData to the correct stream
// selectedDate.value = DateTime(d.year, d.month, d.day);
// setState(() {});
},
);
})),
const SizedBox(height: 12),
// Selected date header with a smooth card-like style
Obx(() {
final DateTime d = selectedDate.value;
final String header =
"${d.year}-${d.month.toString().padLeft(2, '0')}-${d.day.toString().padLeft(2, '0')} • ${_weekdayString(d.weekday)}";
return Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 14),
child: Row(
children: [
Expanded(
child: Text(
header,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
),
),
),
// count badge
Container(
padding:
const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
decoration: BoxDecoration(
color: tClrPrimary(context),
borderRadius: BorderRadius.circular(20),
),
child: Obx(() {
final count = boardData.length;
return Text(
"$count",
style: const TextStyle(
color: CupertinoColors.white,
fontWeight: FontWeight.w700,
),
);
}),
)
],
),
);
}),
const SizedBox(height: 8),
// Events list for the selected day
Obx(() {
if (boardData.isEmpty) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 40),
child: Center(
child: Text(
'当天没有事件', // "No events for this day"
style: TextStyle(
color: CupertinoColors.systemGrey,
fontSize: 14,
),
),
),
);
}
// build a column of cards. If you prefer ListView, you can convert.
return Column(
children: boardData
.map((data) => Padding(
padding: const EdgeInsets.symmetric(vertical: 6),
child: buildCardStandared(
data,
widget.createSmartHandler,
widget.onTap,
widget.onDelete),
))
.toList(),
);
}),
],
),
);
}