Skip to content

Commit

Permalink
fix: 🐛Unwanted space at top of dayView while using sliver #225.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaiminrana05 committed Aug 9, 2023
1 parent c0334eb commit bda779a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,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
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)

Expand Down
3 changes: 2 additions & 1 deletion lib/src/components/day_view_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class DayPageHeader extends CalendarPageHeader {
dateStringBuilder ?? DayPageHeader._dayStringBuilder,
headerStyle: headerStyle,
);

static String _dayStringBuilder(DateTime date, {DateTime? secondaryDate}) =>
"${date.day} - ${date.month} - ${date.year}";
}
Expand Down Expand Up @@ -227,7 +228,7 @@ class FullDayEventView<T> extends StatelessWidget {
constraints: boxConstraints,
child: ListView.builder(
itemCount: events.length,
padding: padding,
padding: padding ?? EdgeInsets.zero,
shrinkWrap: true,
itemBuilder: (context, index) => InkWell(
onTap: () => onEventTap?.call(events[index], date),
Expand Down
5 changes: 4 additions & 1 deletion lib/src/day_view/_internal_day_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@ class InternalDayViewPage<T extends Object?> extends StatelessWidget {

@override
Widget build(BuildContext context) {
final fullDayEventList = controller.getFullDayEvent(date);
return Container(
height: height,
width: width,
child: Column(
children: [
fullDayEventBuilder(controller.getFullDayEvent(date), date),
fullDayEventList.isEmpty
? SizedBox.shrink()
: fullDayEventBuilder(fullDayEventList, date),
Expanded(
child: SingleChildScrollView(
controller: scrollController,
Expand Down
24 changes: 15 additions & 9 deletions lib/src/week_view/_internal_week_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class InternalWeekViewPage<T extends Object?> extends StatelessWidget {
final EventScrollConfiguration scrollConfiguration;

/// Display full day events.
final FullDayEventBuilder<T>? fullDayEventBuilder;
final FullDayEventBuilder<T> fullDayEventBuilder;

/// A single page for week view.
const InternalWeekViewPage({
Expand Down Expand Up @@ -141,7 +141,7 @@ class InternalWeekViewPage<T extends Object?> extends StatelessWidget {
required this.weekDays,
required this.minuteSlotSize,
required this.scrollConfiguration,
this.fullDayEventBuilder,
required this.fullDayEventBuilder,
required this.weekDetectorBuilder,
}) : super(key: key);

Expand Down Expand Up @@ -189,13 +189,19 @@ class InternalWeekViewPage<T extends Object?> extends StatelessWidget {
SizedBox(width: timeLineWidth + hourIndicatorSettings.offset),
...List.generate(
filteredDates.length,
(index) => SizedBox(
width: weekTitleWidth,
child: fullDayEventBuilder?.call(
controller.getFullDayEvent(filteredDates[index]),
dates[index],
),
),
(index) {
final fullDayEventList =
controller.getFullDayEvent(filteredDates[index]);
return fullDayEventList.isEmpty
? SizedBox.shrink()
: SizedBox(
width: weekTitleWidth,
child: fullDayEventBuilder.call(
fullDayEventList,
dates[index],
),
);
},
)
],
),
Expand Down

0 comments on commit bda779a

Please sign in to comment.