Compare commits

..

1 Commits

Author SHA1 Message Date
ynyx631
9636cf62cb Fix the issue of the comic list loading infinitely. Close #584 2025-10-29 19:39:18 +08:00
4 changed files with 9 additions and 9 deletions

View File

@@ -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!,
], ],

View File

@@ -13,7 +13,7 @@ export "widget_utils.dart";
export "context.dart"; export "context.dart";
class _App { class _App {
final version = "1.6.0"; final version = "1.5.3";
bool get isAndroid => Platform.isAndroid; bool get isAndroid => Platform.isAndroid;

View File

@@ -1132,4 +1132,4 @@ packages:
version: "0.0.12" version: "0.0.12"
sdks: sdks:
dart: ">=3.8.0 <4.0.0" dart: ">=3.8.0 <4.0.0"
flutter: ">=3.35.7" flutter: ">=3.35.5"

View File

@@ -2,11 +2,11 @@ name: venera
description: "A comic app." description: "A comic app."
publish_to: 'none' publish_to: 'none'
version: 1.6.0+160 version: 1.5.3+153
environment: environment:
sdk: '>=3.8.0 <4.0.0' sdk: '>=3.8.0 <4.0.0'
flutter: 3.35.7 flutter: 3.35.5
dependencies: dependencies:
flutter: flutter: