fix: 搜索结果为null时页面异常

This commit is contained in:
guozhigq
2024-01-03 23:50:38 +08:00
parent 6591d35c74
commit e910f5b7e7

View File

@ -74,6 +74,7 @@ class _SearchPanelState extends State<SearchPanel>
future: _futureBuilderFuture,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.data != null) {
Map data = snapshot.data;
var ctr = _searchPanelController;
RxList list = ctr.resultList;
@ -109,6 +110,17 @@ class _SearchPanelState extends State<SearchPanel>
],
);
}
} else {
return CustomScrollView(
physics: const NeverScrollableScrollPhysics(),
slivers: [
HttpError(
errMsg: '没有相关数据',
fn: () => setState(() {}),
),
],
);
}
} else {
// 骨架屏
return ListView.builder(