onFocusChanged method
- {required bool focused}
Respond to tapping to the search bar and execute an action if the source does not implement search.
Implementation
void onFocusChanged({required bool focused}) async {
_isSearchBarFocused = focused;
if (!_isSearchBarFocused) {
mediaType.floatingSearchBarController.close();
setState(() {});
} else {
if (!mediaSource.implementsSearch) {
await mediaSource.onSearchBarTap(
context: context,
ref: ref,
appModel: appModel,
);
mediaType.floatingSearchBarController.clear();
mediaType.floatingSearchBarController.close();
setState(() {});
FocusScope.of(context).unfocus();
}
}
}