flutter_week_view 0.2.1+1
flutter_week_view: ^0.2.1+1 copied to clipboard
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 !
Flutter Week View #
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 !
Flutter Week View is highly inspired by Android Week View.
Getting Started #
Getting started with Flutter Week View is very straight forward.
You have the choice between two widgets : FlutterDayView and FlutterWeekView.
Use the first one to display a single day and use the second one to display
multiple days.
Example #
If you want a real project
example, you can check this one on Github.
Day View #
Snippet :
// Let's get two dates :
DateTime now = DateTime.now();
DateTime date = DateTime(now.year, now.month, now.day);
// And here's our widget !
return DayView(
date: now,
events: [
FlutterWeekViewEvent(
title: 'An event 1',
description: 'A description 1',
start: date.subtract(Duration(hours: 1)),
end: date.add(Duration(hours: 18, minutes: 30)),
),
FlutterWeekViewEvent(
title: 'An event 2',
description: 'A description 2',
start: date.add(Duration(hours: 19)),
end: date.add(Duration(hours: 22)),
),
FlutterWeekViewEvent(
title: 'An event 3',
description: 'A description 3',
start: date.add(Duration(hours: 23, minutes: 30)),
end: date.add(Duration(hours: 25, minutes: 30)),
),
FlutterWeekViewEvent(
title: 'An event 4',
description: 'A description 4',
start: date.add(Duration(hours: 20)),
end: date.add(Duration(hours: 21)),
),
FlutterWeekViewEvent(
title: 'An event 5',
description: 'A description 5',
start: date.add(Duration(hours: 20)),
end: date.add(Duration(hours: 21)),
),
],
currentTimeCircleColor: Colors.pink,
);
Result :
Week view #
Snippet :
// Let's get two dates :
DateTime now = DateTime.now();
DateTime date = DateTime(now.year, now.month, now.day);
// And here's our widget !
return WeekView(
dates: [date.subtract(Duration(days: 1)), date, date.add(Duration(days: 1))],
events: [
FlutterWeekViewEvent(
title: 'An event 1',
description: 'A description 1',
start: date.subtract(Duration(hours: 1)),
end: date.add(Duration(hours: 18, minutes: 30)),
),
FlutterWeekViewEvent(
title: 'An event 2',
description: 'A description 2',
start: date.add(Duration(hours: 19)),
end: date.add(Duration(hours: 22)),
),
FlutterWeekViewEvent(
title: 'An event 3',
description: 'A description 3',
start: date.add(Duration(hours: 23, minutes: 30)),
end: date.add(Duration(hours: 25, minutes: 30)),
),
FlutterWeekViewEvent(
title: 'An event 4',
description: 'A description 4',
start: date.add(Duration(hours: 20)),
end: date.add(Duration(hours: 21)),
),
FlutterWeekViewEvent(
title: 'An event 5',
description: 'A description 5',
start: date.add(Duration(hours: 20)),
end: date.add(Duration(hours: 21)),
),
],
);
Result :
Options #
Common options #
Here are the options that are available for both FlutterDayView and FlutterWeekView :
eventsEvents to display.dateFormatterThe function that returns a formatted date as a String from a year, a month and a day.hourFormatterThe function that returns a formatted hour as a String from a hour and a minute.dayBarTextStyleThe day bar (top bar) text style.dayBarHeightThe day bar height (≤ 0 to disable).dayBarBackgroundColorThe day bar background color (nullto remove).hoursColumnTextStyleThe hours column (left column) text style.hoursColumnWidthThe hours column width (≤ 0 to disable).hoursColumnBackgroundColorThe hours column background color (nullto remove).hourRowHeightA hour row height (with a zoom factor of 1.0).inScrollableWidgetWhether to put the widget in a scrollable widget (disable if you want to manage the scroll by yourself).scrollToCurrentTimeWhether the widget should automatically scroll to the current time (hour and minute with day if you are in a Week View).userZoomableWhether the user is able to (un)zoom the widget.
Flutter day view #
Here are the specific options of FlutterDayView :
dateThe widget date.eventsColumnBackgroundPainterThe events column background painter.currentTimeRuleColorThe current time rule color (nullto disable).currentTimeCircleColorThe current time circle color (nullor blank to disable).
Flutter week view #
Here are the specific options of FlutterWeekView :
datesThe widget dates.dayViewBuilderThe function that allows to build a Day View widget.dayViewWidthA Day View width.
Please note that you can create a FlutterWeekView instance using a builder.
All previous options are still available but you don't need to provide the dates list.
However, you need to provide a DateCreator (and a date count if you can, if it's impossible for you to do it then scrollToCurrentTime will have no effect).
Contributions #
You have a lot of options to contribute to this project ! You can :
- Fork it on Github.
- Submit a feature request or a bug report.
- Donate to the developer.
- Watch a little ad on uTip.