Bump lemmy_api_client and adjust to changes

This commit is contained in:
shilangyu 2021-01-31 13:42:28 +00:00
parent 92cdfdbc2c
commit 0ddf488602
4 changed files with 38 additions and 33 deletions

View File

@ -61,6 +61,7 @@ class CreatePostPage extends HookWidget {
final allCommunitiesSnap = useMemoFuture(
() => LemmyApiV2(selectedInstance.value)
.run(ListCommunities(
type: PostListingType.local,
sort: SortType.hot,
limit: 9999,
auth: accStore.defaultTokenFor(selectedInstance.value).raw,

View File

@ -32,8 +32,8 @@ class InstancePage extends HookWidget {
InstancePage({@required this.instanceHost})
: assert(instanceHost != null),
siteFuture = LemmyApiV2(instanceHost).run(GetSite()),
communitiesFuture =
LemmyApiV2(instanceHost).run(ListCommunities(sort: SortType.hot));
communitiesFuture = LemmyApiV2(instanceHost).run(ListCommunities(
type: PostListingType.local, sort: SortType.hot, limit: 6));
@override
Widget build(BuildContext context) {
@ -268,13 +268,15 @@ class _AboutTab extends HookWidget {
goTo(
context,
(_) => CommunitiesListPage(
fetcher: (page, batchSize, sortType) =>
LemmyApiV2(instanceHost).run(ListCommunities(
fetcher: (page, batchSize, sortType) => LemmyApiV2(instanceHost).run(
ListCommunities(
type: PostListingType.local,
sort: sortType,
limit: batchSize,
page: page,
auth: accStore.defaultTokenFor(instanceHost)?.raw,
)),
),
),
title: 'Communities of ${site.siteView.site.name}',
),
);
@ -318,7 +320,8 @@ class _AboutTab extends HookWidget {
),
),
if (commSnap.hasData)
...commSnap.data.take(6).map((c) => ListTile(
for (final c in commSnap.data)
ListTile(
onTap: () => goToCommunity.byId(
context, c.instanceHost, c.community.id),
title: Text(c.community.name),
@ -337,9 +340,10 @@ class _AboutTab extends HookWidget {
image: imageProvider,
),
),
))
),
)
: const SizedBox(width: 50),
))
)
else if (commSnap.hasError)
Padding(
padding: const EdgeInsets.all(8),

View File

@ -267,7 +267,7 @@ packages:
name: lemmy_api_client
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.0"
version: "0.10.1"
markdown:
dependency: "direct main"
description:

View File

@ -43,7 +43,7 @@ dependencies:
# utils
timeago: ^2.0.27
fuzzy: <1.0.0
lemmy_api_client: ^0.10.0
lemmy_api_client: ^0.10.1
flutter:
sdk: flutter