Skip to main content

How to configure Topics

For getting started, please refer to this doc.

Enabling topics in your community brings you one step closer to building a topic based feed experience using the LikeMinds Feed Flutter SDK.

The following configurations for topics are offered in Feed Flutter SDK:

1. Adding Topics to Posts:

a. By default, you can include topics when creating a post.

b. You can optionally make selecting a topic mandatory for creating a post.

2. Filtering Posts by Topics:

a. By default, you can filter the posts you see based on the topics they are associated with.

b. There's an option to control how users select topics for filtering.

Step 1

Create an instance of LMFeedConfig to configure topics.

config: LMFeedConfig(
composeConfig: const LMFeedComposeScreenConfig(
// this will make the topic compulsory to create a post
topicRequiredToCreatePost: true,
// [true by default] enables or disables topic in feed
enableTopics: true,
),
feedScreenConfig: const LMFeedScreenConfig(
// Enables filtering post using topics
enableTopicFiltering: true,
// Topic Filter can be shown as a bottom sheet or a separate screen
topicSelectionWidgetType: LMFeedTopicSelectionWidgetType.showTopicSelectionBottomSheet,
)
)

Below is the description of keys you have used in the above snippet.

NameTypeDescriptionOptional
enableTopicsboolBoolean to enable or disable topic in Feed, defaults to true✔️
topicRequiredToCreatePostboolWhether or not topic is compulsory for creating a post, defaults to false✔️
enableTopicFilteringboolEnables filtering post using topics, defaults to true✔️
topicSelectionWidgetTypeLMFeedTopicSelectionWidgetTypeSelects the type of Topic filtering widget to be shown, LMFeedTopicSelectionWidgetType.showTopicSelectionBottomSheet will present a bottom sheet whereas LMFeedTopicSelectionWidgetType.showTopicSelectionScreen will present a separate screen, default to LMFeedTopicSelectionWidgetType.showTopicSelectionScreen✔️
enableTopics:

This is the difference when topic selection is enabled or disabled in the Compose screen.

LMFeedComposeScreen

LMFeedComposeScreen

true

false

enableTopicFiltering:

This is the difference in Feed's design when topic based filtering is enabled or disabled

LMFeedComposeScreen

LMFeedComposeScreen

true

false

topicSelectionWidgetType:

This is the difference between the two options we provide to select topics for filtering feed.

LMFeedComposeScreen

LMFeedComposeScreen

showTopicSelectionScreen

showTopicSelectionBottomSheet

Step 2

While calling initialize method of LMFeedCore, pass the instance created in Step 1.

await LMFeedCore.instance.initialize(
// Replace below string with api key of your community
apiKey: "YOUR_API_KEY",
config: config,
);

Below is the description of keys you have used in the above snippet.

NameTypeDescriptionOptional
apiKeyStringAPI key of the community
configLMFeedConfigConfigures features in Feed, i.e. topics, heading in post, etc.,✔️