showOverlay method
Shows the search overlay with an optional value.
The value parameter can be used to pass context-specific data
that determines what content to display in the overlay.
Example:
// Show overlay for user search
controller.showOverlay(value: 'user');
// Show overlay for category selection
controller.showOverlay(value: CategoryType.products);
// Show overlay with numeric identifier
controller.showOverlay(value: 1);
Implementation
void showOverlay({Object? value}) {
if (_isOverlayVisible) {
// If already visible but value changed, update it
if (value != null && _overlayValue != value) {
_overlayValue = value;
notifyListeners();
}
return;
}
_isOverlayVisible = true;
_overlayValue = value;
// Preserve the focused index when reopening
// If cubit is in initial state and searchOnEmpty is true, trigger initial fetch
if (_cubit.state is SmartPaginationInitial && _config.searchOnEmpty) {
_performSearch(_textController.text);
}
notifyListeners();
}