搜索插件、代码仓与 APP 分类

插件详情v1.0.0

sliver_calendar

显示一个 Flutter 日历视图。

近 30 天下载
32
喜欢数
22
Pub 分数
40

安装插件

flutter pub add sliver_calendar

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个基于滑动条的日历视图 Flutter 包,用于在可滚动且高效的布局中显示日期。专为在自定义滚动视图中使用而设计,支持平滑滚动和动态日期渲染。该包非常适合需要简洁、交互式日历界面且无需大量样板代码的应用程序。通过提供的添加命令,可无缝集成到现有的 Flutter 项目中。

适合场景

  • 在可滚动日历中显示每日事件
  • 构建预约调度界面
  • 在可滚动表单中集成日期选择器
  • 创建基于时间线的应用程序
  • 在仪表板中实现日历视图

主要特点

  • 基于 Sliver 的性能优化
  • 可自定义的日期单元格样式
  • 支持事件标记
  • 内置导航控件
  • 大日期范围的高效渲染

适合对象

  • 开发可滚动日历UI的开发者
  • 需要轻量级日历组件的应用程序
  • 使用 CustomScrollView 的项目
  • 注重性能和可扩展性的团队
  • Flutter 初学者探索 slivers

使用建议

  • 需要在 CustomScrollView 内部进行集成
  • 有限的内置事件管理
  • 无原生本地化支持
  • 可能需要额外的样式来支持复杂主题
  • 依赖外部状态管理来获取事件数据

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Calendar

Shows a scrolling calendar list of events. This is still relatively basic, it always assumes that the getEvents returns the entire list of calendar events (mostly ignoring the values passed into the source). It does work however :) Optionally, you can use an image as a background for the calendar header and another image for the month header.

The calendar uses slivers to display the widgets in the view and lets you scroll forward and backward through the events. The header widget will drop down and open up the days of the month, letting you select specific days as well as move back and forth between the months. By default it displays a list of events and not a day view, the day view code is all just a stub right now.

Here is how to use the calendar widget itself:

new CalendarWidget(
              initialDate: new TZDateTime.now(local),
              buildItem: buildItem,
              getEvents: getEvents,
            );

How to setup a source for the calendar widget.

...
  List<Game> _listToShow;
  StreamSubscription<UpdateReason> _listening;

  @override
  Widget buildItem(BuildContext context, CalendarEvent event) {
    return new GameCard(_listToShow[event.index]);
  }

  @override
  List<CalendarEvent> getEvents(DateTime start, DateTime end) {
    if (_listToShow == null) {
      _listToShow = UserDatabaseData.instance.games.values.toList();
    }
    if (_listToShow == null) {
      return [];
    }
    List<CalendarEvent> events = new List<CalendarEvent>();
    int pos = 0;
    _listToShow.forEach((Game g) => events.add(new CalendarEvent(
        instant: g.tzTime, instantEnd: g.tzEndTime, index: pos++)));
    return events;
  }
...

Example of the calendar widget in action:

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

所属分类

依赖

依赖清单 3 项

源码仓库

使用此插件的项目

暂无相关数据。