diff --git a/lib/pages/community.dart b/lib/pages/community.dart index cf7c5bc..48984dd 100644 --- a/lib/pages/community.dart +++ b/lib/pages/community.dart @@ -14,12 +14,19 @@ class CommunityPage extends HookWidget { final CommunityView _community; final String instanceUrl; - CommunityPage({@required String communityName, @required this.instanceUrl}) + CommunityPage.fromName( + {@required String communityName, @required this.instanceUrl}) : assert(communityName != null), assert(instanceUrl != null), _fullCommunityFuture = LemmyApi(instanceUrl).v1.getCommunity(name: communityName), _community = null; + CommunityPage.fromId({@required int communityId, @required this.instanceUrl}) + : assert(communityId != null), + assert(instanceUrl != null), + _fullCommunityFuture = + LemmyApi(instanceUrl).v1.getCommunity(id: communityId), + _community = null; CommunityPage.fromCommunityView(this._community) : instanceUrl = _community.actorId.split('/')[2], _fullCommunityFuture = LemmyApi(_community.actorId.split('/')[2])