Autofocus the search box when the "Search" button is clicked.

This commit adds the much-needed ability to autofocus the search box on macOS.
This commit is contained in:
Tomasz Mikus
2024-10-05 10:44:44 +01:00
parent fca8e13c03
commit 2c417cd711

View File

@@ -338,8 +338,8 @@ class _HomePageState extends State<HomePage> {
_searchText = _textController.text;
// Request focus on the search box
// For Windows only for now. "Platform.isWindows" can be removed if other platforms has been tested.
if (Platform.isWindows) {
// For Windows and macOS only for now. This if statement can be removed if other platforms has been tested.
if (Platform.isWindows || Platform.isMacOS) {
searchBoxFocusNode.requestFocus();
}
}