Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pinkfish/flutter_calendar
Calendar widget for flutter
https://github.com/pinkfish/flutter_calendar
Last synced: 2 months ago
JSON representation
Calendar widget for flutter
- Host: GitHub
- URL: https://github.com/pinkfish/flutter_calendar
- Owner: pinkfish
- License: bsd-2-clause
- Created: 2018-05-30T19:01:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-18T18:13:24.000Z (about 3 years ago)
- Last Synced: 2024-08-02T15:05:50.982Z (5 months ago)
- Language: Dart
- Size: 14.2 MB
- Stars: 243
- Watchers: 8
- Forks: 40
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-flutter - Calendar Widget - Calendar widget by [David Bennett](https://github.com/pinkfish). (Components / UI)
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 _listToShow;
StreamSubscription _listening;@override
Widget buildItem(BuildContext context, CalendarEvent event) {
return new GameCard(_listToShow[event.index]);
}@override
List getEvents(DateTime start, DateTime end) {
if (_listToShow == null) {
_listToShow = UserDatabaseData.instance.games.values.toList();
}
if (_listToShow == null) {
return [];
}
List events = new List();
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](https://flutter.io/).
For help on editing package code, view the [documentation](https://flutter.io/developing-packages/).