Skip to content

Commit d41afcd

Browse files
committed
Empty Query Widget ParseLiveList
1 parent 5fb9716 commit d41afcd

File tree

2 files changed

+18
-36
lines changed

2 files changed

+18
-36
lines changed

packages/flutter/lib/src/utils/parse_live_grid.dart

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,6 @@ class _ParseLiveGridWidgetState<T extends sdk.ParseObject>
102102
lazyLoading: lazyLoading,
103103
preloadedColumns: preloadedColumns,
104104
).then((sdk.ParseLiveList<T> value) {
105-
query.count().then((value) {
106-
if (value.count > 0) {
107-
setState(() {
108-
noData = false;
109-
});
110-
} else {
111-
setState(() {
112-
noData = true;
113-
});
114-
}
115-
});
116105
setState(() {
117106
_liveGrid = value;
118107
_liveGrid.stream
@@ -122,6 +111,15 @@ class _ParseLiveGridWidgetState<T extends sdk.ParseObject>
122111
}
123112
});
124113
});
114+
if (value.size > 0) {
115+
setState(() {
116+
noData = false;
117+
});
118+
} else {
119+
setState(() {
120+
noData = true;
121+
});
122+
}
125123
});
126124
}
127125

packages/flutter/lib/src/utils/parse_live_list.dart

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,6 @@ class _ParseLiveListWidgetState<T extends sdk.ParseObject>
9393
lazyLoading: lazyLoading,
9494
preloadedColumns: preloadedColumns,
9595
).then((sdk.ParseLiveList<T> value) {
96-
query.count().then((value) {
97-
if (value.count > 0) {
98-
setState(() {
99-
noData = false;
100-
});
101-
} else {
102-
setState(() {
103-
noData = true;
104-
});
105-
}
106-
});
10796
setState(() {
10897
_liveList = value;
10998
_liveList.stream
@@ -112,9 +101,6 @@ class _ParseLiveListWidgetState<T extends sdk.ParseObject>
112101
if (_animatedListKey.currentState != null)
113102
_animatedListKey.currentState
114103
.insertItem(event.index, duration: widget.duration);
115-
setState(() {
116-
noData = false;
117-
});
118104
} else if (event is sdk.ParseLiveListDeleteEvent) {
119105
_animatedListKey.currentState.removeItem(
120106
event.index,
@@ -131,20 +117,18 @@ class _ParseLiveListWidgetState<T extends sdk.ParseObject>
131117
preLoadedData: () => event.object,
132118
),
133119
duration: widget.duration);
134-
query.count().then((value) {
135-
if (value.count > 0) {
136-
setState(() {
137-
noData = false;
138-
});
139-
} else {
140-
setState(() {
141-
noData = true;
142-
});
143-
}
144-
});
145120
}
146121
});
147122
});
123+
if (value.size > 0) {
124+
setState(() {
125+
noData = false;
126+
});
127+
} else {
128+
setState(() {
129+
noData = true;
130+
});
131+
}
148132
});
149133
}
150134

0 commit comments

Comments
 (0)