flutter - Flutter中如何将多个参数传递给调用SfCalender的onTap的函数?
问题描述
我正在使用 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
}
推荐阅读
- javascript - 通过提交将文本输入到超链接
- java - 如何将文本文件放入数组并搜索特定值但仅限于一维数组
- project-reactor - Reactor Netty - 如何使用延迟通量发送
- typescript - GAS/clasp:如何让自动完成/智能感知在 VSCode 中为 3rd 方库工作
- square-connect - 需要帮助使用 Square API 设置和销售剧院门票
- javascript - 如何在html表单中自动填充输入字段
- ios - 在 iOS 中分析文本到语音的字符串
- android - FragmentHostCallback 是在哪里创建的?
- c++ - 无法访问静态函数内部的私有变量
- reactjs - 将jsx文件转换为tsx后Reactjs“错误:ENOENT:没有这样的文件或目录,打开..”