implemented a central haptic feedback system with configurable levels (off, reduced, full), added a Haptics facade providing semantic feedback methods, integrated haptic cues across navigation, settings toggles, and async action results, and updated version to 1.1.0+54
This commit is contained in:
@@ -7,6 +7,7 @@ library;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../api/errors/error_mapper.dart';
|
||||
import '../utils/haptics.dart';
|
||||
import 'app_progress_indicator.dart';
|
||||
import 'info_dialog.dart';
|
||||
|
||||
|
||||
@@ -13,8 +13,10 @@ Future<bool> runWithErrorDialog(
|
||||
}) async {
|
||||
try {
|
||||
await action();
|
||||
Haptics.success();
|
||||
return true;
|
||||
} catch (e) {
|
||||
Haptics.error();
|
||||
if (!context.mounted) return false;
|
||||
final message = errorBuilder != null
|
||||
? errorBuilder(e)
|
||||
|
||||
@@ -66,9 +66,11 @@ class _AsyncMixinState extends State<_AsyncMixin> {
|
||||
);
|
||||
if (!mounted) return;
|
||||
if (success) {
|
||||
Haptics.success();
|
||||
widget.onSuccess?.call();
|
||||
} else if (widget.onError != null && _controller.error != null) {
|
||||
widget.onError!(_controller.error!);
|
||||
} else if (_controller.error != null) {
|
||||
Haptics.error();
|
||||
widget.onError?.call(_controller.error!);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../utils/haptics.dart';
|
||||
import 'async_action_button.dart';
|
||||
|
||||
class ConfirmDialog extends StatelessWidget {
|
||||
@@ -53,6 +54,7 @@ class ConfirmDialog extends StatelessWidget {
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Haptics.confirm();
|
||||
Navigator.of(context).pop();
|
||||
onConfirm!();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user