The Search component allows users to search for Storyteller Clips and Stories. As users type, a list of suggestions will appear, from which users can either select a suggestion or search using their entered term. Results are categorized by type into Stories and Clips. The current native versions also support tenant-configured Articles results. Filters allow users to narrow down their search results, enabling them to find specific content that meets their criteria more efficiently. For instance, users can apply filters such as date posted, content type or they can sort it by certain criteria.
The Articles behavior described here was audited against a pre-release Flutter 12.1.2 snapshot with Android 12.1.2 and iOS 11.8.0. Published Flutter 12.2.0 uses Android 12.2.0 and iOS 11.9.1; consult Changelog for released dependencies. Native configuration can hide filter sections or content types.
The Search feature must first be enabled by the Storyteller team for your specific tenant. Once enabled, the Search functionality will be available within the Story and Clip players.
Additional Search functionality is available through the Storyteller class:
After successful initialization, use isSearchEnabled() to check whether the current API key enables search. Availability comes from native tenant settings; Flutter does not expose filter or query configuration parameters.
finalisEnabled=awaitStoryteller.isSearchEnabled();if(isEnabled){print('Search is enabled');}else{print('Search is not enabled');}
Use openSearch() to open the Search component from anywhere in the app. iOS dismisses an existing Storyteller player before presenting Search. Android launches its native Search activity when search is enabled and an activity is attached; do not rely on the same dismissal ordering.
// After initialization, open search only if enabledif(awaitStoryteller.isSearchEnabled()){awaitStoryteller.openSearch();}
Example: Adding a Search Button
import'package:flutter/material.dart';import'package:storyteller_sdk/storyteller_sdk.dart';classSearchButtonextendsStatelessWidget{constSearchButton({super.key});@overrideWidgetbuild(BuildContextcontext){returnFutureBuilder<bool>(future:Storyteller.isSearchEnabled(),builder:(context,snapshot){if(!snapshot.hasData||!snapshot.data!){returnconstSizedBox.shrink();// Hide while loading or unavailable}returnIconButton(icon:constIcon(Icons.search),onPressed:()async{awaitStoryteller.openSearch();},);},);}}
If Search does not open, verify initialization, availability for the current key, and that your app is foregrounded. See Troubleshooting.
{"slug": "search", "page_title": "Search", "page_url": "Search/", "canonical_url": "/flutter/Search/", "markdown": "# Search\n\nThe `Search` component allows users to search for Storyteller Clips and Stories. As users type, a list of suggestions will appear, from which users can either select a suggestion or search using their entered term. Results are categorized by type into `Stories` and `Clips`. The current native versions also support tenant-configured `Articles` results. Filters allow users to narrow down their search results, enabling them to find specific content that meets their criteria more efficiently. For instance, users can apply filters such as date posted, content type or they can sort it by certain criteria.\n\nThe Articles behavior described here was audited against a pre-release Flutter 12.1.2 snapshot with Android 12.1.2 and iOS 11.8.0. Published Flutter 12.2.0 uses Android 12.2.0 and iOS 11.9.1; consult [Changelog](Changelog.md) for released dependencies. Native configuration can hide filter sections or content types.\n\n## Search Filters\n\n`Date Posted` possible values:\n\n- `All` - default value\n- `Past 24 hours`\n- `Last Week`\n- `Last Month`\n- `Last Year`\n\n`Content Type` possible values:\n\n- `All` - default value\n- `Stories`\n- `Clips`\n- `Articles` - when configured for the tenant in the current native Search experience\n\n`Sort By` values:\n\n- `Relevance` - default value\n- `Like Count`\n- `Share Count`\n- `Date Posted`\n\n## How to Use\n\nThe `Search` feature must first be enabled by the Storyteller team for your specific tenant. Once enabled, the Search functionality will be available within the Story and Clip players.\n\nAdditional `Search` functionality is available through the `Storyteller` class:\n\n### Check if Search is Enabled\n\nAfter successful initialization, use `isSearchEnabled()` to check whether the current API key enables search. Availability comes from native tenant settings; Flutter does not expose filter or query configuration parameters.\n\n```dart\nfinal isEnabled = await Storyteller.isSearchEnabled();\nif (isEnabled) {\n print('Search is enabled');\n} else {\n print('Search is not enabled');\n}\n```\n\n### Open Search\n\nUse `openSearch()` to open the `Search` component from anywhere in the app. iOS dismisses an existing Storyteller player before presenting Search. Android launches its native Search activity when search is enabled and an activity is attached; do not rely on the same dismissal ordering.\n\n```dart\n// After initialization, open search only if enabled\nif (await Storyteller.isSearchEnabled()) {\n await Storyteller.openSearch();\n}\n```\n\n**Example: Adding a Search Button**\n\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:storyteller_sdk/storyteller_sdk.dart';\n\nclass SearchButton extends StatelessWidget {\n const SearchButton({super.key});\n\n @override\n Widget build(BuildContext context) {\n return FutureBuilder<bool>(\n future: Storyteller.isSearchEnabled(),\n builder: (context, snapshot) {\n if (!snapshot.hasData || !snapshot.data!) {\n return const SizedBox.shrink(); // Hide while loading or unavailable\n }\n \n return IconButton(\n icon: const Icon(Icons.search),\n onPressed: () async {\n await Storyteller.openSearch();\n },\n );\n },\n );\n }\n}\n```\n\nThe Showcase home screen wires these APIs end-to-end: `initState` queries availability via [`Storyteller.isSearchEnabled()`](https://github.com/getstoryteller/storyteller-showcase-flutter/blob/main/lib/screens/home/home_screen.dart#L33) and the search icon triggers [`Storyteller.openSearch()`](https://github.com/getstoryteller/storyteller-showcase-flutter/blob/main/lib/screens/home/home_screen.dart#L90).\n\n## Customization\n\nCertain UI parts of the `Search` component can be customized through theming. For more information, see the [Themes documentation - Search section](Themes.md#search).\n\nYou can customize:\n\n- Back icon\n- Filter heading font, size, line height, text case, and color\n\nDeclare `assets/icons/custom_back.png` under `flutter.assets` in your app's `pubspec.yaml` before using this example; the filename and case must match.\n\n**Example: Customizing Search Appearance**\n\n```dart\nfinal theme = StorytellerTheme(\n light: ThemeType(\n search: ThemeSearch(\n backIcon: ThemeImage(filePath: 'assets/icons/custom_back.png'),\n heading: ThemeTitle(\n textSize: 24.0,\n lineHeight: 30.0,\n textCase: 'upper',\n textColor: '#000000',\n ),\n ),\n ),\n);\n\nawait Storyteller.setTheme(theme);\n```\n\nIf Search does not open, verify initialization, availability for the current key, and that your app is foregrounded. See [Troubleshooting](Troubleshooting.md).\n", "copy_markdown_include_header": false, "base_path": "", "ai_dir": "ai", "missing_payload_behavior": "empty"}