0e5a06ae88
Product: - Settings jump index scrolls instead of overflowing a short wide window (overflowed by 48 px at 1200x800 once Open in chat added a section). - Chat: a route to the retained workspace's active pane shows it in the same frame again;ec3c1e4cdeferred it a frame behind a post-frame callback. Tests updated to intended behaviour: - first-run walkthrough (30ba70ad): seed a device that has seen it and was offered it for the fixture server; - Output section open by default (22af093e); - chat page Back closes its own route explicitly (19b1d132); - open-chat sync (c48a1559): answer chat_open_workspace statefully; - keyed session list (0a51add9) no longer re-reads chat_sessions on open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
86 lines
2.6 KiB
Dart
86 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'settings_section.dart';
|
|
|
|
/// The Settings search field: filters the sections as the operator types.
|
|
class SettingsSearchField extends StatelessWidget {
|
|
const SettingsSearchField({
|
|
super.key,
|
|
required this.controller,
|
|
required this.onChanged,
|
|
});
|
|
|
|
final TextEditingController controller;
|
|
final ValueChanged<String> onChanged;
|
|
|
|
@override
|
|
Widget build(BuildContext context) =>
|
|
ValueListenableBuilder<TextEditingValue>(
|
|
valueListenable: controller,
|
|
builder: (context, value, _) => TextField(
|
|
key: const ValueKey<String>('settings.search'),
|
|
controller: controller,
|
|
onChanged: onChanged,
|
|
textInputAction: TextInputAction.search,
|
|
decoration: InputDecoration(
|
|
hintText: 'Search settings',
|
|
prefixIcon: const Icon(Icons.search),
|
|
suffixIcon: value.text.isEmpty
|
|
? null
|
|
: IconButton(
|
|
tooltip: 'Clear search',
|
|
icon: const Icon(Icons.close),
|
|
onPressed: () {
|
|
controller.clear();
|
|
onChanged('');
|
|
},
|
|
),
|
|
border: const OutlineInputBorder(),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
/// The wide layout's slim jump index: one link per visible section. It
|
|
/// scrolls on its own when a short window cannot fit every link, so the last
|
|
/// sections stay reachable instead of overflowing the page.
|
|
class SettingsSectionIndex extends StatelessWidget {
|
|
const SettingsSectionIndex({
|
|
super.key,
|
|
required this.sections,
|
|
required this.onJump,
|
|
});
|
|
|
|
final List<SettingsSection> sections;
|
|
final ValueChanged<String> onJump;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Semantics(
|
|
container: true,
|
|
label: 'Settings sections',
|
|
child: SingleChildScrollView(
|
|
// The page's own list owns the primary controller.
|
|
primary: false,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: <Widget>[
|
|
for (final section in sections)
|
|
TextButton(
|
|
key: ValueKey<String>('settings.index.${section.id}'),
|
|
onPressed: () => onJump(section.id),
|
|
style: TextButton.styleFrom(
|
|
alignment: AlignmentDirectional.centerStart,
|
|
),
|
|
child: Text(
|
|
section.title,
|
|
textAlign: TextAlign.start,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|