如何在Flutter中将多个参数传递给调用SfCalender的onTap的函数?
How to pass multiple parameters to a function calling onTap of SfCalender in Flutter?
我正在使用 SfCalender 并想再传递一个参数给 onTap 的回调
SfCalendar(
dataSource: _getDataSource(snapshot.data.data),
view: CalendarView.month,
showNavigationArrow: true,
monthViewSettings: MonthViewSettings(
showAgenda: true,
agendaStyle: AgendaStyle(
backgroundColor: Colors.transparent,
appointmentTextStyle: TextStyle(
color: Colors.white, fontSize: 13, fontStyle: FontStyle.italic),
dateTextStyle: TextStyle(
color: primaryColor, fontSize: 13, fontStyle: FontStyle.italic),
),
),
controller: _calendarController,
onTap: _openForm(array),
)
_openForm(CalendarTapDetails details) {
//code
}
目前,如果我不向 _openForm 传递任何参数,CalenderDetails 详细信息具有值,但我想传递一个数组以及 CalenderDetails 详细信息。我该怎么做?
我不知道 SfCalendar 库(它是闭源的),但我认为你正试图这样做:
onTap: (details) => _openForm(details, array);
// ...
_openForm(CalendarTapDetails details, List myArray) {
// code
}
我正在使用 SfCalender 并想再传递一个参数给 onTap 的回调
SfCalendar(
dataSource: _getDataSource(snapshot.data.data),
view: CalendarView.month,
showNavigationArrow: true,
monthViewSettings: MonthViewSettings(
showAgenda: true,
agendaStyle: AgendaStyle(
backgroundColor: Colors.transparent,
appointmentTextStyle: TextStyle(
color: Colors.white, fontSize: 13, fontStyle: FontStyle.italic),
dateTextStyle: TextStyle(
color: primaryColor, fontSize: 13, fontStyle: FontStyle.italic),
),
),
controller: _calendarController,
onTap: _openForm(array),
)
_openForm(CalendarTapDetails details) {
//code
}
目前,如果我不向 _openForm 传递任何参数,CalenderDetails 详细信息具有值,但我想传递一个数组以及 CalenderDetails 详细信息。我该怎么做?
我不知道 SfCalendar 库(它是闭源的),但我认为你正试图这样做:
onTap: (details) => _openForm(details, array);
// ...
_openForm(CalendarTapDetails details, List myArray) {
// code
}