Skip to content

Commit

Permalink
Merge pull request #284 from SimformSolutionsPvtLtd/fix/issue_283_wee…
Browse files Browse the repository at this point in the history
…k_day_placement

feat: Added Support for changing the week day position(top/bottom) in…
  • Loading branch information
PRBaraiya authored Nov 23, 2023
2 parents 0306ac2 + 8540380 commit 672b2cf
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
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)

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
1 change: 1 addition & 0 deletions lib/src/event_arrangers/event_arrangers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import '../constants.dart';
import '../extensions.dart';

part 'merge_event_arranger.dart';

part 'side_event_arranger.dart';

abstract class EventArranger<T extends Object?> {
Expand Down
6 changes: 6 additions & 0 deletions lib/src/week_view/_internal_week_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ class InternalWeekViewPage<T extends Object?> extends StatelessWidget {
/// Display full day events.
final FullDayEventBuilder<T> fullDayEventBuilder;

/// If true this will show week day at bottom position.
final bool showWeekDayAtBottom;

/// Flag to display half hours
final bool showHalfHours;

Expand Down Expand Up @@ -164,6 +167,7 @@ class InternalWeekViewPage<T extends Object?> extends StatelessWidget {
required this.scrollConfiguration,
required this.fullDayEventBuilder,
required this.weekDetectorBuilder,
required this.showWeekDayAtBottom,
required this.showHalfHours,
required this.showQuarterHours,
required this.emulateVerticalOffsetBy})
Expand All @@ -176,6 +180,8 @@ class InternalWeekViewPage<T extends Object?> extends StatelessWidget {
height: height + weekTitleHeight,
width: width,
child: Column(
verticalDirection:
showWeekDayAtBottom ? VerticalDirection.up : VerticalDirection.down,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
SizedBox(
Expand Down
5 changes: 5 additions & 0 deletions lib/src/week_view/week_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ class WeekView<T extends Object?> extends StatefulWidget {
/// Callback for the Header title
final HeaderTitleCallback? onHeaderTitleTap;

/// If true this will show week day at bottom position.
final bool showWeekDayAtBottom;

/// Main widget for week view.
const WeekView({
Key? key,
Expand Down Expand Up @@ -259,6 +262,7 @@ class WeekView<T extends Object?> extends StatefulWidget {
this.showHalfHours = false,
this.showQuarterHours = false,
this.emulateVerticalOffsetBy = 0,
this.showWeekDayAtBottom = false,
}) : assert(!(onHeaderTitleTap != null && weekPageHeaderBuilder != null),
"can't use [onHeaderTitleTap] & [weekPageHeaderBuilder] simultaneously"),
assert((timeLineOffset) >= 0,
Expand Down Expand Up @@ -486,6 +490,7 @@ class WeekViewState<T extends Object?> extends State<WeekView<T>> {
showQuarterHours: widget.showQuarterHours,
emulateVerticalOffsetBy:
widget.emulateVerticalOffsetBy,
showWeekDayAtBottom: widget.showWeekDayAtBottom,
),
);
},
Expand Down

0 comments on commit 672b2cf

Please sign in to comment.