c6c6dcfe18
- Top-bar clearance helpers (withTopBarClearance, withBarClearance, SliverTopBarClearance, BelowTopBar, TopBarNotices); shell, DetailPane and the runs/pipelines/templates/artifacts/stage definition/filter/usage pages drop their top SafeArea and pad their own lists, pinned headers pin at the inset. - Wide windows: the shell bar narrows to the list pane (ShellPaneSplit) and the open item's bar shares its row; item tabs float at the pane's top (PageTabsEdge) instead of stacking on the shell's tab bar; the floating tab pill no longer swells over leftover media padding. - Pipeline detail is a DetailPane on wide too; Run/Runs move from FABs into the bar's actions; name and identity live in the title pill. - Run detail title pill shows the real title with Run N, pipeline and version (the pill links to the pipeline); the body keeps only status, actions and notices; standalone detail draws the same segmented bar. - One Runs tab badge: attention outranks running. - Tests for content-behind-bar padding and the no-stacking wide layout; notes/app-chrome-fixes.md.
116 lines
3.4 KiB
Dart
116 lines
3.4 KiB
Dart
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';
|
|
|
|
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
|
|
/// puts Refresh in the host's bar through `ShellBar` (or, without one,
|
|
/// keeps it at the top of 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) {
|
|
if (embedded) return _embedded(context);
|
|
return usesCupertinoHost(context)
|
|
? _cupertino(context)
|
|
: _material(context);
|
|
}
|
|
|
|
Widget _embedded(BuildContext context) {
|
|
// A host page with a bar takes Refresh into it; the body then reaches
|
|
// its top edge and scrolls behind that bar.
|
|
if (ShellBar.available(context)) {
|
|
return ShellBar(actions: [_refreshButton(context)], child: body);
|
|
}
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Align(
|
|
alignment: AlignmentDirectional.centerEnd,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
child: _refreshButton(context),
|
|
),
|
|
),
|
|
Expanded(child: body),
|
|
],
|
|
);
|
|
}
|
|
|
|
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(top: false, bottom: false, child: body),
|
|
);
|
|
}
|
|
|
|
Widget _material(BuildContext context) {
|
|
return Scaffold(
|
|
extendBodyBehindAppBar: true,
|
|
appBar: SegmentedBar(
|
|
cupertino: false,
|
|
title: 'Templates',
|
|
leading: canGoBack
|
|
? BackButton(key: templatesBackKey, onPressed: onBack)
|
|
: null,
|
|
actions: [_refreshButton(context)],
|
|
),
|
|
body: SafeArea(top: false, bottom: false, 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),
|
|
);
|
|
}
|
|
}
|