mirror of
https://github.com/venera-app/venera.git
synced 2025-12-15 22:51:15 +00:00
Merge pull request #588 from venera-app/fix/comic-list-loading
Fix the issue of the comic list loading infinitely. Close #584
This commit is contained in:
@@ -1159,7 +1159,7 @@ class ComicListState extends State<ComicList> {
|
|||||||
if (res.data.isEmpty) {
|
if (res.data.isEmpty) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_data[page] = const [];
|
_data[page] = const [];
|
||||||
_maxPage = page;
|
_maxPage ??= page;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -1282,8 +1282,8 @@ class ComicListState extends State<ComicList> {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (_data[_page] == null) {
|
if (_data[1] == null) {
|
||||||
_loadPage(_page);
|
_loadPage(1);
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
if (widget.errorLeading != null) widget.errorLeading!,
|
if (widget.errorLeading != null) widget.errorLeading!,
|
||||||
@@ -1304,7 +1304,7 @@ class ComicListState extends State<ComicList> {
|
|||||||
comics: _data.values.expand((element) => element).toList(),
|
comics: _data.values.expand((element) => element).toList(),
|
||||||
menuBuilder: widget.menuBuilder,
|
menuBuilder: widget.menuBuilder,
|
||||||
onLastItemBuild: () {
|
onLastItemBuild: () {
|
||||||
if (_error == null && (_maxPage == null || _page < _maxPage!)) {
|
if (_error == null && (_maxPage == null || _data.length < _maxPage!)) {
|
||||||
_loadPage(_data.length + 1);
|
_loadPage(_data.length + 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1334,7 +1334,7 @@ class ComicListState extends State<ComicList> {
|
|||||||
],
|
],
|
||||||
).paddingHorizontal(16).paddingVertical(8),
|
).paddingHorizontal(16).paddingVertical(8),
|
||||||
)
|
)
|
||||||
else if (_maxPage == null || _page < _maxPage!)
|
else if (_maxPage == null || _data.length < _maxPage!)
|
||||||
const SliverListLoadingIndicator(),
|
const SliverListLoadingIndicator(),
|
||||||
if (widget.trailingSliver != null) widget.trailingSliver!,
|
if (widget.trailingSliver != null) widget.trailingSliver!,
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user