Fehlende Info in CreateGroupView #107
@@ -133,33 +133,42 @@ 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(
|
||||||
for (var player in selectedPlayers)
|
children: [
|
||||||
TextIconTile(
|
for (var player in selectedPlayers)
|
||||||
text: player.name,
|
Padding(
|
||||||
onIconTap: () {
|
padding: const EdgeInsets.only(right: 8.0),
|
||||||
setState(() {
|
child: TextIconTile(
|
||||||
// Removes the player from the selection and notifies the parent.
|
text: player.name,
|
||||||
final currentSearch = _searchBarController.text
|
onIconTap: () {
|
||||||
.toLowerCase();
|
setState(() {
|
||||||
selectedPlayers.remove(player);
|
// Removes the player from the selection and notifies the parent.
|
||||||
widget.onChanged([...selectedPlayers]);
|
final currentSearch = _searchBarController
|
||||||
// If the player matches the current search query (or search is empty),
|
.text
|
||||||
// they are added back to the suggestions and the list is re-sorted.
|
.toLowerCase();
|
||||||
if (currentSearch.isEmpty ||
|
selectedPlayers.remove(player);
|
||||||
player.name.toLowerCase().contains(currentSearch)) {
|
widget.onChanged([...selectedPlayers]);
|
||||||
suggestedPlayers.add(player);
|
// 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.
|
||||||
});
|
if (currentSearch.isEmpty ||
|
||||||
},
|
player.name.toLowerCase().contains(
|
||||||
),
|
currentSearch,
|
||||||
],
|
)) {
|
||||||
|
suggestedPlayers.add(player);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
const Text(
|
const Text(
|
||||||
|
|||||||
Reference in New Issue
Block a user