From 021a5464798a959dc3ed30c442855c0c068b3b84 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Thu, 21 May 2026 18:28:11 +0200 Subject: [PATCH] Updated stacks & buttons --- .../group_view/create_group_view.dart | 31 ++--- .../create_match/create_match_view.dart | 26 +++-- .../create_teams/create_teams_view.dart | 56 ++++----- .../create_teams/manage_members_view.dart | 107 +++++++++--------- 4 files changed, 113 insertions(+), 107 deletions(-) diff --git a/lib/presentation/views/main_menu/group_view/create_group_view.dart b/lib/presentation/views/main_menu/group_view/create_group_view.dart index 84efbe1..96092ca 100644 --- a/lib/presentation/views/main_menu/group_view/create_group_view.dart +++ b/lib/presentation/views/main_menu/group_view/create_group_view.dart @@ -8,7 +8,7 @@ import 'package:tallee/data/db/database.dart'; import 'package:tallee/data/models/group.dart'; import 'package:tallee/data/models/player.dart'; import 'package:tallee/l10n/generated/app_localizations.dart'; -import 'package:tallee/presentation/widgets/buttons/custom_width_button.dart'; +import 'package:tallee/presentation/widgets/buttons/animated_dialog_button.dart'; import 'package:tallee/presentation/widgets/player_selection.dart'; import 'package:tallee/presentation/widgets/text_input/text_input_field.dart'; @@ -96,19 +96,24 @@ class _CreateGroupViewState extends State { }, ), ), - CustomWidthButton( - text: widget.groupToEdit == null - ? loc.create_group - : loc.edit_group, - sizeRelativeToWidth: 0.95, - buttonType: ButtonType.primary, - onPressed: - (_groupNameController.text.isEmpty || - (selectedPlayers.length < 2)) - ? null - : _saveGroup, + Padding( + padding: const EdgeInsets.symmetric(horizontal: 12), + child: AnimatedDialogButton( + buttonConstraints: const BoxConstraints( + minWidth: double.infinity, + minHeight: 50, + ), + buttonText: widget.groupToEdit == null + ? loc.create_group + : loc.edit_group, + buttonType: ButtonType.primary, + onPressed: + (_groupNameController.text.isEmpty || + (selectedPlayers.length < 2)) + ? null + : _saveGroup, + ), ), - const SizedBox(height: 20), ], ), ), 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 fd14508..7fd9fa0 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 @@ -14,7 +14,7 @@ import 'package:tallee/presentation/views/main_menu/match_view/create_match/choo import 'package:tallee/presentation/views/main_menu/match_view/create_match/choose_group_view.dart'; import 'package:tallee/presentation/views/main_menu/match_view/create_match/create_teams/create_teams_view.dart'; import 'package:tallee/presentation/views/main_menu/match_view/match_result_view.dart'; -import 'package:tallee/presentation/widgets/buttons/custom_width_button.dart'; +import 'package:tallee/presentation/widgets/buttons/animated_dialog_button.dart'; import 'package:tallee/presentation/widgets/player_selection.dart'; import 'package:tallee/presentation/widgets/text_input/text_input_field.dart'; import 'package:tallee/presentation/widgets/tiles/choose_tile.dart'; @@ -175,15 +175,21 @@ class _CreateMatchViewState extends State { ), // Create or save button. - CustomWidthButton( - text: buttonText, - sizeRelativeToWidth: 0.95, - buttonType: ButtonType.primary, - onPressed: isSubmitButtonEnabled() - ? () { - submitButtonNavigation(context); - } - : null, + Padding( + padding: const EdgeInsets.symmetric(horizontal: 12), + child: AnimatedDialogButton( + buttonConstraints: const BoxConstraints( + minWidth: double.infinity, + minHeight: 50, + ), + buttonType: ButtonType.primary, + onPressed: isSubmitButtonEnabled() + ? () { + submitButtonNavigation(context); + } + : null, + buttonText: buttonText, + ), ), ], ), diff --git a/lib/presentation/views/main_menu/match_view/create_match/create_teams/create_teams_view.dart b/lib/presentation/views/main_menu/match_view/create_match/create_teams/create_teams_view.dart index a8f3899..31ed6d6 100644 --- a/lib/presentation/views/main_menu/match_view/create_match/create_teams/create_teams_view.dart +++ b/lib/presentation/views/main_menu/match_view/create_match/create_teams/create_teams_view.dart @@ -56,33 +56,33 @@ class _CreateTeamsViewState extends State { return Scaffold( backgroundColor: CustomTheme.backgroundColor, appBar: AppBar(title: Text(loc.create_teams)), - body: SafeArea( - child: Column( - children: [ - Expanded( - child: ListView.builder( - padding: const EdgeInsets.only(top: 12, bottom: 12), - itemCount: teams.length, - itemBuilder: (context, index) { - return TeamCreationTile( - color: teams[index].color, - controller: nameController[index], - hintText: '${loc.team} ${index + 1}', - onDelete: teams.length <= 2 - ? null - : () => removeTeam(index), - onColorSelection: (color) { - setState(() { - teams[index] = teams[index].copyWith(color: color); - }); - }, - ); - }, - ), + body: Stack( + alignment: Alignment.center, + children: [ + Expanded( + child: ListView.builder( + padding: const EdgeInsets.only(top: 12, bottom: 12), + itemCount: teams.length, + itemBuilder: (context, index) { + return TeamCreationTile( + color: teams[index].color, + controller: nameController[index], + hintText: '${loc.team} ${index + 1}', + onDelete: teams.length <= 2 ? null : () => removeTeam(index), + onColorSelection: (color) { + setState(() { + teams[index] = teams[index].copyWith(color: color); + }); + }, + ); + }, ), + ), - // Button row - Row( + // Button row + Positioned( + bottom: MediaQuery.paddingOf(context).bottom + 20, + child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ // Add new team @@ -95,7 +95,7 @@ class _CreateTeamsViewState extends State { ), const SizedBox(width: 15), - // Confirm teams and continue with member assignment + // Confirm teams MainMenuButton( icon: Icons.arrow_forward_sharp, onPressed: teams.length >= 2 @@ -115,8 +115,8 @@ class _CreateTeamsViewState extends State { ), ], ), - ], - ), + ), + ], ), ); } diff --git a/lib/presentation/views/main_menu/match_view/create_match/create_teams/manage_members_view.dart b/lib/presentation/views/main_menu/match_view/create_match/create_teams/manage_members_view.dart index 1192b04..a668f33 100644 --- a/lib/presentation/views/main_menu/match_view/create_match/create_teams/manage_members_view.dart +++ b/lib/presentation/views/main_menu/match_view/create_match/create_teams/manage_members_view.dart @@ -52,67 +52,62 @@ class _ManageMembersViewState extends State { return Scaffold( backgroundColor: CustomTheme.backgroundColor, appBar: AppBar(title: Text(loc.manage_members)), - body: SafeArea( - child: Stack( - children: [ - Expanded( - child: ReorderableListView.builder( - padding: const EdgeInsets.symmetric(vertical: 12), - buildDefaultDragHandles: false, - itemCount: allItemsCount, - onReorder: onReorder, - proxyDecorator: (child, index, animation) => - Material(type: MaterialType.transparency, child: child), - itemBuilder: (context, index) { - final teamIndex = teamIndexForFlat(index); - final memberIndex = memberIndexForFlat(index, teamIndex); - final team = teams[teamIndex]; + body: Stack( + alignment: AlignmentDirectional.center, + children: [ + Expanded( + child: ReorderableListView.builder( + padding: const EdgeInsets.symmetric(vertical: 12), + buildDefaultDragHandles: false, + itemCount: allItemsCount, + onReorder: onReorder, + proxyDecorator: (child, index, animation) => + Material(type: MaterialType.transparency, child: child), + itemBuilder: (context, index) { + final teamIndex = teamIndexForFlat(index); + final memberIndex = memberIndexForFlat(index, teamIndex); + final team = teams[teamIndex]; - if (memberIndex == -1) { - return buildTeamTile(team: team); - } + if (memberIndex == -1) { + return buildTeamTile(team: team); + } - final player = team.members[memberIndex]; - return ReorderableDelayedDragStartListener( - key: ValueKey('player_${player.id}'), - index: index, - child: TextIconListTile( - text: player.name, - suffixText: getNameCountText(player), - icon: Icons.drag_handle, - ), - ); - }, - ), + final player = team.members[memberIndex]; + return ReorderableDelayedDragStartListener( + key: ValueKey('player_${player.id}'), + index: index, + child: TextIconListTile( + text: player.name, + suffixText: getNameCountText(player), + icon: Icons.drag_handle, + ), + ); + }, ), - Positioned( - bottom: MediaQuery.of(context).padding.bottom, - left: 0, - right: 0, - child: Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - MainMenuButton( - onPressed: () => setState(() { - redistributePlayers(); - }), - icon: Icons.cached, - ), - const SizedBox(width: 16), - MainMenuButton( - onPressed: allTeamsHaveMembers - ? () async => submitMatch() - : null, - text: loc.create_match, - icon: RpgAwesome.clovers_card, - ), - ], + ), + Positioned( + bottom: MediaQuery.of(context).padding.bottom + 20, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + MainMenuButton( + onPressed: () => setState(() { + redistributePlayers(); + }), + icon: Icons.cached, ), - ), + const SizedBox(width: 16), + MainMenuButton( + onPressed: allTeamsHaveMembers + ? () async => submitMatch() + : null, + text: loc.create_match, + icon: RpgAwesome.clovers_card, + ), + ], ), - ], - ), + ), + ], ), ); }