搜尋套件、儲存庫與 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 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。