Skip to content
On this page

SearchAnchor

A search trigger with a contextual search surface.

SearchAnchor in FluttyUISearchAnchor in FluttyUI dark theme

Import

import 'package:flutter/widgets.dart';
import 'package:fluttyui/fluttyui.dart' as ui;

API Reference

The declarations below match the current FluttyUI source. Types are shown without the optional ui. import prefix.

SearchAnchor

const SearchAnchor({
  super.key,
  this.size,
  required this.suggestionsBuilder,
  this.controller,
  this.builder,
  this.suggestionBuilder,
  this.displayStringForSuggestion,
  this.onSuggestionSelected,
  this.onChanged,
  this.onSubmitted,
  this.emptyBuilder,
  this.loadingBuilder,
  this.errorBuilder,
  this.hintText = 'Search...',
  this.suggestionsLabel = 'Suggestions',
  this.debounce = const Duration(milliseconds: 150),
  this.closeOnSelect = true,
  this.enabled = true,
});
ParameterTypeRequiredDefault
keyKey?Nonull
sizeComponentSize?Nonull
suggestionsBuilderFutureOr<Iterable<T>> Function(BuildContext context, String query)Yes—
controllerTextEditingController?Nonull
builderWidget Function(BuildContext context, VoidCallback openView)?Nonull
suggestionBuilderWidget Function(BuildContext context, T suggestion)?Nonull
displayStringForSuggestionString Function(T suggestion)?Nonull
onSuggestionSelectedValueChanged<T>?Nonull
onChangedValueChanged<String>?Nonull
onSubmittedValueChanged<String>?Nonull
emptyBuilderWidgetBuilder?Nonull
loadingBuilderWidgetBuilder?Nonull
errorBuilderWidget Function(BuildContext context, Object error)?Nonull
hintTextStringNo'Search...'
suggestionsLabelStringNo'Suggestions'
debounceDurationNoconst Duration(milliseconds: 150)
closeOnSelectboolNotrue
enabledboolNotrue

Application Setup

Place components under FluttyApp to provide theme, navigation, localization, and overlay defaults. Use theme tokens for shared appearance settings.

Source

lib/src/widgets/forms/search_anchor/search_anchor.dart

This reference is generated from the SearchAnchor declaration in the FluttyUI core checkout. The component catalog lists the other available building blocks.

DartFlutter

Get started with FluttyUI