Merge pull request 'Fehlende Info in CreateGroupView' (#107) from bug/73-Fehlende-Info-in-CreateGroupView into development

Reviewed-on: #107
Reviewed-by: Mathis Kirchner <mathis.kirchner.mk@gmail.com>
This commit was merged in pull request #107.
This commit is contained in:
2025-12-31 16:24:31 +00:00

View File

@@ -133,34 +133,43 @@ class _PlayerSelectionState extends State<PlayerSelection> {
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold), style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
Wrap( SizedBox(
alignment: WrapAlignment.start, height: 50,
crossAxisAlignment: WrapCrossAlignment.start, child: selectedPlayers.isEmpty
spacing: 8.0, ? const Center(child: Text('No players selected'))
runSpacing: 8.0, : SingleChildScrollView(
children: <Widget>[ scrollDirection: Axis.horizontal,
// Generates a TextIconTile for each selected player. child: Row(
children: [
for (var player in selectedPlayers) for (var player in selectedPlayers)
TextIconTile( Padding(
padding: const EdgeInsets.only(right: 8.0),
child: TextIconTile(
text: player.name, text: player.name,
onIconTap: () { onIconTap: () {
setState(() { setState(() {
// Removes the player from the selection and notifies the parent. // Removes the player from the selection and notifies the parent.
final currentSearch = _searchBarController.text final currentSearch = _searchBarController
.text
.toLowerCase(); .toLowerCase();
selectedPlayers.remove(player); selectedPlayers.remove(player);
widget.onChanged([...selectedPlayers]); widget.onChanged([...selectedPlayers]);
// If the player matches the current search query (or search is empty), // If the player matches the current search query (or search is empty),
// they are added back to the suggestions and the list is re-sorted. // they are added back to the suggestions and the list is re-sorted.
if (currentSearch.isEmpty || if (currentSearch.isEmpty ||
player.name.toLowerCase().contains(currentSearch)) { player.name.toLowerCase().contains(
currentSearch,
)) {
suggestedPlayers.add(player); suggestedPlayers.add(player);
} }
}); });
}, },
), ),
),
], ],
), ),
),
),
const SizedBox(height: 10), const SizedBox(height: 10),
const Text( const Text(
'All players:', 'All players:',