Files
pipelines/app/lib/features/settings/settings_page_chrome.dart
T
alan 7d2c3412a1 Paper design: warm paper, serif reading text and a typeset transcript
Adds the Paper design and generalises design tokens (transcript, composer,
selected-row styles, reading type, panel fill, chat colour saturation).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 18:00:07 +00:00

91 lines
2.8 KiB
Dart

import 'package:flutter/material.dart';
import '../../ui/theme/app_design_tokens.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: OutlineInputBorder(
borderRadius: AppDesignTokens.of(
context,
).corners(const BorderRadius.all(Radius.circular(4))),
),
),
),
);
}
/// 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,
),
),
],
),
),
);
}