You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何禁用SfCalendar日历组件的横向滑动功能

禁用SfCalendar日视图的横向滑动(版本20.3.48)

要在SfCalendar的日视图中禁用横向滑动切换日期的功能,只需在组件参数中添加enableSwipeNavigation: false即可,这个属性专门用于控制日历的滑动导航行为。

修改后的完整代码如下:

SfCalendar(
        view: CalendarView.day,
        todayHighlightColor: kPrimaryColor,
        allowDragAndDrop: false,
        allowViewNavigation: false,
        enableSwipeNavigation: false, // 新增该属性禁用横向滑动
        initialDisplayDate: widget.selectedDate,
        initialSelectedDate: widget.selectedDate,
        dataSource: _getAppointments()
      );

添加这个配置后,日历会固定展示initialDisplayDate设置的单日内容,无法通过横向滑动切换到其他日期。

内容的提问来源于stack exchange,提问作者Chethiya Nishanath

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 07:35:19