Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions doc/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ Default hour indicator settings.
* To customise timeline use `timeLineBuilder`.
* To change Hour lines color use `HourIndicatorSettings`.
* To style hours, half hours & quarter hours use `HourIndicatorSettings`. Default color used is `surfaceContainerHighest`
* To customise divider between weekdays and full-day events use `dividerSettings`.

```dart
hourIndicatorSettings: HourIndicatorSettings(
Expand All @@ -669,6 +670,16 @@ Default hour indicator settings.
color: Colors.redAccent,
lineStyle: LineStyle.dashed,
),
dividerSettings: DividerSettings(
thickness: 2,
height: 2,
color: Colors.blueAccent,
),
```

Hide divider in week view.
```dart
dividerSettings: DividerSettings.none(),
```

### Month view
Expand Down
26 changes: 26 additions & 0 deletions lib/src/modals.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,32 @@ class HourIndicatorSettings {
);
}

/// Settings for divider between FullDay events and weekdays header
class DividerSettings {
/// Thickness of the divider line
final double thickness;

/// Height of the divider
final double height;

/// Color of the divider line
final Color color;

/// Settings for divider between FullDay events and weekdays header
const DividerSettings({
this.thickness = 1.0,
this.height = 1.0,
this.color = Colors.grey,
}) : assert(thickness >= 0, "Thickness must be greater than or equal to 0."),
assert(height >= 0, "Height must be greater than or equal to 0.");

factory DividerSettings.none() => DividerSettings(
color: Colors.transparent,
thickness: 0.0,
height: 0.0,
);
}

/// Settings for live time line
class LiveTimeIndicatorSettings {
/// Color of time indicator.
Expand Down
10 changes: 7 additions & 3 deletions lib/src/multi_day_view/_internal_multi_day_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class InternalMultiDayViewPage<T extends Object?> extends StatefulWidget {
/// Settings for quarter hour indicator lines.
final HourIndicatorSettings quarterHourIndicatorSettings;

/// Settings for divider between weekdays and full-day events.
final DividerSettings dividerSettings;

/// Flag to display live line.
final bool showLiveLine;

Expand Down Expand Up @@ -186,6 +189,7 @@ class InternalMultiDayViewPage<T extends Object?> extends StatefulWidget {
required this.hourLinePainter,
required this.halfHourIndicatorSettings,
required this.quarterHourIndicatorSettings,
required this.dividerSettings,
required this.showLiveLine,
required this.liveTimeIndicatorSettings,
required this.heightPerMinute,
Expand Down Expand Up @@ -297,9 +301,9 @@ class _InternalMultiDayViewPageState<T extends Object?>
),
if (widget.showMutliDayBottomLine)
Divider(
thickness: 1,
height: 1,
color: themeColor.borderColor,
thickness: widget.dividerSettings.thickness,
height: widget.dividerSettings.height,
color: widget.dividerSettings.color,
),
SizedBox(
width: widget.width,
Expand Down
11 changes: 11 additions & 0 deletions lib/src/multi_day_view/multi_day_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class MultiDayView<T extends Object?> extends StatefulWidget {
/// Settings for quarter hour indicator settings.
final HourIndicatorSettings? quarterHourIndicatorSettings;

/// Settings for divider between weekdays and full-day events.
final DividerSettings? dividerSettings;

/// Settings for live time indicator settings.
final LiveTimeIndicatorSettings? liveTimeIndicatorSettings;

Expand Down Expand Up @@ -266,6 +269,7 @@ class MultiDayView<T extends Object?> extends StatefulWidget {
this.hourLinePainter,
this.halfHourIndicatorSettings,
this.quarterHourIndicatorSettings,
this.dividerSettings,
this.timeLineBuilder,
this.timeLineWidth,
this.liveTimeIndicatorSettings,
Expand Down Expand Up @@ -361,6 +365,7 @@ class MultiDayViewState<T extends Object?> extends State<MultiDayView<T>> {
late HourIndicatorSettings _halfHourIndicatorSettings;
late LiveTimeIndicatorSettings _liveTimeIndicatorSettings;
late HourIndicatorSettings _quarterHourIndicatorSettings;
late DividerSettings _dividerSettings;

late PageController _pageController;

Expand Down Expand Up @@ -559,6 +564,7 @@ class MultiDayViewState<T extends Object?> extends State<MultiDayView<T>> {
_halfHourIndicatorSettings,
quarterHourIndicatorSettings:
_quarterHourIndicatorSettings,
dividerSettings: _dividerSettings,
dates: dates,
showLiveLine: widget.showLiveTimeLineInAllDays ||
_showLiveTimeIndicator(dates),
Expand Down Expand Up @@ -682,6 +688,11 @@ class MultiDayViewState<T extends Object?> extends State<MultiDayView<T>> {

assert(_quarterHourIndicatorSettings.height < _hourHeight,
"quarterHourIndicator height must be less than minuteHeight * 60");

_dividerSettings = widget.dividerSettings ??
DividerSettings(
color: context.multiDayViewTheme.borderColor,
);
}

void _calculateHeights() {
Expand Down
10 changes: 7 additions & 3 deletions lib/src/week_view/_internal_week_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class InternalWeekViewPage<T extends Object?> extends StatefulWidget {
/// Settings for quarter hour indicator lines.
final HourIndicatorSettings quarterHourIndicatorSettings;

/// Settings for divider between FullDay events and weekdays header.
final DividerSettings dividerSettings;

/// Flag to display live line.
final bool showLiveLine;

Expand Down Expand Up @@ -183,6 +186,7 @@ class InternalWeekViewPage<T extends Object?> extends StatefulWidget {
required this.hourLinePainter,
required this.halfHourIndicatorSettings,
required this.quarterHourIndicatorSettings,
required this.dividerSettings,
required this.showLiveLine,
required this.liveTimeIndicatorSettings,
required this.heightPerMinute,
Expand Down Expand Up @@ -296,9 +300,9 @@ class _InternalWeekViewPageState<T extends Object?>
),
),
Divider(
thickness: 1,
height: 1,
color: themeColor.borderColor,
thickness: widget.dividerSettings.thickness,
height: widget.dividerSettings.height,
color: widget.dividerSettings.color,
),
SizedBox(
width: widget.width,
Expand Down
11 changes: 11 additions & 0 deletions lib/src/week_view/week_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class WeekView<T extends Object?> extends StatefulWidget {
/// Settings for quarter hour indicator settings.
final HourIndicatorSettings? quarterHourIndicatorSettings;

/// Settings for divider between FullDay events and weekdays header.
final DividerSettings? dividerSettings;

/// Settings for live time indicator settings.
final LiveTimeIndicatorSettings? liveTimeIndicatorSettings;

Expand Down Expand Up @@ -263,6 +266,7 @@ class WeekView<T extends Object?> extends StatefulWidget {
this.hourLinePainter,
this.halfHourIndicatorSettings,
this.quarterHourIndicatorSettings,
this.dividerSettings,
this.timeLineBuilder,
this.timeLineWidth,
this.liveTimeIndicatorSettings,
Expand Down Expand Up @@ -357,6 +361,7 @@ class WeekViewState<T extends Object?> extends State<WeekView<T>> {
late HourIndicatorSettings _halfHourIndicatorSettings;
late LiveTimeIndicatorSettings _liveTimeIndicatorSettings;
late HourIndicatorSettings _quarterHourIndicatorSettings;
late DividerSettings _dividerSettings;

late PageController _pageController;

Expand Down Expand Up @@ -548,6 +553,7 @@ class WeekViewState<T extends Object?> extends State<WeekView<T>> {
halfHourIndicatorSettings: _halfHourIndicatorSettings,
quarterHourIndicatorSettings:
_quarterHourIndicatorSettings,
dividerSettings: _dividerSettings,
dates: dates,
showLiveLine: widget.showLiveTimeLineInAllDays ||
_showLiveTimeIndicator(dates),
Expand Down Expand Up @@ -669,6 +675,11 @@ class WeekViewState<T extends Object?> extends State<WeekView<T>> {

assert(_quarterHourIndicatorSettings.height < _hourHeight,
"quarterHourIndicator height must be less than minuteHeight * 60");

_dividerSettings = widget.dividerSettings ??
DividerSettings(
color: context.multiDayViewTheme.borderColor,
);
}

void _calculateHeights() {
Expand Down
Loading