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 ==
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user