mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-11-21 20:00:49 +01:00
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.
17 lines
492 B
Dart
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;
|
|
}
|
|
}
|