refactor empty state logic in CreateGroupView
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 2m22s
Pull Request Pipeline / lint (pull_request) Successful in 2m24s

The diff introduces boolean variables `doneLoading` and `snapshotDataEmpty` to simplify the conditional check for displaying the empty state message. It specifically fixes the logic to correctly show the "No players found" message when both the snapshot and the local `allPlayers` list are empty, removing the dependency on `selectedPlayers.isEmpty`.
This commit is contained in:
2025-11-23 22:14:13 +01:00
parent 8307488f28
commit 974d6e9b56

View File

@@ -209,12 +209,13 @@ class _CreateGroupViewState extends State<CreateGroupView> {
),
);
}
if (snapshot.connectionState ==
ConnectionState.done &&
(!snapshot.hasData ||
snapshot.data!.isEmpty ||
(selectedPlayers.isEmpty &&
allPlayers.isEmpty))) {
bool doneLoading =
snapshot.connectionState ==
ConnectionState.done;
bool snapshotDataEmpty =
!snapshot.hasData || snapshot.data!.isEmpty;
if (doneLoading &&
(snapshotDataEmpty && allPlayers.isEmpty)) {
return const Center(
child: TopCenteredMessage(
icon: Icons.info,