From 0f6b6253de2b8ed7fa36fb719a5922d01b2d03f3 Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Sat, 17 Sep 2022 16:48:42 -0400 Subject: [PATCH] Reduced haptic feedback (consequential actions only) --- lib/components/generated_form_modal.dart | 3 +-- lib/pages/add_app.dart | 2 +- lib/pages/app.dart | 6 +++--- lib/pages/home.dart | 2 +- lib/pages/import_export.dart | 5 ++--- lib/pages/settings.dart | 1 - lib/providers/apps_provider.dart | 6 ++---- 7 files changed, 10 insertions(+), 15 deletions(-) diff --git a/lib/components/generated_form_modal.dart b/lib/components/generated_form_modal.dart index c45ea4b..e1644be 100644 --- a/lib/components/generated_form_modal.dart +++ b/lib/components/generated_form_modal.dart @@ -59,14 +59,13 @@ class _GeneratedFormModalState extends State { actions: [ TextButton( onPressed: () { - HapticFeedback.lightImpact(); Navigator.of(context).pop(null); }, child: const Text('Cancel')), TextButton( onPressed: () { if (_formKey.currentState?.validate() == true) { - HapticFeedback.heavyImpact(); + HapticFeedback.selectionClick(); Navigator.of(context).pop(formInputs .map((e) => (e[0] as TextEditingController).value.text) .toList()); diff --git a/lib/pages/add_app.dart b/lib/pages/add_app.dart index 8151acc..72a086a 100644 --- a/lib/pages/add_app.dart +++ b/lib/pages/add_app.dart @@ -60,7 +60,7 @@ class _AddAppPageState extends State { onPressed: gettingAppInfo ? null : () { - HapticFeedback.mediumImpact(); + HapticFeedback.selectionClick(); if (_formKey.currentState!.validate()) { setState(() { gettingAppInfo = true; diff --git a/lib/pages/app.dart b/lib/pages/app.dart index 40e6c18..a00c487 100644 --- a/lib/pages/app.dart +++ b/lib/pages/app.dart @@ -111,6 +111,7 @@ class _AppPageState extends State { child: const Text('No')), TextButton( onPressed: () { + HapticFeedback.selectionClick(); var updatedApp = app?.app; if (updatedApp != null) { updatedApp.installedVersion = @@ -157,7 +158,6 @@ class _AppPageState extends State { onPressed: app?.downloadProgress != null ? null : () { - HapticFeedback.lightImpact(); showDialog( context: context, builder: (BuildContext ctx) { @@ -168,7 +168,8 @@ class _AppPageState extends State { actions: [ TextButton( onPressed: () { - HapticFeedback.heavyImpact(); + HapticFeedback + .selectionClick(); appsProvider .removeApp(app!.app.id) .then((_) { @@ -181,7 +182,6 @@ class _AppPageState extends State { child: const Text('Remove')), TextButton( onPressed: () { - HapticFeedback.lightImpact(); Navigator.of(context).pop(); }, child: const Text('Cancel')) diff --git a/lib/pages/home.dart b/lib/pages/home.dart index 1b48f39..ce3a096 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -45,7 +45,7 @@ class _HomePageState extends State { NavigationDestination(icon: Icon(e.icon), label: e.title)) .toList(), onDestinationSelected: (int index) { - HapticFeedback.lightImpact(); + HapticFeedback.selectionClick(); setState(() { if (index == 0) { selectedIndexHistory.clear(); diff --git a/lib/pages/import_export.dart b/lib/pages/import_export.dart index 5b2b6d5..b1f8e49 100644 --- a/lib/pages/import_export.dart +++ b/lib/pages/import_export.dart @@ -57,7 +57,7 @@ class _ImportExportPageState extends State { onPressed: appsProvider.apps.isEmpty || importInProgress ? null : () { - HapticFeedback.lightImpact(); + HapticFeedback.selectionClick(); appsProvider.exportApps().then((String path) { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Exported to $path')), @@ -72,7 +72,7 @@ class _ImportExportPageState extends State { onPressed: importInProgress ? null : () { - HapticFeedback.lightImpact(); + HapticFeedback.selectionClick(); FilePicker.platform.pickFiles().then((result) { setState(() { importInProgress = true; @@ -291,7 +291,6 @@ class _ImportErrorDialogState extends State { actions: [ TextButton( onPressed: () { - HapticFeedback.lightImpact(); Navigator.of(context).pop(null); }, child: const Text('Okay')) diff --git a/lib/pages/settings.dart b/lib/pages/settings.dart index 817432e..d840134 100644 --- a/lib/pages/settings.dart +++ b/lib/pages/settings.dart @@ -192,7 +192,6 @@ class _SettingsPageState extends State { }), ), onPressed: () { - HapticFeedback.lightImpact(); launchUrlString(settingsProvider.sourceUrl, mode: LaunchMode.externalApplication); }, diff --git a/lib/providers/apps_provider.dart b/lib/providers/apps_provider.dart index e92dfa4..638e3ee 100644 --- a/lib/providers/apps_provider.dart +++ b/lib/providers/apps_provider.dart @@ -339,13 +339,12 @@ class _APKPickerState extends State { actions: [ TextButton( onPressed: () { - HapticFeedback.lightImpact(); Navigator.of(context).pop(null); }, child: const Text('Cancel')), TextButton( onPressed: () { - HapticFeedback.heavyImpact(); + HapticFeedback.selectionClick(); Navigator.of(context).pop(apkUrl); }, child: const Text('Continue')) @@ -376,13 +375,12 @@ class _APKOriginWarningDialogState extends State { actions: [ TextButton( onPressed: () { - HapticFeedback.lightImpact(); Navigator.of(context).pop(null); }, child: const Text('Cancel')), TextButton( onPressed: () { - HapticFeedback.heavyImpact(); + HapticFeedback.selectionClick(); Navigator.of(context).pop(true); }, child: const Text('Continue'))