Skip to content

Commit fcc41ee

Browse files
🐛 Fix infinite scroll in WaveformType.long
1 parent 5dba64e commit fcc41ee

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

lib/src/audio_file_waveforms.dart

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ class _AudioFileWaveformsState extends State<AudioFileWaveforms>
192192
child: GestureDetector(
193193
onHorizontalDragUpdate:
194194
widget.enableSeekGesture ? _handleDragGestures : null,
195-
onTapUp: widget.enableSeekGesture ? _handTapGestures : null,
195+
onTapUp: widget.enableSeekGesture ? _handleScrubberSeekStart : null,
196+
onHorizontalDragStart:
197+
widget.enableSeekGesture ? _handleHorizontalDragStart : null,
196198
onHorizontalDragEnd:
197199
widget.enableSeekGesture ? (_) => _handleOnDragEnd() : null,
198200
child: ClipPath(
@@ -280,17 +282,6 @@ class _AudioFileWaveformsState extends State<AudioFileWaveforms>
280282
}
281283
}
282284

283-
void _handTapGestures(TapUpDetails details) {
284-
switch (widget.waveformType) {
285-
case WaveformType.fitWidth:
286-
_handleScrubberSeekStart(details);
287-
break;
288-
case WaveformType.long:
289-
_handleHorizontalDragStart(details);
290-
break;
291-
}
292-
}
293-
294285
/// This method handles continues seek gesture
295286
void _handleScrubberSeekUpdate(DragUpdateDetails details) {
296287
_proportion = details.localPosition.dx / widget.size.width;
@@ -353,9 +344,8 @@ class _AudioFileWaveformsState extends State<AudioFileWaveforms>
353344
}
354345

355346
///This will help-out to determine direction of the scroll
356-
void _handleHorizontalDragStart(TapUpDetails details) {
357-
_initialDragPosition = details.localPosition.dx;
358-
}
347+
void _handleHorizontalDragStart(DragStartDetails details) =>
348+
_initialDragPosition = details.localPosition.dx;
359349

360350
/// This initialises variable in [initState] so that everytime current duration
361351
/// gets updated it doesn't re assign them to same values.

0 commit comments

Comments
 (0)