WeekView class
A week-based calendar view displaying events across 7 days with hourly time slots.
The week view shows a horizontal grid with days of the week as columns and 24-hour time slots as rows. Events are positioned based on their start time and duration. Supports horizontal swipe navigation between weeks.
Features:
- 7-day (or 5-day) week grid with hourly slots
- Swipeable week navigation (infinite scroll)
- Synchronized vertical scrolling
- Current time indicator
- Events positioned by time and duration
- Day headers with date highlighting
- Holiday highlighting
- Weekend hiding option
- Auto-scroll to current time
- 12/24 hour format support
Example:
WeekView(
controller: calendarController,
config: CalendarConfig(
show24HourFormat: true,
showEventTime: true,
),
theme: CalendarTheme.light(),
onDaySelected: (date) {
print('Selected: $date');
},
onEventTap: (event) {
print('Event: ${event.title}');
},
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- WeekView
Constructors
- WeekView({Key? key, required CalendarController controller, required CalendarConfig config, required CalendarTheme theme, void onDaySelected(DateTime)?, void onEventTap(CalendarEvent)?})
-
Creates a week view.
const
Properties
- config → CalendarConfig
-
Configuration for display and interaction options.
final
- controller → CalendarController
-
The calendar controller managing state and events.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onDaySelected → void Function(DateTime)?
-
Callback invoked when a day header is tapped.
final
- onEventTap → void Function(CalendarEvent)?
-
Callback invoked when an event is tapped.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- theme → CalendarTheme
-
Theme configuration for visual styling.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< WeekView> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited