Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/rtl-support
Browse files Browse the repository at this point in the history
# Conflicts:
#	lib/src/day_view/_internal_day_view_page.dart
#	lib/src/day_view/day_view.dart
#	lib/src/painters.dart
#	lib/src/week_view/_internal_week_view_page.dart
  • Loading branch information
Gawdat committed Nov 27, 2023
2 parents dafdb00 + 672b2cf commit 0050896
Show file tree
Hide file tree
Showing 16 changed files with 580 additions and 114 deletions.
18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# [1.0.5] (UnReleased)(https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/1.0.5)

- Fixed issue related to auto scroll to initial duration for day
view-[#269](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/269)
- Added
feature added a callback for the default header title
- [#241](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/241)
- Added
feature added the quarterHourIndicator for the DayView & halfHourIndicator and
quarterHourIndicator for WeekView
- [#270](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/270)
- Added
feature added Support for changing the week day position(top/bottom) in weekView
- [#283](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/283)

# [1.0.4 - 9 Aug 2023](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/1.0.4)

- Fixed
Expand All @@ -8,10 +23,9 @@
Issue [#237 - DayView & MonthView layout issue in landscape mode](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/237)
- Added Feature
[#57 - Change default start hour in DayView](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/57)
- Fixed
- Fixed
Issue [#225 - Unwanted space at top in DayView while using sliver](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/225)


# [1.0.3 - 3 Apr 2023](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/1.0.3)

- Added
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ DayView(
eventArranger: SideEventArranger(), // To define how simultaneous events will be arranged.
onEventTap: (events, date) => print(events),
onDateLongPress: (date) => print(date),
hourLinePainter: (lineColor, lineHeight, offset, minuteHeight, showVerticalLine, verticalLineOffset) {
return //Your custom painter.
}
);
```

Expand All @@ -200,9 +203,15 @@ WeekView(
onEventTap: (events, date) => print(events),
onDateLongPress: (date) => print(date),
startDay: WeekDays.sunday, // To change the first day of the week.
showVerticalLines: false, // Show the vertical line between days.
hourLinePainter: (lineColor, lineHeight, offset, minuteHeight, showVerticalLine, verticalLineOffset) {
return //Your custom painter.
}
);
```



To see the list of all parameters and detailed description of parameters
visit [documentation](https://pub.dev/documentation/calendar_view/latest/calendar_view/calendar_view-library.html)
.
Expand Down
26 changes: 26 additions & 0 deletions lib/src/components/_internal_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ class TimeLine extends StatelessWidget {
/// Flag to display half hours.
final bool showHalfHours;

/// Flag to display quarter hours.
final bool showQuarterHours;

static DateTime get _date => DateTime.now();

double get _halfHourHeight => hourHeight / 2;
Expand All @@ -132,6 +135,7 @@ class TimeLine extends StatelessWidget {
required this.timeLineOffset,
required this.timeLineBuilder,
this.showHalfHours = false,
this.showQuarterHours = false,
}) : super(key: key);

@override
Expand Down Expand Up @@ -161,6 +165,28 @@ class TimeLine extends StatelessWidget {
hour: i,
minutes: 30,
),
if (showQuarterHours)
for (int i = 0; i < Constants.hoursADay; i++) ...[
/// this is for 15 minutes
_timelinePositioned(
topPosition:
hourHeight * i - timeLineOffset + hourHeight * 0.25,
bottomPosition:
height - (hourHeight * (i + 1)) + timeLineOffset,
hour: i,
minutes: 15,
),

/// this is for 45 minutes
_timelinePositioned(
topPosition:
hourHeight * i - timeLineOffset + hourHeight * 0.75,
bottomPosition:
height - (hourHeight * (i + 1)) + timeLineOffset,
hour: i,
minutes: 45,
),
],
],
),
);
Expand Down
3 changes: 3 additions & 0 deletions lib/src/components/event_scroll_notifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ class EventScrollConfiguration<T extends Object?> extends ValueNotifier<bool> {
EventScrollConfiguration() : super(false);

bool get shouldScroll => _shouldScroll;

CalendarEventData<T>? get event => _event;

Duration? get duration => _duration;

Curve? get curve => _curve;

// This function will be completed once [completeScroll] is called.
Expand Down
1 change: 1 addition & 0 deletions lib/src/components/month_view_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ class MonthPageHeader extends CalendarPageHeader {
dateStringBuilder ?? MonthPageHeader._monthStringBuilder,
headerStyle: headerStyle,
);

static String _monthStringBuilder(DateTime date, {DateTime? secondaryDate}) =>
"${date.month} - ${date.year}";
}
Expand Down
1 change: 1 addition & 0 deletions lib/src/components/week_view_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class WeekPageHeader extends CalendarPageHeader {
headerStringBuilder ?? WeekPageHeader._weekStringBuilder,
headerStyle: headerStyle,
);

static String _weekStringBuilder(DateTime date, {DateTime? secondaryDate}) =>
"${date.day} / ${date.month} / ${date.year} to "
"${secondaryDate != null ? "${secondaryDate.day} / "
Expand Down
1 change: 1 addition & 0 deletions lib/src/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Constants {
static const Color white = Color(0xffffffff);
static const Color offWhite = Color(0xfff0f0f0);
static const Color headerBackground = Color(0xFFDCF0FF);

static Color get randomColor {
return Color.fromRGBO(_random.nextInt(_maxColor),
_random.nextInt(_maxColor), _random.nextInt(_maxColor), 1);
Expand Down
54 changes: 43 additions & 11 deletions lib/src/day_view/_internal_day_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class InternalDayViewPage<T extends Object?> extends StatelessWidget {
/// Settings for hour indicator lines.
final HourIndicatorSettings hourIndicatorSettings;

/// Custom painter for hour line.
final CustomHourLinePainter hourLinePainter;

/// Flag to display live time indicator.
/// If true then indicator will be displayed else not.
final bool showLiveLine;
Expand Down Expand Up @@ -95,11 +98,20 @@ class InternalDayViewPage<T extends Object?> extends StatelessWidget {
/// Flag to display half hours.
final bool showHalfHours;

/// Flag to display quarter hours.
final bool showQuarterHours;

/// Settings for half hour indicator lines.
final HourIndicatorSettings halfHourIndicatorSettings;

/// Settings for half hour indicator lines.
final HourIndicatorSettings quarterHourIndicatorSettings;

final ScrollController scrollController;

/// Emulate vertical line offset from hour line starts.
final double emulateVerticalOffsetBy;

final bool isRtl;

/// Defines a single day page.
Expand All @@ -112,6 +124,7 @@ class InternalDayViewPage<T extends Object?> extends StatelessWidget {
required this.controller,
required this.timeLineBuilder,
required this.hourIndicatorSettings,
required this.hourLinePainter,
required this.showLiveLine,
required this.liveTimeIndicatorSettings,
required this.heightPerMinute,
Expand All @@ -130,14 +143,16 @@ class InternalDayViewPage<T extends Object?> extends StatelessWidget {
required this.scrollController,
required this.dayDetectorBuilder,
required this.showHalfHours,
required this.showQuarterHours,
required this.halfHourIndicatorSettings,
required this.quarterHourIndicatorSettings,
required this.emulateVerticalOffsetBy,
required this.isRtl,
}) : super(key: key);

@override
Widget build(BuildContext context) {
final fullDayEventList = controller.getFullDayEvent(date);

return Container(
height: height,
width: width,
Expand All @@ -156,16 +171,17 @@ class InternalDayViewPage<T extends Object?> extends StatelessWidget {
children: [
CustomPaint(
size: Size(width, height),
painter: HourLinePainter(
lineColor: hourIndicatorSettings.color,
lineHeight: hourIndicatorSettings.height,
offset: timeLineWidth + hourIndicatorSettings.offset,
minuteHeight: heightPerMinute,
verticalLineOffset: verticalLineOffset,
showVerticalLine: showVerticalLine,
lineStyle: hourIndicatorSettings.lineStyle,
dashWidth: hourIndicatorSettings.dashWidth,
dashSpaceWidth: hourIndicatorSettings.dashSpaceWidth,
painter: hourLinePainter(
hourIndicatorSettings.color,
hourIndicatorSettings.height,
timeLineWidth + hourIndicatorSettings.offset,
heightPerMinute,
showVerticalLine,
verticalLineOffset,
hourIndicatorSettings.lineStyle,
hourIndicatorSettings.dashWidth,
hourIndicatorSettings.dashSpaceWidth,
emulateVerticalOffsetBy,
isRtl: isRtl,
),
),
Expand All @@ -184,6 +200,21 @@ class InternalDayViewPage<T extends Object?> extends StatelessWidget {
halfHourIndicatorSettings.dashSpaceWidth,
),
),
if (showQuarterHours)
CustomPaint(
size: Size(width, height),
painter: QuarterHourLinePainter(
lineColor: quarterHourIndicatorSettings.color,
lineHeight: quarterHourIndicatorSettings.height,
offset: timeLineWidth +
quarterHourIndicatorSettings.offset,
minuteHeight: heightPerMinute,
lineStyle: quarterHourIndicatorSettings.lineStyle,
dashWidth: quarterHourIndicatorSettings.dashWidth,
dashSpaceWidth:
quarterHourIndicatorSettings.dashSpaceWidth,
),
),
dayDetectorBuilder(
width: width,
height: height,
Expand Down Expand Up @@ -218,6 +249,7 @@ class InternalDayViewPage<T extends Object?> extends StatelessWidget {
timeLineOffset: timeLineOffset,
timeLineWidth: timeLineWidth,
showHalfHours: showHalfHours,
showQuarterHours: showQuarterHours,
key: ValueKey(heightPerMinute),
),
if (showLiveLine && liveTimeIndicatorSettings.height > 0)
Expand Down
Loading

0 comments on commit 0050896

Please sign in to comment.