SliverSmartSearchGrid<T extends Object> class

A sliver version of SmartSearchGrid for use in CustomScrollView.

Emits slivers instead of managing its own scroll view, so it can be composed with other slivers (e.g. SliverAppBar) inside a CustomScrollView.

Unlike SmartSearchGrid, this widget does not include a built-in search field, sort/filter builders, progress indicator builder, or scroll controller. The parent CustomScrollView (or a companion sliver) should provide the search input and drive the SmartSearchController externally.

Three constructors target different use cases:

Example (offline):

CustomScrollView(
  slivers: [
    SliverAppBar(title: Text('My Grid')),
    SliverSmartSearchGrid<String>(
      items: ['Apple', 'Banana', 'Cherry'],
      searchableFields: (item) => [item],
      itemBuilder: (context, item, index, {searchTerms = const []}) =>
          Card(child: Center(child: Text(item))),
      gridConfig: GridConfiguration(
        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 2,
        ),
      ),
    ),
  ],
)
Inheritance

Constructors

SliverSmartSearchGrid({Key? key, required List<T> items, required List<String> searchableFields(T item), required ItemBuilder<T> itemBuilder, required GridConfiguration gridConfig, LoadingStateBuilder? loadingStateBuilder, ErrorStateBuilder? errorStateBuilder, EmptyStateBuilder? emptyStateBuilder, EmptySearchStateBuilder? emptySearchStateBuilder, SearchConfiguration searchConfig = const SearchConfiguration(), PaginationConfiguration? paginationConfig, void onItemTap(T item, int index)?, void onSearchChanged(String query)?, bool cacheResults = true, int maxCacheSize = 100, SelectionConfiguration? selectionConfig, void onSelectionChanged(Set<T> selectedItems)?, Object groupBy(T item)?, GroupHeaderBuilder? groupHeaderBuilder, Comparator<Object>? groupComparator, double groupHeaderExtent = 48.0, AccessibilityConfiguration accessibilityConfig = const AccessibilityConfiguration()})
Creates an offline sliver searchable grid with client-side search.
const
SliverSmartSearchGrid.async({Key? key, required Future<List<T>> asyncLoader(String query, {int page, int pageSize}), required ItemBuilder<T> itemBuilder, required GridConfiguration gridConfig, LoadingStateBuilder? loadingStateBuilder, ErrorStateBuilder? errorStateBuilder, EmptyStateBuilder? emptyStateBuilder, EmptySearchStateBuilder? emptySearchStateBuilder, SearchConfiguration searchConfig = const SearchConfiguration(), PaginationConfiguration? paginationConfig, void onItemTap(T item, int index)?, void onSearchChanged(String query)?, bool cacheResults = true, int maxCacheSize = 100, SelectionConfiguration? selectionConfig, void onSelectionChanged(Set<T> selectedItems)?, Object groupBy(T item)?, GroupHeaderBuilder? groupHeaderBuilder, Comparator<Object>? groupComparator, double groupHeaderExtent = 48.0, AccessibilityConfiguration accessibilityConfig = const AccessibilityConfiguration()})
Creates an async sliver searchable grid that loads data from a remote source.
const
SliverSmartSearchGrid.controller({Key? key, required SmartSearchController<T> controller, required ItemBuilder<T> itemBuilder, required GridConfiguration gridConfig, LoadingStateBuilder? loadingStateBuilder, ErrorStateBuilder? errorStateBuilder, EmptyStateBuilder? emptyStateBuilder, EmptySearchStateBuilder? emptySearchStateBuilder, SearchConfiguration searchConfig = const SearchConfiguration(), PaginationConfiguration? paginationConfig, void onItemTap(T item, int index)?, void onSearchChanged(String query)?, SelectionConfiguration? selectionConfig, void onSelectionChanged(Set<T> selectedItems)?, Object groupBy(T item)?, GroupHeaderBuilder? groupHeaderBuilder, Comparator<Object>? groupComparator, double groupHeaderExtent = 48.0, AccessibilityConfiguration accessibilityConfig = const AccessibilityConfiguration()})
Creates a sliver searchable grid driven entirely by an external controller.
const

Properties

accessibilityConfig AccessibilityConfiguration
Accessibility configuration for screen reader semantics.
finalinherited
asyncLoader Future<List<T>> Function(String query, {int page, int pageSize})?
Async data loader for server-driven search.
finalinherited
cacheResults bool
Whether to cache async search results. Defaults to true.
finalinherited
controller SmartSearchController<T>?
Optional external controller. When provided, you are responsible for disposing it — the widget only disposes controllers it creates internally.
finalinherited
emptySearchStateBuilder EmptySearchStateBuilder?
Builder for the empty search state shown when no results match.
finalinherited
emptyStateBuilder EmptyStateBuilder?
Builder for the empty state shown when there is no data.
finalinherited
errorStateBuilder ErrorStateBuilder?
Builder for the error state shown when loading fails.
finalinherited
gridConfig GridConfiguration
Grid appearance configuration (delegate, scroll physics, padding, etc.).
final
groupBy Object Function(T item)?
Groups items by the returned value. When non-null, items are displayed in sections with headers.
finalinherited
groupComparator Comparator<Object>?
Comparator for ordering groups. If null, groups appear in insertion order.
finalinherited
groupHeaderBuilder GroupHeaderBuilder?
Builder for group section headers. If null, DefaultGroupHeader is used.
finalinherited
groupHeaderExtent double
Fixed extent for sticky group headers (default: 48.0).
final
hashCode int
The hash code for this object.
no setterinherited
itemBuilder ItemBuilder<T>
Builds each item in the list or grid.
finalinherited
items List<T>?
Items for offline mode.
finalinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
loadingStateBuilder LoadingStateBuilder?
Builder for the loading state shown while data is loading.
finalinherited
maxCacheSize int
Maximum number of cached results. Defaults to 100.
finalinherited
onItemTap → void Function(T item, int index)?
Called when an item is tapped.
finalinherited
onSearchChanged → void Function(String query)?
Called when the search query changes.
finalinherited
onSelectionChanged → void Function(Set<T> selectedItems)?
Called when selection changes (multi-select mode).
finalinherited
paginationConfig PaginationConfiguration?
Pagination configuration. If null, pagination is disabled.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
searchableFields List<String> Function(T item)?
Function to extract searchable text from items.
finalinherited
searchConfig SearchConfiguration
Search behavior configuration (debounce, hint text, case sensitivity, etc.).
finalinherited
selectionConfig SelectionConfiguration?
Multi-select configuration. When non-null, multi-select mode is enabled.
finalinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<SliverSmartSearchGrid<T>>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited