feat: add haptic feedback to even more user interactions
This commit is contained in:
@@ -31,12 +31,14 @@ class _ChooseTileState extends State<ChooseTile> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
await HapticFeedback.vibrate();
|
||||
if (widget.onPressed != null) {
|
||||
widget.onPressed!.call();
|
||||
}
|
||||
},
|
||||
onTap: widget.onPressed != null
|
||||
? () async {
|
||||
await HapticFeedback.selectionClick();
|
||||
if (widget.onPressed != null) {
|
||||
widget.onPressed!.call();
|
||||
}
|
||||
}
|
||||
: null,
|
||||
child: Container(
|
||||
margin: CustomTheme.tileMargin,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:tallee/core/common.dart';
|
||||
import 'package:tallee/core/custom_theme.dart';
|
||||
import 'package:tallee/core/enums.dart';
|
||||
@@ -53,8 +54,18 @@ class GameTile extends StatelessWidget {
|
||||
final gameColor = badgeColor ?? getColorFromGameColor(GameColor.orange);
|
||||
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
onLongPress: onLongPress,
|
||||
onTap: () async {
|
||||
await HapticFeedback.selectionClick();
|
||||
if (onTap != null) {
|
||||
onTap!.call();
|
||||
}
|
||||
},
|
||||
onLongPress: () async {
|
||||
await HapticFeedback.vibrate();
|
||||
if (onLongPress != null) {
|
||||
onLongPress!.call();
|
||||
}
|
||||
},
|
||||
child: AnimatedContainer(
|
||||
margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
||||
decoration: !isHighlighted
|
||||
|
||||
@@ -36,7 +36,9 @@ class _GroupTileState extends State<GroupTile> {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
await HapticFeedback.selectionClick();
|
||||
widget.onTap?.call();
|
||||
if (widget.onTap != null) {
|
||||
widget.onTap!.call();
|
||||
}
|
||||
},
|
||||
child: AnimatedContainer(
|
||||
margin: CustomTheme.standardMargin,
|
||||
|
||||
Reference in New Issue
Block a user