Skip to main content

Migration Guide: Feed Flutter SDK (v1.12.1 to v1.13.0)

This guide provides an overview of the key changes in v1.13.0 of the LikeMinds Feed Flutter SDK and instructions for updating your project from v1.12.1.


Key Updates in v1.13.0

  1. LMFeedWidgetUtility replaced by LMFeedWidgetBuilderDelegate:

    • Common widget builders are now handled by LMFeedWidgetBuilderDelegate.
  2. Screen-Level Builder Delegates Introduced:

    • Builders for screen-specific elements (e.g., floatingActionButtonBuilder) are now moved to screen-level delegates such as LMFeedSocialScreenBuilderDelegate.
  3. Screen-level Config Introduced:

    • It consist the specific screen level builder delegate. e.g, LMFeedSocialScreenConfig for LMFeedSocialScreenBuilderDelegate

Migration Steps

Step 1: Upgrade the LikeMinds Feed Flutter SDK to v1.13.0 in pubspec.yaml

likeminds_feed_flutter_core: ^1.13.0

Step 2: Update Common Widget Builders

Replace LMFeedWidgetUtility with LMFeedWidgetBuilderDelegate for common widget customization.

Before v1.13.0:

class ExampleWidgetUtility extends LMFeedWidgetUtility {

Widget postWidgetBuilder(
BuildContext context, LMFeedPostWidget post, LMPostViewData postViewData,
{LMFeedWidgetSource source = LMFeedWidgetSource.universalFeed}) {
return post.copyWith(
style: post.style?.copyWith(backgroundColor: Colors.red),
);
}
}

After v1.13.0:

class ExampleBuilderDelegate extends LMFeedWidgetBuilderDelegate {

Widget postWidgetBuilder(
BuildContext context, LMFeedPostWidget post, LMPostViewData postViewData,
{LMFeedWidgetSource source = LMFeedWidgetSource.universalFeed}) {
return post.copyWith(
style: post.style?.copyWith(backgroundColor: Colors.red),
);
}
}

Step 3: Implement Screen-Level Builders

For screen-specific customizations, such as the floating action button, extend the relevant screen-level delegate (e.g., LMFeedSocialScreenBuilderDelegate).

Example:

class ExampleLMFeedScreenBuilderDelegate extends LMFeedSocialScreenBuilderDelegate {

Widget floatingActionButtonBuilder(
BuildContext context, LMFeedButton floatingActionButton) {
return floatingActionButton.copyWith();
}
}

Step 4: Update SDK Initialization

Pass the widget builder and screen-level builder in the LMFeedConfig during SDK initialization.

Before v1.13.0:

LMFeedCore.instance.initialize(
widget: ExampleWidgetUtility(),
);

After v1.13.0:

LMFeedCore.instance.initialize(
config: LMFeedConfig(
widgetBuilderDelegate: ExampleBuilderDelegate(),
socialFeedScreenConfig: LMFeedSocialScreenConfig(
builder: ExampleLMFeedScreenBuilderDelegate(),
),
),
);

Summary of Changes

v1.12.1v1.13.0
LMFeedWidgetUtility for all customizations.LMFeedWidgetBuilderDelegate for common widgets.
floatingActionButtonBuilder in WidgetUtility.Moved to LMFeedSocialScreenBuilderDelegate.
Single initialization using widget.Modular initialization with LMFeedWidgetBuilderDelegate and LMFeedConfig.

Key Methods Comparison

LMFeedWidgetUtility (v1.12.1)LMFeedWidgetBuilderDelegate (v1.13.0)Notes
scaffoldscaffoldNo change.
postWidgetBuilderpostWidgetBuilderNo change.
commentBuildercommentBuilderNo change.
headerBuilderpostHeaderBuilderMinor name change (headerBuilderpostHeaderBuilder).
menuBuilderpostMenuBuilderMinor name change (menuBuilderpostMenuBuilder).
topicBuildertopicBuilderNo change.
postContentBuilderpostContentBuilderNo change.
postMediaBuilderpostMediaBuilderNo change.
postFooterBuilderpostFooterBuilderNo change.
pollWidgetBuilderpollWidgetBuilderNo change.
noItemsFoundIndicatorBuilderFeednoItemsFoundIndicatorBuilderName shortened; now allows passing Widget? child.
noPostUnderTopicFeednoPostUnderTopicFeedNo change.
firstPageProgressIndicatorBuilderFeedfirstPageProgressIndicatorBuilderName shortened; now allows passing Widget? child.
newPageProgressIndicatorBuilderFeednewPageProgressIndicatorBuilderName shortened; now allows passing Widget? child.
firstPageErrorIndicatorBuilderFeedfirstPageErrorIndicatorBuilderName shortened; now allows passing Widget? child.
newPageErrorIndicatorBuilderFeednewPageErrorIndicatorBuilderName shortened; now allows passing Widget? child.
noMoreItemsIndicatorBuilderFeednoMoreItemsIndicatorBuilderName shortened; now allows passing Widget? child.
snackBarBuildersnackBarBuilderNo change.
imageBuilderimageBuilderNo change.
videoBuildervideoBuilderNo change.
topicBarBuildertopicBarBuilderNo change.
topResponseBuildertopResponseBuilderNo change.
addACommentBuilderaddACommentBuilderNo change.

Benefits of v1.13.0

  • Modularity: Screen-specific builders make customization more organized and targeted.
  • Flexibility: Pass separate builders for widgets and screens, allowing granular control over UI components.

By following these steps, you can migrate seamlessly to v1.13.0 and take advantage of the new modular and flexible customization options.