Skip to content

Commit

Permalink
🚧 Resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham-jitiya-simform committed Jan 3, 2025
1 parent 60cd573 commit 626b6c2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 32 deletions.
4 changes: 2 additions & 2 deletions example/lib/widgets/week_view_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class WeekViewWidget extends StatelessWidget {
return WeekView(
key: state,
width: width,
showWeekends: true,
showWeekends: false,
showLiveTimeLineInAllDays: true,
showThreeDaysView: true,
// showThreeDaysView: true,
eventArranger: SideEventArranger(maxWidth: 30),
timeLineWidth: 65,
scrollPhysics: const BouncingScrollPhysics(),
Expand Down
42 changes: 19 additions & 23 deletions lib/src/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,25 @@ extension DateTimeExtensions on DateTime {
// adding 1 in index. So, new formula with WeekDays is,
// difference = (weekdays - (start.index + 1))%7

// final startDay =
// DateTime(year, month, day - (weekday - start.index - 1) % 7);
// // Generate weekdays with weekends or without weekends
// final days = List.generate(
// 7,
// (index) => DateTime(startDay.year, startDay.month, startDay.day + index),
// )
// .where(
// (date) =>
// showWeekEnds ||
// (date.weekday != DateTime.saturday &&
// date.weekday != DateTime.sunday),
// )
// .toList();

// Three days view
// final days = showThreeDays ? day : day - (weekday - start.index - 1) % 7;
// final startDay = DateTime(year, month, days);
//
// return List.generate(showThreeDays ? 3 : 7, (index) {
// return startDay.add(Duration(days: index));
// });
return days;
// Generate weekdays with weekends or without weekends
final newDays = <DateTime>[];
var daysToGenerate = showThreeDays ? 3 : 7;
var i = 0;
final startDate = DateTime(year, month, day);

while (i < daysToGenerate) {
final nextDay = startDate.add(Duration(days: i));
if (showWeekEnds) {
newDays.add(nextDay);
i++;
} else if (nextDay.weekday != DateTime.saturday &&
nextDay.weekday != DateTime.sunday) {
newDays.add(nextDay);
i++;
}
}

return newDays;
}

/// Returns the first date of week containing the current date
Expand Down
14 changes: 7 additions & 7 deletions lib/src/week_view/week_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -528,15 +528,15 @@ class WeekViewState<T extends Object?> extends State<WeekView<T>> {
physics: widget.pageViewPhysics,
onPageChanged: _onPageChange,
itemBuilder: (_, index) {
final dates = DateTime(_minDate.year, _minDate.month,
_minDate.day + (index * DateTime.daysPerWeek))
.datesOfWeek(
start: widget.startDay,
showWeekEnds: widget.showWeekends,
);
// final dates = DateTime(_minDate.year, _minDate.month,
// _minDate.day + (index * DateTime.daysPerWeek))
// .datesOfWeek(
// start: widget.startDay,
// showWeekEnds: widget.showWeekends,
// );

// TODO(Shubham): Three days view
// final dates = _getDatesOnWeek(index);
final dates = _getDatesOnWeek(index);

return ValueListenableBuilder(
valueListenable: _scrollConfiguration,
Expand Down

0 comments on commit 626b6c2

Please sign in to comment.