Files
SpotiFLAC-Mobile/lib/widgets/swipe_commit_haptic.dart
zarzet b2851b6196 feat(motion): collapse removed queue rows and tick at swipe thresholds
Swiping a song out of Up Next removed it mid-slide, so the rows below
jumped in one frame. The row now collapses over 200 ms before the queue
drops it. Dismissible still only hears false, so a row the queue keeps
(it became the playing song, or a remote queue answers late) slides and
grows back, and the removal still resolves the song by identity.
Reduced motion removes at once.

Queue, download and player title swipes give one medium haptic tick
each time they cross the point where letting go would commit, also
under reduced motion.
2026-11-07 20:14:26 +07:00

17 lines
492 B
Dart

import 'package:flutter/services.dart';
/// Gives one haptic tick each time a swipe crosses the point where letting
/// go would commit, and none while it stays on either side.
///
/// Haptics stay on under reduced motion: they replace motion rather than
/// add to it.
class SwipeCommitHaptic {
bool _armed = false;
/// Reports whether releasing now would commit the swipe.
void update(bool armed) {
if (armed && !_armed) HapticFeedback.mediumImpact();
_armed = armed;
}
}