refactor empty state logic in CreateGroupView
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:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user