Commit 9ada90a1 authored by Chris Bracken's avatar Chris Bracken Committed by GitHub

Suppress TimePicker haptic feedback on iOS (#8347)

State changes are expected to trigger haptic feedback on Android, but
not on iOS time pickers.
parent 5e93756f
...@@ -645,8 +645,19 @@ class _TimePickerDialogState extends State<_TimePickerDialog> { ...@@ -645,8 +645,19 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
_TimePickerMode _mode = _TimePickerMode.hour; _TimePickerMode _mode = _TimePickerMode.hour;
TimeOfDay _selectedTime; TimeOfDay _selectedTime;
void _vibrate() {
switch (Theme.of(context).platform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
HapticFeedback.vibrate();
break;
case TargetPlatform.iOS:
break;
}
}
void _handleModeChanged(_TimePickerMode mode) { void _handleModeChanged(_TimePickerMode mode) {
HapticFeedback.vibrate(); _vibrate();
setState(() { setState(() {
_mode = mode; _mode = mode;
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment