#805 long press actions trigger haptic feedback according to OS settings

This commit is contained in:
Thibault Deckers 2023-11-04 19:18:07 +01:00
parent 49952b0622
commit 8537b52678
5 changed files with 7 additions and 5 deletions

View file

@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
### Changed
- long press actions trigger haptic feedback according to OS settings
- target Android 14 (API 34)
- upgraded Flutter to stable v3.13.9

View file

@ -40,7 +40,7 @@ class SectionHeader<T> extends StatelessWidget {
child: GestureDetector(
onTap: onTap,
onLongPress: selectable
? () {
? Feedback.wrapForLongPress(() {
final selection = context.read<Selection<T>>();
if (selection.isSelecting) {
_toggleSectionSelection(context);
@ -48,7 +48,7 @@ class SectionHeader<T> extends StatelessWidget {
selection.select();
selection.addToSelection(_getSectionEntries(context));
}
}
}, context)
: null,
child: Text.rich(
TextSpan(

View file

@ -98,6 +98,7 @@ class _GridSelectionGestureDetectorState<T> extends State<GridSelectionGestureDe
final fromItem = _getItemAt(details.localPosition);
if (fromItem == null) return;
Feedback.forLongPress(context);
final selection = context.read<Selection<T>>();
selection.toggleSelection(fromItem);
_selecting = selection.isSelected([fromItem]);

View file

@ -247,11 +247,11 @@ class _AvesFilterChipState extends State<AvesFilterChip> {
}
: null;
final onLongPress = widget.onLongPress != null
? () {
? Feedback.wrapForLongPress(() {
if (_tapPosition != null) {
widget.onLongPress?.call(context, filter, _tapPosition!);
}
}
}, context)
: null;
Widget? content;

View file

@ -137,7 +137,7 @@ class _EntryLeafletMapState<T> extends State<EntryLeafletMap<T>> with TickerProv
// marker tap handling prevents the default handling of focal zoom on double tap,
// so we reimplement the double tap gesture here
onDoubleTap: interactive ? () => _zoomBy(1, focalPoint: latLng) : null,
onLongPress: () => widget.onMarkerLongPress?.call(geoEntry, LatLng(geoEntry.latitude!, geoEntry.longitude!)),
onLongPress: Feedback.wrapForLongPress(() => widget.onMarkerLongPress?.call(geoEntry, LatLng(geoEntry.latitude!, geoEntry.longitude!)), context),
child: widget.markerWidgetBuilder(markerKey),
),
width: markerSize.width,