Files
pipelines/app/lib/features/templates/ui/templates_frame.dart
T
alan e34fa1050e Close the chrome gaps: content behind bars on Templates, run detail, stage page and Schedules; Search field fills the bar
- SegmentedBar.titleWidget (and ShellBar/ShellBarSpec titleWidget,
  backgroundColor): a bar's main pill can be an input in place of the title;
  Search uses it so the field fills the bar with Kind and info, capped at the
  result column width so field and results share edges on wide windows.
- Templates page/frame drop the top SafeArea again (BelowTopBar gate,
  TopBarNotices banners); Cupertino uses the grouped background.
- Settings on Cupertino in the shell publishes the grouped background so the
  bar scrim matches the page (no white band or seam).
- TopGlassStrip: the run detail header (status, actions, decision, notices)
  and the Schedules search/filter toolbar float as glass under the bar; tabs
  and lists scroll behind both.
- Stage page: stage title and Visit/Run subtitle in the bar, facts lead the
  Summary scroll, sections scroll behind the bar under floating tabs.
- Tests for content-behind-bar on each page and the title-widget bar mode;
  notes/chrome-gaps-fixes.md.
2026-10-31 04:27:35 +00:00

96 lines
2.8 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../shell/shell_bar.dart';
import '../../../ui/adaptive/host.dart';
import '../../../ui/adaptive/segmented_bar.dart';
import '../../../ui/navigation/bar_icon_button.dart';
import '../../../ui/theme/app_theme.dart';
const templatesRefreshKey = ValueKey<String>('templates-refresh');
const templatesBackKey = ValueKey<String>('templates-back');
/// The screen's native chrome.
///
/// 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,
required this.body,
required this.embedded,
required this.canGoBack,
required this.refreshing,
required this.onBack,
required this.onRefresh,
});
final Widget body;
final bool embedded;
final bool canGoBack;
final bool refreshing;
final VoidCallback onBack;
final VoidCallback onRefresh;
@override
Widget build(BuildContext 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),
],
);
}
final bar = SegmentedBar(
cupertino: cupertino,
leading: canGoBack
? SegmentedBackButton(
key: templatesBackKey,
cupertino: cupertino,
onPressed: onBack,
)
: null,
title: 'Templates',
actions: [_refreshButton()],
);
// The body reaches the top edge and scrolls behind the bar.
final page = SafeArea(top: false, bottom: false, child: body);
if (cupertino) {
return CupertinoPageScaffold(
backgroundColor: AppColors.groupedBackground,
navigationBar: bar,
child: page,
);
}
return Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: page);
}
Widget _refreshButton() => BarIconButton(
key: templatesRefreshKey,
icon: Icons.refresh,
cupertinoIcon: CupertinoIcons.refresh,
label: 'Refresh',
onPressed: refreshing ? null : onRefresh,
);
}