All Projects → JonasWanke → Timetable

JonasWanke / Timetable

Licence: apache-2.0
📅 Customizable flutter calendar widget including day and week views

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to Timetable

Primedatepicker
PrimeDatePicker is a tool that provides picking a single day, multiple days, and a range of days.
Stars: ✭ 292 (+108.57%)
Mutual labels:  material-design, calendar, calendar-view
Material Calendar View
📅 Material Design Calendar compatible with API 11+
Stars: ✭ 360 (+157.14%)
Mutual labels:  material-design, calendar, calendar-view
Crunchycalendar
A beautiful material calendar with endless scroll, range selection and a lot more!
Stars: ✭ 465 (+232.14%)
Mutual labels:  material-design, calendar, calendar-view
Flutterweekview
Displays a highly customizable week view (or day view) which is able to display events, to be scrolled, to be zoomed-in & out and a lot more !
Stars: ✭ 130 (-7.14%)
Mutual labels:  package, calendar, calendar-view
Table calendar
Highly customizable, feature-packed Flutter Calendar with gestures, animations and multiple formats
Stars: ✭ 897 (+540.71%)
Mutual labels:  calendar, calendar-view
Mbcalendarkit
An open source calendar framework for iOS, with support for customization, IBDesignable, Autolayout, and more.
Stars: ✭ 561 (+300.71%)
Mutual labels:  calendar, calendar-view
Peppy Calendarview
Simple and fast Material Design calendar view for Android.
Stars: ✭ 30 (-78.57%)
Mutual labels:  calendar, calendar-view
Etar Calendar
Android open source calendar
Stars: ✭ 1,051 (+650.71%)
Mutual labels:  material-design, calendar
Cadar
Android solution which represents month and list calendar views.
Stars: ✭ 360 (+157.14%)
Mutual labels:  calendar, calendar-view
Calendarview
Android上一个优雅、万能自定义UI、仿iOS、支持垂直、水平方向切换、支持周视图、自定义周起始、性能高效的日历控件,支持热插拔实现的UI定制!支持标记、自定义颜色、农历、自定义月视图各种显示模式等。Canvas绘制,速度快、占用内存低,你真的想不到日历居然还可以如此优雅!An elegant, highly customized and high-performance Calendar Widget on Android.
Stars: ✭ 7,998 (+5612.86%)
Mutual labels:  calendar, calendar-view
Espresso
🚚 Espresso is an express delivery tracking app designed with Material Design style, built on MVP(Model-View-Presenter) architecture with RxJava2, Retrofit2, Realm database and ZXing
Stars: ✭ 1,084 (+674.29%)
Mutual labels:  package, material-design
Recyclercalendarandroid
A simple DIY library to generate your own custom Calendar View using RecyclerView, written in Kotlin
Stars: ✭ 83 (-40.71%)
Mutual labels:  calendar, calendar-view
Calendarview
An Easy to Use Calendar for iOS (Swift 5.0)
Stars: ✭ 429 (+206.43%)
Mutual labels:  calendar, calendar-view
React Material Calendar
React component inspired by google calendar app.
Stars: ✭ 25 (-82.14%)
Mutual labels:  material-design, calendar
Kotlin Agendacalendarview
Android calendar library provides easy to use widget with events
Stars: ✭ 81 (-42.14%)
Mutual labels:  calendar, calendar-view
Swift Week View
An iOS calendar library for displaying calendar events in a week view.
Stars: ✭ 88 (-37.14%)
Mutual labels:  calendar, calendar-view
Yycalendar
Simple and Clear Calendar
Stars: ✭ 46 (-67.14%)
Mutual labels:  calendar, calendar-view
Android Week View
Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling.
Stars: ✭ 3,347 (+2290.71%)
Mutual labels:  calendar, calendar-view
Cvcalendar
A custom visual calendar for iOS 8+ written in Swift (>= 4.0).
Stars: ✭ 3,435 (+2353.57%)
Mutual labels:  calendar, calendar-view
Calendarview2
Calendar view for Android. Pretty.
Stars: ✭ 72 (-48.57%)
Mutual labels:  calendar, calendar-view

📅 Customizable, animated calendar widget including day & week views.

Event positioning demo Dark mode & custom range
Screenshot of timetable Screenshot of timetable in dark mode with only three visible days

Getting started

1. Initialize time_machine

This package uses time_machine for handling date and time, which you first have to initialize.

Add this to your pubspec.yaml:

flutter:
  assets:
    - packages/time_machine/data/cultures/cultures.bin
    - packages/time_machine/data/tzdb/tzdb.bin

Modify your main.dart's main():

import 'package:flutter/services.dart';
import 'package:time_machine/time_machine.dart';

void main() async {
  // Call these two functions before `runApp()`.
  WidgetsFlutterBinding.ensureInitialized();
  await TimeMachine.initialize({'rootBundle': rootBundle});

  runApp(MyApp());
}

Source: https://pub.dev/packages/time_machine#flutter-specific-notes

2. Define your Events

Events are provided as instances of Event. To get you started, there's the subclass BasicEvent, which you can instantiate directly. If you want to be more specific, you can also implement your own class extending Event.

Note: Most classes of timetable accept a type-parameter E extends Event. Please set it to your chosen Event-subclass (e.g. BasicEvent) to avoid runtime exceptions.

In addition, you also need a Widget to display your events. When using BasicEvent, this can simply be BasicEventWidget.

3. Create an EventProvider

As the name suggests, you use EventProvider to provide Events to timetable. There are currently two EventProviders to choose from:

final myEventProvider = EventProvider.list([
  BasicEvent(
    id: 0,
    title: 'My Event',
    color: Colors.blue,
    start: LocalDate.today().at(LocalTime(13, 0, 0)),
    end: LocalDate.today().at(LocalTime(15, 0, 0)),
  ),
]);

For trying out the behavior of changing events, you can create a StreamController<List<E>> and add() different lists of events, e.g. in Future.delayed():

final eventController = StreamController<List<BasicEvent>>()..add([]);
final provider = EventProvider.simpleStream(eventController.stream);
Future.delayed(Duration(seconds: 5), () => eventController.add(/* some events */));

// Don't forget to close the stream controller when you're done, e.g. in `dispose`:
eventController.close();

See the example for more EventProvider samples!

4. Create a TimetableController

Similar to a ScrollController or a TabController, a TimetableController is responsible for interacting with a Timetable and managing its state. You can instantiate it with your EventProvider:

final myController = TimetableController(
  eventProvider: myEventProvider,
  // Optional parameters with their default values:
  initialTimeRange: InitialTimeRange.range(
    startTime: LocalTime(8, 0, 0),
    endTime: LocalTime(20, 0, 0),
  ),
  initialDate: LocalDate.today(),
  visibleRange: VisibleRange.week(),
  firstDayOfWeek: DayOfWeek.monday,
);

Don't forget to dispose your controller, e.g. in State.dispose!

5. Create your Timetable

Using your TimetableController, you can now create a Timetable widget:

Timetable<BasicEvent>(
  controller: myController,
  eventBuilder: (event) => BasicEventWidget(event),
  allDayEventBuilder: (context, event, info) =>
      BasicAllDayEventWidget(event, info: info),
)

And you're done 🎉

Theming

For a full list of visual properties that can be tweaked, see TimetableThemeData.

To apply a theme, specify it in the Timetable constructor:

Timetable<BasicEvent>(
  controller: /* ... */,
  theme: TimetableThemeData(
    primaryColor: Colors.teal,
    partDayEventMinimumDuration: Period(minutes: 30),
    // ...and many more!
  ),
),

Localization

time_machine is used internally for date & time formatting. By default, it uses en_US as its locale (managed by the Culture class) and doesn't know about Flutter's locale. To change the locale, set Culture.current after the call to TimeMachine.initialize:

// Supported cultures: https://github.com/Dana-Ferguson/time_machine/tree/master/lib/data/cultures
Culture.current = await Cultures.getCulture('de');

To automatically react to locale changes of the app, see Dana-Ferguson/time_machine#28.

Note: A better solution for Localization is already planned.

Features & Coming soon

  • [x] Smartly arrange overlapping events
  • [x] Zooming
  • [x] Selectable VisibleRanges
  • [x] Display all-day events at the top
  • [x] Theming
  • [ ] Animate between different VisibleRanges: see #17
  • [ ] Month-view, Agenda-view: see #17
  • [x] Listener when tapping the background (e.g. for creating an event)
  • [ ] Support for event resizing
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].