diff --git a/lib/presentation/views/main_menu/match_view/create_match/choose_group_view.dart b/lib/presentation/views/main_menu/match_view/create_match/choose_group_view.dart index 1caa101..2ef8b68 100644 --- a/lib/presentation/views/main_menu/match_view/create_match/choose_group_view.dart +++ b/lib/presentation/views/main_menu/match_view/create_match/choose_group_view.dart @@ -112,7 +112,10 @@ class _ChooseGroupViewState extends State { padding: const EdgeInsets.only(bottom: 85), itemCount: filteredGroups.length, itemBuilder: (BuildContext context, int index) { - return GestureDetector( + return GroupTile( + group: filteredGroups[index], + isHighlighted: + selectedGroupId == filteredGroups[index].id, onTap: () { setState(() { if (selectedGroupId != filteredGroups[index].id) { @@ -122,11 +125,6 @@ class _ChooseGroupViewState extends State { } }); }, - child: GroupTile( - group: filteredGroups[index], - isHighlighted: - selectedGroupId == filteredGroups[index].id, - ), ); }, ), diff --git a/lib/presentation/views/main_menu/match_view/create_match/create_game_view.dart b/lib/presentation/views/main_menu/match_view/create_match/create_game_view.dart index 4b4a977..998f4e1 100644 --- a/lib/presentation/views/main_menu/match_view/create_match/create_game_view.dart +++ b/lib/presentation/views/main_menu/match_view/create_match/create_game_view.dart @@ -1,6 +1,7 @@ import 'dart:math'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_popup/flutter_popup.dart'; import 'package:provider/provider.dart'; import 'package:tallee/core/common.dart'; @@ -330,6 +331,12 @@ class _CreateGameViewState extends State { contentPadding: const EdgeInsets.symmetric(horizontal: 0, vertical: 10), barrierColor: Colors.transparent, contentDecoration: CustomTheme.standardBoxDecoration, + onBeforePopup: () async { + await HapticFeedback.selectionClick(); + }, + onAfterPopup: () async { + await HapticFeedback.selectionClick(); + }, content: StatefulBuilder( builder: (context, setPopupState) => SizedBox( width: 280, @@ -339,7 +346,8 @@ class _CreateGameViewState extends State { children: List.generate( _rulesets.length, (index) => GestureDetector( - onTap: () { + onTap: () async { + await HapticFeedback.selectionClick(); setState(() { selectedRuleset = _rulesets[index].$1; }); @@ -413,6 +421,12 @@ class _CreateGameViewState extends State { contentPadding: const EdgeInsets.symmetric(horizontal: 0, vertical: 10), barrierColor: Colors.transparent, contentDecoration: CustomTheme.standardBoxDecoration, + onBeforePopup: () async { + await HapticFeedback.selectionClick(); + }, + onAfterPopup: () async { + await HapticFeedback.selectionClick(); + }, content: StatefulBuilder( builder: (context, setPopupState) => SizedBox( width: 150, @@ -422,7 +436,8 @@ class _CreateGameViewState extends State { children: List.generate( _colors.length, (index) => GestureDetector( - onTap: () { + onTap: () async { + await HapticFeedback.selectionClick(); setState(() { selectedColor = _colors[index].$1; }); diff --git a/lib/presentation/views/main_menu/match_view/create_match/create_match_view.dart b/lib/presentation/views/main_menu/match_view/create_match/create_match_view.dart index fd98691..85bb936 100644 --- a/lib/presentation/views/main_menu/match_view/create_match/create_match_view.dart +++ b/lib/presentation/views/main_menu/match_view/create_match/create_match_view.dart @@ -172,7 +172,6 @@ class _CreateMatchViewState extends State { ) ?? false, ); - selectedGroup = await Navigator.of(context).push( adaptivePageRoute( builder: (context) => ChooseGroupView( diff --git a/lib/presentation/widgets/tiles/choose_tile.dart b/lib/presentation/widgets/tiles/choose_tile.dart index f69aefc..39c3631 100644 --- a/lib/presentation/widgets/tiles/choose_tile.dart +++ b/lib/presentation/widgets/tiles/choose_tile.dart @@ -31,12 +31,14 @@ class _ChooseTileState extends State { @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), diff --git a/lib/presentation/widgets/tiles/game_tile.dart b/lib/presentation/widgets/tiles/game_tile.dart index 1d494b9..80881d0 100644 --- a/lib/presentation/widgets/tiles/game_tile.dart +++ b/lib/presentation/widgets/tiles/game_tile.dart @@ -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 diff --git a/lib/presentation/widgets/tiles/group_tile.dart b/lib/presentation/widgets/tiles/group_tile.dart index 9ce5a6b..f6c406e 100644 --- a/lib/presentation/widgets/tiles/group_tile.dart +++ b/lib/presentation/widgets/tiles/group_tile.dart @@ -36,7 +36,9 @@ class _GroupTileState extends State { return GestureDetector( onTap: () async { await HapticFeedback.selectionClick(); - widget.onTap?.call(); + if (widget.onTap != null) { + widget.onTap!.call(); + } }, child: AnimatedContainer( margin: CustomTheme.standardMargin,