Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added Support for changing the week day position(top/bottom) in… #284

Merged
merged 1 commit into from
Nov 23, 2023
Merged
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
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
Loading