#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 ### Changed
- long press actions trigger haptic feedback according to OS settings
- target Android 14 (API 34) - target Android 14 (API 34)
- upgraded Flutter to stable v3.13.9 - upgraded Flutter to stable v3.13.9

View file

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

View file

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

View file

@ -247,11 +247,11 @@ class _AvesFilterChipState extends State<AvesFilterChip> {
} }
: null; : null;
final onLongPress = widget.onLongPress != null final onLongPress = widget.onLongPress != null
? () { ? Feedback.wrapForLongPress(() {
if (_tapPosition != null) { if (_tapPosition != null) {
widget.onLongPress?.call(context, filter, _tapPosition!); widget.onLongPress?.call(context, filter, _tapPosition!);
} }
} }, context)
: null; : null;
Widget? content; 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, // marker tap handling prevents the default handling of focal zoom on double tap,
// so we reimplement the double tap gesture here // so we reimplement the double tap gesture here
onDoubleTap: interactive ? () => _zoomBy(1, focalPoint: latLng) : null, 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), child: widget.markerWidgetBuilder(markerKey),
), ),
width: markerSize.width, width: markerSize.width,