Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Commit

Permalink
fix: curseforge mods loading bug
Browse files Browse the repository at this point in the history
  • Loading branch information
SiongSng committed May 24, 2022
1 parent 19ff94c commit 8bb5cab
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/pages/curseforge_addon_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,21 @@ class _CurseForgeAddonPageState extends State<CurseForgeAddonPage> {
width: MediaQuery.of(context).size.width / 2,
child: FutureBuilder<List<CurseForgeMod>>(
future: Future.sync(() async => sortMods(await widget.getModList(
searchController.text, index, sortItem))),
searchController.text.isEmpty ? null : searchController.text,
index,
sortItem))),
builder: (context, snapshot) {
if (snapshot.hasData &&
snapshot.connectionState == ConnectionState.done) {
if (snapshot.data!.isEmpty) {
if (snapshot.hasData) {
if (snapshot.data!.isEmpty &&
snapshot.connectionState == ConnectionState.done) {
return I18nText(widget.notFound,
style: const TextStyle(fontSize: 30),
textAlign: TextAlign.center);
} else if (snapshot.connectionState != ConnectionState.done &&
snapshot.data!.length < 20) {
return const Center(child: RWLLoading());
}

oldAddonList = snapshot.data!;
return ListView.builder(
controller: scrollController,
shrinkWrap: true,
Expand Down Expand Up @@ -199,6 +203,8 @@ class _CurseForgeAddonPageState extends State<CurseForgeAddonPage> {
}
});

oldAddonList = mods;

return mods;
}

Expand All @@ -219,7 +225,7 @@ class CurseForgeAddonPage extends StatefulWidget {
final String tapDescriptionKey;

final Future<List<CurseForgeMod>> Function(
String fitter, int index, CurseForgeSortField sort) getModList;
String? fitter, int index, CurseForgeSortField sort) getModList;
final void Function(int curseID, CurseForgeMod mod) onInstall;

final List<Widget> Function(VoidCallback cleanAllMods)? fitterOptions;
Expand Down

0 comments on commit 8bb5cab

Please sign in to comment.