flutter - 如何在 table_calendar 上获取多天事件
问题描述
如何设置我的 table_calendar 参数以使事件显示如下图所示:
正是从 10 到 13 的时期。
如果 table_calendar 无法做到这一点,有人可以将我指向正确的小部件吗?
解决方案
我得到它。
从 table_calendar 你必须为CalendarBuilders
.
builders: CalendarBuilders(
markersBuilder: (context, date, events, holidays) {
if (events.isNotEmpty) {
children.add(
Positioned(
right: 1,
top: 1,
child: _buildEventsMarker(date, events),
),
);
}
}
);
为此构建器为事件日期数组设置一个子级。
而在你_buildEventsMarker
Widget _buildEventsMarker() {
return Container(
width: 80.0,
height: 20.0,
decoration: BoxDecoration(
color: Colors.blue,
shape: BoxShape.rectangle ,
borderRadius: null,
),
);
}
您可以在里面添加 TextContainer
以显示事件名称(暂时不要处理它)
推荐阅读
- swift - Swift 4 中不确定代码块的类似 Try-catch 功能
- excel - Excel:根据动态范围计算滚动平均值
- java - 从基本父 pom 继承 Spring Boot 依赖项导致我的应用程序的 cf push 命令失败
- javascript - 如何在 Dynamics 365 的配置页面中的 Web 表单上显示记录?
- android - 从深层链接启动时,我可以使用代码退出我的 android 应用程序吗?
- python - 根据特定列对列进行排序 | 蟒蛇 | 熊猫
- python - 为什么在 Python 中选择模块级函数而不是 @staticmethod(根据 Google 样式指南)?
- sql - PostgreSQL 全文搜索在某些情况下不起作用(Django)
- html - 在 Bootstrap 中使用 HTML 元视口标签
- javascript - 语法错误意外令牌} nodejs