Skip to content

Commit

Permalink
Add IgnorePointer to live indicator to allow to press event
Browse files Browse the repository at this point in the history
Without IgnorePointer, because the live indicator is on top of the events it won't allow to press the events.
  • Loading branch information
MartimTSilva authored and apurva010 committed May 8, 2024
1 parent 6d7b219 commit ec6bed1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 28 deletions.
54 changes: 29 additions & 25 deletions lib/src/week_view/_internal_week_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import '../event_controller.dart';
import '../modals.dart';
import '../painters.dart';
import '../typedefs.dart';
import '../constants.dart';

/// A single page for week view.
class InternalWeekViewPage<T extends Object?> extends StatelessWidget {
Expand Down Expand Up @@ -143,7 +142,7 @@ class InternalWeekViewPage<T extends Object?> extends StatelessWidget {
final double emulateVerticalOffsetBy;

/// Title of the full day events row
final String? fullDayHeaderTitle;
final String fullDayHeaderTitle;

/// A single page for week view.
const InternalWeekViewPage({
Expand Down Expand Up @@ -187,7 +186,7 @@ class InternalWeekViewPage<T extends Object?> extends StatelessWidget {
required this.showQuarterHours,
required this.emulateVerticalOffsetBy,
required this.onTileDoubleTap,
this.fullDayHeaderTitle,
this.fullDayHeaderTitle = '',
}) : super(key: key);

@override
Expand Down Expand Up @@ -233,36 +232,39 @@ class InternalWeekViewPage<T extends Object?> extends StatelessWidget {
child: Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(color: hourIndicatorSettings.color, width: 2),
bottom:
BorderSide(color: hourIndicatorSettings.color, width: 2),
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: timeLineWidth + hourIndicatorSettings.offset,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 1),
child: Text(
fullDayHeaderTitle ?? "",
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
padding: const EdgeInsets.symmetric(
vertical: 2,
horizontal: 1,
),
child: Text(
fullDayHeaderTitle,
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
...List.generate(
filteredDates.length,
(index) {
final fullDayEventList = controller.getFullDayEvent(filteredDates[index]);
(index) {
final fullDayEventList =
controller.getFullDayEvent(filteredDates[index]);
return Container(
width: weekTitleWidth,
child: fullDayEventList.isEmpty
? null
: fullDayEventBuilder.call(
fullDayEventList,
dates[index],
),
fullDayEventList,
dates[index],
),
);
},
)
Expand Down Expand Up @@ -388,13 +390,15 @@ class InternalWeekViewPage<T extends Object?> extends StatelessWidget {
liveTimeIndicatorSettings: liveTimeIndicatorSettings,
),
if (showLiveLine && liveTimeIndicatorSettings.height > 0)
LiveTimeIndicator(
liveTimeIndicatorSettings: liveTimeIndicatorSettings,
width: width,
height: height,
heightPerMinute: heightPerMinute,
timeLineWidth: timeLineWidth,
startHour: startHour,
IgnorePointer(
child: LiveTimeIndicator(
liveTimeIndicatorSettings: liveTimeIndicatorSettings,
width: width,
height: height,
heightPerMinute: heightPerMinute,
timeLineWidth: timeLineWidth,
startHour: startHour,
),
),
],
),
Expand Down
6 changes: 3 additions & 3 deletions lib/src/week_view/week_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class WeekView<T extends Object?> extends StatefulWidget {
final ScrollPhysics? pageViewPhysics;

/// Title of the full day events row
final String? fullDayHeaderTitle;
final String fullDayHeaderTitle;

/// Main widget for week view.
const WeekView({
Expand Down Expand Up @@ -285,7 +285,7 @@ class WeekView<T extends Object?> extends StatefulWidget {
this.showWeekDayAtBottom = false,
this.pageViewPhysics,
this.onEventDoubleTap,
this.fullDayHeaderTitle,
this.fullDayHeaderTitle = '',
}) : assert(!(onHeaderTitleTap != null && weekPageHeaderBuilder != null),
"can't use [onHeaderTitleTap] & [weekPageHeaderBuilder] simultaneously"),
assert((timeLineOffset) >= 0,
Expand Down Expand Up @@ -319,7 +319,7 @@ class WeekViewState<T extends Object?> extends State<WeekView<T>> {
late DateTime _currentWeek;
late int _totalWeeks;
late int _currentIndex;
late String? _fullDayHeaderTitle;
late String _fullDayHeaderTitle;

late EventArranger<T> _eventArranger;

Expand Down

0 comments on commit ec6bed1

Please sign in to comment.