Reserve global shortcuts for chat selection and search

This commit is contained in:
2026-11-06 17:58:12 +00:00
parent 51ee950a5b
commit f668e1eef8
12 changed files with 412 additions and 172 deletions
+8 -1
View File
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import '../../core/api_gateway.dart';
import '../../shell/shell_bar.dart';
import '../../shell/shell_search_focus.dart';
import '../../ui/adaptive/host.dart';
import '../../ui/adaptive/segmented_bar.dart';
import 'data/search_repository.dart';
@@ -44,6 +45,7 @@ class SearchScreen extends StatefulWidget {
class _SearchScreenState extends State<SearchScreen> {
late final OmniSearchController _controller;
late final TextEditingController _text;
final FocusNode _focus = FocusNode(debugLabel: 'omni-search');
@override
void initState() {
@@ -76,11 +78,15 @@ class _SearchScreenState extends State<SearchScreen> {
_controller.removeListener(_onState);
_controller.dispose();
_text.dispose();
_focus.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
Widget build(BuildContext context) =>
ShellSearchShortcut(onFocus: _focus.requestFocus, child: _build(context));
Widget _build(BuildContext context) {
// Follow the actual host app class: Cupertino only under an explicit
// Cupertino host, Material on every platform otherwise.
final cupertino = widget.cupertino ?? usesCupertinoHost(context);
@@ -112,6 +118,7 @@ class _SearchScreenState extends State<SearchScreen> {
}
Widget _controls(bool cupertino) => SearchBarControls(
focusNode: _focus,
cupertino: cupertino,
text: _text,
kind: _controller.parsed.kind,
@@ -29,6 +29,7 @@ class SearchBarControls extends StatelessWidget {
required this.onCleared,
required this.onKind,
this.autofocus = true,
this.focusNode,
});
final bool cupertino;
@@ -39,6 +40,7 @@ class SearchBarControls extends StatelessWidget {
final VoidCallback onCleared;
final ValueChanged<SearchKind> onKind;
final bool autofocus;
final FocusNode? focusNode;
@override
// The pill grows with the bar, so the field and the results share both
@@ -55,6 +57,7 @@ class SearchBarControls extends StatelessWidget {
clearKey: const ValueKey('search.clear'),
controller: text,
autofocus: autofocus,
focusNode: focusNode,
inBar: true,
cupertino: cupertino,
placeholder: 'Search pipelines, runs, artifacts and chats',