StorytellerCardView embeds a native Storyteller Cards collection in your
Flutter layout. The native iOS and Android SDKs render the card content, while
Flutter passes configuration, analytics context, reload requests, and size
updates across the platform-view bridge.
classCardsSectionextendsStatefulWidget{constCardsSection({super.key});@overrideState<CardsSection>createState()=>_CardsSectionState();}class_CardsSectionStateextendsState<CardsSection>{final_controller=StorytellerCardViewController();@overridevoiddispose(){_controller.detach();super.dispose();}@overrideWidgetbuild(BuildContextcontext){returnStorytellerCardView(collectionId:'featured-cards',controller:_controller,context:const{'screen':'home_feed','placement':'feed_item',},onDataLoadComplete:(result){if(!result.success){debugPrint('Cards failed to load: ${result.error}');}},);}Future<void>refreshCards()async{await_controller.reloadData();}}
Key parameters:
collectionId - the Storyteller Cards collection to render. Supply a
non-blank value to render native Cards content.
controller - optional StorytellerCardViewController for programmatic
reloads.
initialHeight - finite, positive placeholder height until native content
reports its measured size. The default is 760.
onDataLoadComplete(StorytellerCardLoadResult result) - called when native
data loading finishes. Android also reports dataCount; iOS reports success
or failure. Error payloads include type and message, with
causeMessage when the native platform exposes an underlying cause.
The constructor keeps the older optional storyId, clipId, theme, and
onTileTapped arguments as deprecated source-compatibility shims. They do not
enable legacy card content. A StorytellerCardView without a non-blank
collectionId renders no content.
Cards can change height after native content loads. StorytellerCardView
starts at initialHeight and then updates to the measured native card height.
The default is intentionally tall enough to avoid composing too many off-screen
native Card views before Android reports the measured size, while still letting
the native SDK own the final height.
{"slug": "cards", "page_title": "Cards", "page_url": "Cards/", "canonical_url": "/flutter/Cards/", "markdown": "# Cards\n\n`StorytellerCardView` embeds a native Storyteller Cards collection in your\nFlutter layout. The native iOS and Android SDKs render the card content, while\nFlutter passes configuration, analytics context, reload requests, and size\nupdates across the platform-view bridge.\n\n## Basic usage\n\n```dart\nclass CardsSection extends StatefulWidget {\n const CardsSection({super.key});\n\n @override\n State<CardsSection> createState() => _CardsSectionState();\n}\n\nclass _CardsSectionState extends State<CardsSection> {\n final _controller = StorytellerCardViewController();\n\n @override\n void dispose() {\n _controller.detach();\n super.dispose();\n }\n\n @override\n Widget build(BuildContext context) {\n return StorytellerCardView(\n collectionId: 'featured-cards',\n controller: _controller,\n context: const {\n 'screen': 'home_feed',\n 'placement': 'feed_item',\n },\n onDataLoadComplete: (result) {\n if (!result.success) {\n debugPrint('Cards failed to load: ${result.error}');\n }\n },\n );\n }\n\n Future<void> refreshCards() async {\n await _controller.reloadData();\n }\n}\n```\n\nKey parameters:\n\n- `collectionId` - the Storyteller Cards collection to render. Supply a\n non-blank value to render native Cards content.\n- `context` - optional analytics attribution metadata.\n- `controller` - optional `StorytellerCardViewController` for programmatic\n reloads.\n- `initialHeight` - finite, positive placeholder height until native content\n reports its measured size. The default is `760`.\n- `onDataLoadComplete(StorytellerCardLoadResult result)` - called when native\n data loading finishes. Android also reports `dataCount`; iOS reports success\n or failure. Error payloads include `type` and `message`, with\n `causeMessage` when the native platform exposes an underlying cause.\n\n## Upgrade compatibility\n\nThe constructor keeps the older optional `storyId`, `clipId`, `theme`, and\n`onTileTapped` arguments as deprecated source-compatibility shims. They do not\nenable legacy card content. A `StorytellerCardView` without a non-blank\n`collectionId` renders no content.\n\n## Sizing behaviour\n\nCards can change height after native content loads. `StorytellerCardView`\nstarts at `initialHeight` and then updates to the measured native card height.\nThe default is intentionally tall enough to avoid composing too many off-screen\nnative Card views before Android reports the measured size, while still letting\nthe native SDK own the final height.\n\nFor a full feed integration, review the Showcase\n[`StorytellerCardWidget`](https://github.com/getstoryteller/storyteller-showcase-flutter/blob/main/lib/screens/home/widgets/storyteller_card_widget.dart).\n", "copy_markdown_include_header": false, "base_path": "", "ai_dir": "ai", "missing_payload_behavior": "empty"}