diff --git a/lib/pages/create_post.dart b/lib/pages/create_post.dart index abb340b..eaf1d7f 100644 --- a/lib/pages/create_post.dart +++ b/lib/pages/create_post.dart @@ -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, diff --git a/lib/pages/instance.dart b/lib/pages/instance.dart index 83cd89d..c486db2 100644 --- a/lib/pages/instance.dart +++ b/lib/pages/instance.dart @@ -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( - sort: sortType, - limit: batchSize, - page: page, - auth: accStore.defaultTokenFor(instanceHost)?.raw, - )), + 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,28 +320,30 @@ class _AboutTab extends HookWidget { ), ), if (commSnap.hasData) - ...commSnap.data.take(6).map((c) => ListTile( - onTap: () => goToCommunity.byId( - context, c.instanceHost, c.community.id), - title: Text(c.community.name), - leading: c.community.icon != null - ? CachedNetworkImage( - height: 50, - width: 50, - imageUrl: c.community.icon, - errorWidget: (_, __, ___) => - const SizedBox(width: 50, height: 50), - imageBuilder: (context, imageProvider) => Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - image: DecorationImage( - fit: BoxFit.cover, - image: imageProvider, - ), - ), - )) - : const SizedBox(width: 50), - )) + for (final c in commSnap.data) + ListTile( + onTap: () => goToCommunity.byId( + context, c.instanceHost, c.community.id), + title: Text(c.community.name), + leading: c.community.icon != null + ? CachedNetworkImage( + height: 50, + width: 50, + imageUrl: c.community.icon, + errorWidget: (_, __, ___) => + const SizedBox(width: 50, height: 50), + imageBuilder: (context, imageProvider) => Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + image: DecorationImage( + fit: BoxFit.cover, + image: imageProvider, + ), + ), + ), + ) + : const SizedBox(width: 50), + ) else if (commSnap.hasError) Padding( padding: const EdgeInsets.all(8), diff --git a/pubspec.lock b/pubspec.lock index e79c585..f904007 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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: diff --git a/pubspec.yaml b/pubspec.yaml index 33513ce..9dc8bde 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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