@@ -147,6 +147,9 @@ class TimeLine extends StatefulWidget {
147147 /// This will display time string in timeline.
148148 final DateWidgetBuilder timeLineBuilder;
149149
150+ /// This method will be called when user taps on timestamp in timeline.
151+ final TimestampCallback ? onTimestampTap;
152+
150153 /// Flag to display half hours.
151154 final bool showHalfHours;
152155
@@ -175,6 +178,7 @@ class TimeLine extends StatefulWidget {
175178 required this .height,
176179 required this .timeLineOffset,
177180 required this .timeLineBuilder,
181+ required this .onTimestampTap,
178182 this .startHour = 0 ,
179183 this .showHalfHours = false ,
180184 this .showQuarterHours = false ,
@@ -287,6 +291,14 @@ class _TimeLineState extends State<TimeLine> {
287291 required int hour,
288292 int minutes = 0 ,
289293 }) {
294+ final dateTime = DateTime (
295+ TimeLine ._date.year,
296+ TimeLine ._date.month,
297+ TimeLine ._date.day,
298+ hour,
299+ minutes,
300+ );
301+
290302 return Visibility (
291303 visible: ! ((_currentTime.minute >= 45 && _currentTime.hour == hour - 1 ) ||
292304 (_currentTime.minute <= 15 && _currentTime.hour == hour)) ||
@@ -300,14 +312,13 @@ class _TimeLineState extends State<TimeLine> {
300312 child: Container (
301313 height: widget.hourHeight,
302314 width: widget.timeLineWidth,
303- child: widget.timeLineBuilder.call (
304- DateTime (
305- TimeLine ._date.year,
306- TimeLine ._date.month,
307- TimeLine ._date.day,
308- hour,
309- minutes,
310- ),
315+ child: InkWell (
316+ onTap: () {
317+ if (widget.onTimestampTap != null ) {
318+ widget.onTimestampTap !(dateTime);
319+ }
320+ },
321+ child: widget.timeLineBuilder.call (dateTime),
311322 ),
312323 ),
313324 ),
0 commit comments