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 == bool doneLoading =
ConnectionState.done && snapshot.connectionState ==
(!snapshot.hasData || ConnectionState.done;
snapshot.data!.isEmpty || bool snapshotDataEmpty =
(selectedPlayers.isEmpty && !snapshot.hasData || snapshot.data!.isEmpty;
allPlayers.isEmpty))) { if (doneLoading &&
(snapshotDataEmpty && allPlayers.isEmpty)) {
return const Center( return const Center(
child: TopCenteredMessage( child: TopCenteredMessage(
icon: Icons.info, icon: Icons.info,