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:
@@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/adaptive/segmented_bar.dart';
|
||||
import '../domain/template_entry.dart';
|
||||
|
||||
/// Browser wording for the gallery and the selected template, kept verbatim.
|
||||
@@ -112,20 +113,21 @@ class TemplateDetail extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _backRow(BuildContext context, bool cupertino) {
|
||||
final back = cupertino
|
||||
? CupertinoButton(
|
||||
key: templateDetailBackKey,
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onBack,
|
||||
child: const Icon(CupertinoIcons.back, semanticLabel: 'Back'),
|
||||
)
|
||||
: BackButton(key: templateDetailBackKey, onPressed: onBack);
|
||||
// Only without a bar above: the same round Back the bar would show.
|
||||
final back = SegmentedPill(
|
||||
cupertino: cupertino,
|
||||
child: SegmentedBackButton(
|
||||
key: templateDetailBackKey,
|
||||
cupertino: cupertino,
|
||||
onPressed: onBack,
|
||||
),
|
||||
);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(4, 4, 16, 0),
|
||||
padding: const EdgeInsets.fromLTRB(12, 8, 16, 0),
|
||||
child: Row(
|
||||
children: [
|
||||
back,
|
||||
const SizedBox(width: 4),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text('Templates', style: templateSectionStyle(context)),
|
||||
),
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/segmented_bar.dart';
|
||||
import '../../../shell/shell_bar.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/adaptive/segmented_bar.dart';
|
||||
import '../../../ui/navigation/bar_icon_button.dart';
|
||||
|
||||
const templatesRefreshKey = ValueKey<String>('templates-refresh');
|
||||
const templatesBackKey = ValueKey<String>('templates-back');
|
||||
|
||||
/// The screen's native chrome.
|
||||
///
|
||||
/// Standalone use keeps the host's own app bar with Back and Refresh. A shell
|
||||
/// that already owns navigation passes [embedded], which drops the bar and
|
||||
/// keeps Refresh at the top of the body.
|
||||
/// Standalone use draws the segmented bar: the round Back (back to the
|
||||
/// gallery from a template, otherwise the route's own) and Refresh in the
|
||||
/// actions pill. A page that already owns a bar passes [embedded]; the
|
||||
/// screen then publishes its Back and Refresh to that bar through
|
||||
/// [ShellBar]. Only with no bar above at all does Refresh sit atop the body.
|
||||
class TemplatesFrame extends StatelessWidget {
|
||||
const TemplatesFrame({
|
||||
super.key,
|
||||
@@ -32,77 +36,60 @@ class TemplatesFrame extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (embedded) return _embedded(context);
|
||||
return usesCupertinoHost(context)
|
||||
? _cupertino(context)
|
||||
: _material(context);
|
||||
}
|
||||
|
||||
Widget _embedded(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: _refreshButton(context),
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
if (embedded) {
|
||||
if (ShellBar.available(context)) {
|
||||
return ShellBar(
|
||||
title: 'Templates',
|
||||
onBack: canGoBack ? onBack : null,
|
||||
actions: [_refreshButton()],
|
||||
child: body,
|
||||
);
|
||||
}
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: _refreshButton(),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(child: body),
|
||||
],
|
||||
Expanded(child: body),
|
||||
],
|
||||
);
|
||||
}
|
||||
final bar = SegmentedBar(
|
||||
cupertino: cupertino,
|
||||
leading: canGoBack
|
||||
? SegmentedBackButton(
|
||||
key: templatesBackKey,
|
||||
cupertino: cupertino,
|
||||
onPressed: onBack,
|
||||
)
|
||||
: null,
|
||||
title: 'Templates',
|
||||
actions: [_refreshButton()],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _cupertino(BuildContext context) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: SegmentedBar(
|
||||
cupertino: true,
|
||||
leading: canGoBack
|
||||
? CupertinoButton(
|
||||
key: templatesBackKey,
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onBack,
|
||||
child: const Icon(CupertinoIcons.back, semanticLabel: 'Back'),
|
||||
)
|
||||
: null,
|
||||
title: 'Templates',
|
||||
actions: [_refreshButton(context)],
|
||||
),
|
||||
child: SafeArea(child: body),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _material(BuildContext context) {
|
||||
if (cupertino) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: bar,
|
||||
child: SafeArea(child: body),
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: SegmentedBar(
|
||||
cupertino: false,
|
||||
title: 'Templates',
|
||||
leading: canGoBack
|
||||
? BackButton(key: templatesBackKey, onPressed: onBack)
|
||||
: null,
|
||||
actions: [_refreshButton(context)],
|
||||
),
|
||||
appBar: bar,
|
||||
body: SafeArea(child: body),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _refreshButton(BuildContext context) {
|
||||
final onPressed = refreshing ? null : onRefresh;
|
||||
if (usesCupertinoHost(context)) {
|
||||
return CupertinoButton(
|
||||
key: templatesRefreshKey,
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onPressed,
|
||||
child: const Icon(CupertinoIcons.refresh, semanticLabel: 'Refresh'),
|
||||
);
|
||||
}
|
||||
return IconButton(
|
||||
key: templatesRefreshKey,
|
||||
tooltip: 'Refresh',
|
||||
onPressed: onPressed,
|
||||
icon: const Icon(Icons.refresh),
|
||||
);
|
||||
}
|
||||
Widget _refreshButton() => BarIconButton(
|
||||
key: templatesRefreshKey,
|
||||
icon: Icons.refresh,
|
||||
cupertinoIcon: CupertinoIcons.refresh,
|
||||
label: 'Refresh',
|
||||
onPressed: refreshing ? null : onRefresh,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user