feat: add haptic feedback to more user interactions
This commit is contained in:
@@ -135,9 +135,13 @@ class _CreateGroupViewState extends State<CreateGroupView> {
|
||||
|
||||
if (success) {
|
||||
await HapticFeedback.successNotification();
|
||||
Navigator.pop(context, updatedGroup);
|
||||
if (mounted) {
|
||||
Navigator.pop(context, updatedGroup);
|
||||
}
|
||||
} else {
|
||||
await HapticFeedback.errorNotification();
|
||||
if (mounted) {
|
||||
await HapticFeedback.errorNotification();
|
||||
}
|
||||
showSnackbar(
|
||||
message: widget.groupToEdit == null
|
||||
? loc.error_creating_group
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tallee/core/adaptive_page_route.dart';
|
||||
@@ -13,6 +12,7 @@ import 'package:tallee/data/models/player.dart';
|
||||
import 'package:tallee/l10n/generated/app_localizations.dart';
|
||||
import 'package:tallee/presentation/views/main_menu/group_view/create_group_view.dart';
|
||||
import 'package:tallee/presentation/widgets/app_skeleton.dart';
|
||||
import 'package:tallee/presentation/widgets/buttons/haptic_icon_button.dart';
|
||||
import 'package:tallee/presentation/widgets/buttons/main_menu_button.dart';
|
||||
import 'package:tallee/presentation/widgets/colored_icon_container.dart';
|
||||
import 'package:tallee/presentation/widgets/dialog/custom_alert_dialog.dart';
|
||||
@@ -66,10 +66,9 @@ class _GroupDetailViewState extends State<GroupDetailView> {
|
||||
appBar: AppBar(
|
||||
title: Text(loc.group_profile),
|
||||
actions: [
|
||||
IconButton(
|
||||
HapticIconButton(
|
||||
icon: const Icon(Icons.delete),
|
||||
onPressed: () async {
|
||||
await HapticFeedback.selectionClick();
|
||||
showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => CustomAlertDialog(
|
||||
@@ -77,17 +76,11 @@ class _GroupDetailViewState extends State<GroupDetailView> {
|
||||
content: Text(loc.this_cannot_be_undone),
|
||||
actions: [
|
||||
CustomDialogAction(
|
||||
onPressed: () async {
|
||||
await HapticFeedback.warningNotification();
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
text: loc.delete,
|
||||
),
|
||||
CustomDialogAction(
|
||||
onPressed: () async {
|
||||
await HapticFeedback.selectionClick();
|
||||
Navigator.of(context).pop(false);
|
||||
},
|
||||
onPressed: () => Navigator.of(context).pop(false),
|
||||
buttonType: ButtonType.secondary,
|
||||
text: loc.cancel,
|
||||
),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tallee/core/adaptive_page_route.dart';
|
||||
import 'package:tallee/core/constants.dart';
|
||||
@@ -103,7 +102,6 @@ class _GroupViewState extends State<GroupView> {
|
||||
text: loc.create_group,
|
||||
icon: Icons.group_add,
|
||||
onPressed: () async {
|
||||
await HapticFeedback.selectionClick();
|
||||
await Navigator.push(
|
||||
context,
|
||||
adaptivePageRoute(
|
||||
|
||||
Reference in New Issue
Block a user