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
+26 -17
View File
@@ -6,11 +6,16 @@ import 'package:flutter/material.dart';
import '../features/schedules/data/schedules_repository.dart';
import '../features/schedules/ui/list/schedule_list_controller.dart';
import '../features/schedules/ui/list/schedule_list_toolbar.dart'
show ScheduleRefreshAction;
import '../features/schedules/ui/list/schedule_list_view.dart';
import '../ui/adaptive/host.dart';
import 'app_session.dart';
import 'server_endpoint.dart';
/// The Back control of the app-level Schedules page.
const schedulesPageBackKey = ValueKey<String>('schedules-page-back');
/// The saved-schedule list above Settings.
///
/// It is read-only: opening a row asks the composition to show the owning
@@ -101,30 +106,33 @@ class _SchedulesDestinationState extends State<SchedulesDestination> {
Widget _page(bool cupertino) {
final body = _body(cupertino);
// The round Back closes the page; Refresh sits in the actions pill.
final bar = SegmentedBar(
cupertino: cupertino,
leading: SegmentedBackButton(
key: schedulesPageBackKey,
cupertino: cupertino,
onPressed: widget.onBack,
),
title: 'Schedules',
actions: [
if (widget.session.everConnected)
ScheduleRefreshAction(
controller: _controller,
cupertino: cupertino,
onRefresh: () => unawaited(_controller.refresh()),
),
],
);
if (cupertino) {
return CupertinoPageScaffold(
navigationBar: SegmentedBar(
cupertino: true,
leading: CupertinoButton(
padding: EdgeInsets.zero,
onPressed: widget.onBack,
child: const Icon(CupertinoIcons.back, semanticLabel: 'Back'),
),
title: 'Schedules',
),
navigationBar: bar,
child: SafeArea(child: body),
);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: SegmentedBar(
cupertino: false,
leading: IconButton(
onPressed: widget.onBack,
icon: const Icon(Icons.arrow_back, semanticLabel: 'Back'),
),
title: 'Schedules',
),
appBar: bar,
body: SafeArea(left: false, right: false, bottom: false, child: body),
);
}
@@ -145,6 +153,7 @@ class _SchedulesDestinationState extends State<SchedulesDestination> {
if (id != null) widget.onOpenPipeline(id);
},
onRefresh: () => _controller.refresh(),
refreshInToolbar: false,
);
}
}
+83 -57
View File
@@ -1,10 +1,14 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../ui/adaptive/segmented_bar.dart';
import '../core/api_gateway.dart';
import '../features/templates/screen.dart';
import '../features/templates/ui/template_detail.dart'
show templateDetailBackKey;
import '../shell/destination.dart';
import '../shell/shell_bar.dart';
import '../ui/adaptive/host.dart';
import '../ui/adaptive/segmented_bar.dart';
import 'app_session.dart';
import 'connection_status.dart';
import 'server_endpoint.dart';
@@ -14,15 +18,17 @@ const templatesPageBackKey = ValueKey<String>('templates-page-back');
/// The Templates destination: the landed gallery over the app's shared gateway.
///
/// The gallery is rendered in embedded mode, so the shell owns navigation; this
/// destination contributes the page's one native bar (Back + Templates) and the
/// same honest connection states as the other destinations. No socket is opened
/// The gallery is rendered in embedded mode and publishes its controls to
/// this page's one segmented bar (through a [ShellBarScope] the page owns):
/// the round Back closes the page from the gallery and returns to the gallery
/// from an open template, and Refresh sits in the actions pill. The same
/// honest connection states as the other destinations. No socket is opened
/// here: [session] owns the only connection, and a template read, validate or
/// create request travels over it.
///
/// [onCreated] forwards the server-confirmed detail once, so the caller can
/// invalidate the Pipelines list. This screen never inserts a row itself.
class TemplatesDestination extends StatelessWidget {
class TemplatesDestination extends StatefulWidget {
const TemplatesDestination({
super.key,
required this.session,
@@ -42,24 +48,74 @@ class TemplatesDestination extends StatelessWidget {
/// The template detail the route names, or null for the gallery.
final String? initialKey;
@override
State<TemplatesDestination> createState() => _TemplatesDestinationState();
}
class _TemplatesDestinationState extends State<TemplatesDestination> {
final ShellBarRegistry _bar = ShellBarRegistry();
@override
void dispose() {
_bar.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
return AnimatedBuilder(
animation: session,
builder: (context, _) => _TemplatesPage(
cupertino: cupertino,
onBack: onBack,
child: _body(cupertino),
final body = ShellBarScope(
registry: _bar,
destination: AppDestination.settings,
child: AnimatedBuilder(
animation: widget.session,
builder: (context, _) => _body(cupertino),
),
);
final bar = ListenableBuilder(
listenable: _bar,
builder: (context, _) => _segmentedBar(cupertino),
);
if (cupertino) {
return CupertinoPageScaffold(
navigationBar: _BarSlot(cupertino: true, child: bar),
child: SafeArea(child: body),
);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: _BarSlot(cupertino: false, child: bar),
body: SafeArea(child: body),
);
}
SegmentedBar _segmentedBar(bool cupertino) {
final spec = _bar.specFor(AppDestination.settings);
final onDetailBack = spec?.onBack;
return SegmentedBar(
cupertino: cupertino,
leading: onDetailBack != null
? SegmentedBackButton(
key: templateDetailBackKey,
cupertino: cupertino,
onPressed: onDetailBack,
)
: SegmentedBackButton(
key: templatesPageBackKey,
cupertino: cupertino,
onPressed: widget.onBack,
),
title: spec?.title ?? 'Templates',
actions: spec?.actions ?? const [],
);
}
Widget _body(bool cupertino) {
final session = widget.session;
if (!session.everConnected) {
return ConnectionGate(
session: session,
server: server,
server: widget.server,
cupertino: cupertino,
);
}
@@ -71,8 +127,8 @@ class TemplatesDestination extends StatelessWidget {
child: TemplatesScreen(
gateway: session.gateway,
embedded: true,
onCreated: onCreated,
initialKey: initialKey,
onCreated: widget.onCreated,
initialKey: widget.initialKey,
),
),
],
@@ -80,52 +136,22 @@ class TemplatesDestination extends StatelessWidget {
}
}
/// The page's standard native bar. Back is named explicitly so it cannot be
/// confused with the gallery's own Back-to-gallery control.
class _TemplatesPage extends StatelessWidget {
const _TemplatesPage({
required this.cupertino,
required this.onBack,
required this.child,
});
/// Gives the scaffold a [SegmentedBar]'s size and obstruction while the bar
/// itself is rebuilt from the published controls.
class _BarSlot extends StatelessWidget
implements ObstructingPreferredSizeWidget {
const _BarSlot({required this.cupertino, required this.child});
final bool cupertino;
final VoidCallback onBack;
final Widget child;
@override
Widget build(BuildContext context) {
if (cupertino) {
return CupertinoPageScaffold(
navigationBar: SegmentedBar(
cupertino: true,
leading: CupertinoButton(
key: templatesPageBackKey,
padding: EdgeInsets.zero,
onPressed: onBack,
child: const Icon(
CupertinoIcons.back,
semanticLabel: 'Back to Settings',
),
),
title: 'Templates',
),
child: SafeArea(child: child),
);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: SegmentedBar(
cupertino: false,
leading: IconButton(
key: templatesPageBackKey,
tooltip: 'Back to Settings',
onPressed: onBack,
icon: const Icon(Icons.arrow_back),
),
title: 'Templates',
),
body: SafeArea(child: child),
);
}
Size get preferredSize =>
SegmentedBar(cupertino: cupertino, title: '').preferredSize;
@override
bool shouldFullyObstruct(BuildContext context) => false;
@override
Widget build(BuildContext context) => child;
}