From 624220090572eb643dce37ca8ffd85d2b3f5c9df Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Wed, 24 Jan 2024 12:29:35 +0600 Subject: [PATCH] feat: haptic feedback on long press and reordering actions --- lib/components/player/player_queue.dart | 6 ++++++ .../shared/tracks_view/sections/body/track_view_body.dart | 2 ++ 2 files changed, 8 insertions(+) diff --git a/lib/components/player/player_queue.dart b/lib/components/player/player_queue.dart index 8142740c..2784fb5f 100644 --- a/lib/components/player/player_queue.dart +++ b/lib/components/player/player_queue.dart @@ -210,6 +210,12 @@ class PlayerQueue extends HookConsumerWidget { itemCount: tracks.length, shrinkWrap: true, buildDefaultDragHandles: false, + onReorderStart: (index) { + HapticFeedback.selectionClick(); + }, + onReorderEnd: (index) { + HapticFeedback.selectionClick(); + }, itemBuilder: (context, i) { final track = tracks.elementAt(i); return AutoScrollTag( diff --git a/lib/components/shared/tracks_view/sections/body/track_view_body.dart b/lib/components/shared/tracks_view/sections/body/track_view_body.dart index b7149cc2..33c8fa82 100644 --- a/lib/components/shared/tracks_view/sections/body/track_view_body.dart +++ b/lib/components/shared/tracks_view/sections/body/track_view_body.dart @@ -1,5 +1,6 @@ import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:fuzzywuzzy/fuzzywuzzy.dart'; import 'package:gap/gap.dart'; @@ -116,6 +117,7 @@ class TrackViewBodySection extends HookConsumerWidget { }, onLongPress: () { trackViewState.selectTrack(track.id!); + HapticFeedback.selectionClick(); }, onTap: () async { if (trackViewState.isSelecting) {