Search field in the bar, refresh and Back as bar pieces, even Cupertino actions (F8/F28/F10/F11/F20/F1)

- Search: field, compact Kind menu and syntax help in the bar's actions pill;
  bounds shown only when truncated; rows with bold title, kind tag and one
  muted line; results run behind the bar in a start-aligned 840 column.
- AppSearchField: one search field per platform (Search, Schedules, Runs filter).
- BarIconButton: whole 44pt/48dp bar actions; Runs, bell and Pipelines icons
  use the same 44pt targets on Cupertino.
- Templates and Schedules pages put Refresh in the bar and use the shared
  round SegmentedBackButton; Templates shows one Back at a time.
- PipelineBackButton is the round segmented Back.
- notes/pages-fixes.md records the batch, tests and evidence.
This commit is contained in:
2026-10-31 03:31:25 +00:00
parent 3ec580c2d9
commit 3704d98d4d
27 changed files with 1380 additions and 488 deletions
+116
View File
@@ -0,0 +1,116 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../adaptive/host.dart';
/// The app's one search field per platform.
///
/// Cupertino uses the stock [CupertinoSearchTextField]. Material uses a
/// [TextField] shaped like it: a stadium with a leading search icon, a clear
/// button once there is text, no underline and no elevation. On a page it is
/// filled with the host's raised surface; [inBar] drops the fill (and the
/// Cupertino grey) because a bar's glass pill is already its background.
class AppSearchField extends StatelessWidget {
const AppSearchField({
super.key,
required this.controller,
required this.placeholder,
this.fieldKey,
this.clearKey,
this.onChanged,
this.onSubmitted,
this.onCleared,
this.autofocus = false,
this.focusNode,
this.inBar = false,
this.cupertino,
});
final TextEditingController controller;
final String placeholder;
/// The key of the text field itself, for finders.
final Key? fieldKey;
/// The key of Material's clear button.
final Key? clearKey;
final ValueChanged<String>? onChanged;
final ValueChanged<String>? onSubmitted;
/// Runs after the clear control emptied the field; without it the clear
/// reports an empty [onChanged].
final VoidCallback? onCleared;
final bool autofocus;
final FocusNode? focusNode;
final bool inBar;
final bool? cupertino;
void _clear() {
controller.clear();
if (onCleared case final cleared?) {
cleared();
} else {
onChanged?.call('');
}
}
@override
Widget build(BuildContext context) {
if (cupertino ?? usesCupertinoHost(context)) {
return CupertinoSearchTextField(
key: fieldKey,
controller: controller,
focusNode: focusNode,
autofocus: autofocus,
placeholder: placeholder,
backgroundColor: inBar ? const Color(0x00000000) : null,
onChanged: onChanged,
onSubmitted: onSubmitted,
onSuffixTap: _clear,
);
}
final scheme = Theme.of(context).colorScheme;
const radius = BorderRadius.all(Radius.circular(28));
const stadium = OutlineInputBorder(
borderRadius: radius,
borderSide: BorderSide.none,
);
return ValueListenableBuilder<TextEditingValue>(
valueListenable: controller,
builder: (context, value, _) => TextField(
key: fieldKey,
controller: controller,
focusNode: focusNode,
autofocus: autofocus,
textInputAction: TextInputAction.search,
onChanged: onChanged,
onSubmitted: onSubmitted,
decoration: InputDecoration(
hintText: placeholder,
prefixIcon: const Icon(Icons.search),
suffixIcon: value.text.isEmpty
? null
: IconButton(
key: clearKey,
tooltip: 'Clear search',
onPressed: _clear,
icon: const Icon(Icons.close),
),
filled: !inBar,
fillColor: scheme.surfaceContainerHigh,
isDense: true,
border: stadium,
enabledBorder: stadium,
// In the bar the pill is the field's outline; on a page the focused
// field shows the host's focus ring.
focusedBorder: inBar
? stadium
: OutlineInputBorder(
borderRadius: radius,
borderSide: BorderSide(color: scheme.primary, width: 2),
),
),
),
);
}
}
@@ -0,0 +1,87 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../adaptive/host.dart';
/// One icon action of a segmented bar's actions pill (or any toolbar row).
///
/// Every action gets the platform's whole touch target and no extra padding,
/// so a row of them is evenly spaced and the last one never touches the
/// pill's edge: Material's [IconButton] (48dp, with its tooltip), Cupertino's
/// [CupertinoButton] at [kMinInteractiveDimensionCupertino] (44pt) square.
/// While [busy] the action shows the platform's activity indicator in the
/// same box and takes no taps.
class BarIconButton extends StatelessWidget {
const BarIconButton({
super.key,
required this.icon,
required this.cupertinoIcon,
required this.label,
required this.onPressed,
this.selected = false,
this.busy = false,
this.busyLabel,
this.cupertino,
});
final IconData icon;
final IconData cupertinoIcon;
/// The tooltip and accessible name.
final String label;
final VoidCallback? onPressed;
/// Material shows a toggled-on action as selected.
final bool selected;
final bool busy;
/// The accessible name while [busy]; defaults to [label].
final String? busyLabel;
/// The control family; defaults to the host's.
final bool? cupertino;
@override
Widget build(BuildContext context) {
final native = cupertino ?? usesCupertinoHost(context);
if (busy) {
final side = native
? kMinInteractiveDimensionCupertino
: kMinInteractiveDimension;
return Semantics(
label: busyLabel ?? label,
liveRegion: true,
child: SizedBox.square(
dimension: side,
child: Center(
child: native
? const CupertinoActivityIndicator()
: const SizedBox.square(
dimension: 20,
child: CircularProgressIndicator(strokeWidth: 2),
),
),
),
);
}
if (native) {
return Semantics(
button: true,
label: label,
excludeSemantics: true,
child: CupertinoButton(
padding: EdgeInsets.zero,
minimumSize: const Size.square(kMinInteractiveDimensionCupertino),
onPressed: onPressed,
child: Icon(cupertinoIcon),
),
);
}
return IconButton(
tooltip: label,
isSelected: selected,
onPressed: onPressed,
icon: Icon(icon),
);
}
}