Merge branch 'worktree-agent-a099cbf073f6e9e51' into integrate/shell-wide
# Conflicts: # app/lib/features/runs/ui/run_detail_tabs.dart
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import '../../shell/destination.dart';
|
||||
import '../../shell/detail_page.dart';
|
||||
import '../../shell/empty_detail_pane.dart';
|
||||
import '../../shell/list_detail.dart';
|
||||
import '../../ui/adaptive/host.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -257,7 +257,10 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
return ListDetailPanes(
|
||||
list: list,
|
||||
detail: selected == null
|
||||
? const _NoChatSelected()
|
||||
? const EmptyDetailPane(
|
||||
destination: AppDestination.chat,
|
||||
message: 'Select a chat to open it here.',
|
||||
)
|
||||
: DetailPane(
|
||||
key: const ValueKey('chat-detail-pane'),
|
||||
destination: AppDestination.chat,
|
||||
@@ -267,27 +270,3 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The open-chat pane before any chat is chosen.
|
||||
class _NoChatSelected extends StatelessWidget {
|
||||
const _NoChatSelected();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
cupertino
|
||||
? CupertinoIcons.chat_bubble_2
|
||||
: Icons.chat_bubble_outline,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const Text('Select a chat to open it here.'),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,11 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../shell/destination.dart';
|
||||
import '../../../shell/empty_detail_pane.dart';
|
||||
import '../../../shell/shell_bar.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/layout/reading_width.dart';
|
||||
import '../../graph/domain/graph_definition.dart';
|
||||
import '../../graph/widgets/stage_definition_view.dart';
|
||||
import '../pipeline_models.dart';
|
||||
@@ -124,8 +127,8 @@ class _PipelineDetailPanelState extends State<PipelineDetailPanel> {
|
||||
final panel = LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final headerLimit = _headerLimit(constraints);
|
||||
// The tabs float over the tab body: at the bottom on a phone page,
|
||||
// under the pane's top bar beside a list (never on the shell's bar).
|
||||
// The tabs float over the bottom of the tab body, on a phone page
|
||||
// and beside a list alike (the shell's bar stays over the list).
|
||||
final edge = PageTabsEdge.of(context);
|
||||
final tabs = PipelineDetailTabs(
|
||||
selected: _tab,
|
||||
@@ -302,16 +305,26 @@ class _PipelineDetailPanelState extends State<PipelineDetailPanel> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _scrolling(Widget child) =>
|
||||
ListView(children: [child, const SizedBox(height: 24)]);
|
||||
/// A scrolling reading body: the whole pane scrolls, the content keeps
|
||||
/// [kReadingMaxWidth] from the leading edge.
|
||||
Widget _scrolling(Widget child) => ListView(
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional.topStart,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: kReadingMaxWidth),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
);
|
||||
|
||||
Widget _withoutDetail(BuildContext context) {
|
||||
if (!_controller.hasSelection) {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Text('Select a pipeline.', style: pipelineMutedStyle(context)),
|
||||
),
|
||||
return const EmptyDetailPane(
|
||||
destination: AppDestination.pipelines,
|
||||
message: 'Select a pipeline to open it here.',
|
||||
);
|
||||
}
|
||||
return ListView(
|
||||
|
||||
@@ -7,8 +7,9 @@ import 'pipeline_detail_tab.dart';
|
||||
|
||||
export 'pipeline_detail_tab.dart';
|
||||
|
||||
/// The pipeline detail's tabs: the app's floating glass tab bar, full width on
|
||||
/// a phone page; beside a list, sized to its tabs under the pane's top bar.
|
||||
/// The pipeline detail's tabs: the app's floating glass tab bar at the bottom,
|
||||
/// full width on a phone page; beside a list, sized to its tabs at the bottom
|
||||
/// of the detail pane (the shell's tab bar stays over the list pane).
|
||||
///
|
||||
/// Float it over the tab body with `FloatingBarOverlay`. The whole bar is
|
||||
/// keyed `pipeline-detail-tabs`, each tab `pipeline-detail-tab-<name>`.
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:flutter/widgets.dart';
|
||||
import '../../core/api_gateway.dart';
|
||||
import '../../shell/destination.dart';
|
||||
import '../../shell/detail_page.dart';
|
||||
import '../../shell/empty_detail_pane.dart';
|
||||
import '../../shell/list_detail.dart';
|
||||
import '../../ui/adaptive/host.dart';
|
||||
import '../attention/notify/notification_controller.dart';
|
||||
@@ -262,15 +263,15 @@ class _RunsScreenState extends State<RunsScreen> {
|
||||
animation: controller,
|
||||
builder: (context, _) => ContentWidth(
|
||||
child: RunsList(
|
||||
active: narrow ? !selected : true,
|
||||
controller: controller,
|
||||
onSelected: _select,
|
||||
syncToken: widget.syncToken,
|
||||
attentionStore: widget.attentionStore,
|
||||
attentionNow: widget.attentionNow,
|
||||
notifications: widget.notifications,
|
||||
attention: widget.attention,
|
||||
),
|
||||
active: narrow ? !selected : true,
|
||||
controller: controller,
|
||||
onSelected: _select,
|
||||
syncToken: widget.syncToken,
|
||||
attentionStore: widget.attentionStore,
|
||||
attentionNow: widget.attentionNow,
|
||||
notifications: widget.notifications,
|
||||
attention: widget.attention,
|
||||
),
|
||||
),
|
||||
);
|
||||
if (narrow) return list;
|
||||
@@ -283,7 +284,10 @@ class _RunsScreenState extends State<RunsScreen> {
|
||||
implyBack: false,
|
||||
builder: (_) => _detail(_back),
|
||||
)
|
||||
: const Center(child: Text('Select a run to open it here.')),
|
||||
: const EmptyDetailPane(
|
||||
destination: AppDestination.runs,
|
||||
message: 'Select a run to open it here.',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ const List<RunDetailTab> renderedRunDetailTabs = [
|
||||
];
|
||||
|
||||
/// The run detail's tabs: the app's floating glass tab bar, full width at the
|
||||
/// bottom of a phone page; beside a list, under the pane's top bar (sized to
|
||||
/// its tabs) so it never stacks on the shell's own tab bar.
|
||||
/// bottom of a phone page; beside a list, sized to its tabs at the bottom of
|
||||
/// the detail pane (the shell's own tab bar stays over the list pane).
|
||||
///
|
||||
/// Float it over the tab body with `FloatingBarOverlay` at the same [edge];
|
||||
/// every tab is always visible, so a tab selected by the Graph is shown
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/adaptive/segmented_bar.dart';
|
||||
import '../../../ui/adaptive/top_glass_strip.dart';
|
||||
import '../../../ui/layout/reading_width.dart';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -376,7 +377,15 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
|
||||
);
|
||||
final body = KeyedSubtree(
|
||||
key: ValueKey('run-detail-body-${widget.run['id']}'),
|
||||
child: _body(shown),
|
||||
// Reading tabs keep a readable width on a wide window; canvases,
|
||||
// viewers and the gallery keep the whole pane.
|
||||
child: switch (shown) {
|
||||
RunDetailTab.summary ||
|
||||
RunDetailTab.input ||
|
||||
RunDetailTab.output ||
|
||||
RunDetailTab.timeline => ReadingWidth(child: _body(shown)),
|
||||
_ => _body(shown),
|
||||
},
|
||||
);
|
||||
if (edge == FloatingBarEdge.top &&
|
||||
constraints.maxWidth >= kRunDetailWideChromeMinWidth) {
|
||||
@@ -396,7 +405,7 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
|
||||
// The header (status, actions, notices) is a glass strip floating
|
||||
// just under the top bar, so every tab scrolls behind both and pads
|
||||
// its first item clear of them at rest. Below it, the tabs float over
|
||||
// the tab, at its bottom on a page or at its top beside a list, and
|
||||
// the bottom of the tab (on a page and beside a list alike), and
|
||||
// the tab learns their height as its padding on that edge too. Every
|
||||
// tab gets the whole height: the scrolling tabs own their content and
|
||||
// the Graph tab fills the slot, so its canvas is never asked for an
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/layout/reading_width.dart';
|
||||
import 'run_detail_content.dart';
|
||||
import 'run_detail_visit_facts_view.dart';
|
||||
import 'run_detail_visit_sections.dart';
|
||||
@@ -72,22 +73,31 @@ class _RunVisitPaneState extends State<RunVisitPane> {
|
||||
selected: _section,
|
||||
onSelected: (section) => setState(() => _section = section),
|
||||
),
|
||||
child: runVisitSectionBody(
|
||||
section: _section,
|
||||
run: widget.run,
|
||||
step: widget.step,
|
||||
visitIndex: widget.visitIndex,
|
||||
stageKey: widget.visit.stage,
|
||||
runSteps: widget.runSteps,
|
||||
gateway: widget.gateway,
|
||||
onRunChanged: widget.onRunChanged,
|
||||
configuredEndpoint: widget.configuredEndpoint,
|
||||
cupertino: widget.cupertino,
|
||||
facts: RunVisitFactsView(step: widget.step),
|
||||
// Reading sections keep a readable width on a wide window; the
|
||||
// gallery and the changes viewer keep the whole page.
|
||||
child: _capped(
|
||||
runVisitSectionBody(
|
||||
section: _section,
|
||||
run: widget.run,
|
||||
step: widget.step,
|
||||
visitIndex: widget.visitIndex,
|
||||
stageKey: widget.visit.stage,
|
||||
runSteps: widget.runSteps,
|
||||
gateway: widget.gateway,
|
||||
onRunChanged: widget.onRunChanged,
|
||||
configuredEndpoint: widget.configuredEndpoint,
|
||||
cupertino: widget.cupertino,
|
||||
facts: RunVisitFactsView(step: widget.step),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _capped(Widget body) => switch (_section) {
|
||||
RunVisitSection.artifacts || RunVisitSection.changes => body,
|
||||
_ => ReadingWidth(child: body),
|
||||
};
|
||||
}
|
||||
|
||||
/// The page bar's subtitle for a recorded visit: its per-stage visit, then the run
|
||||
|
||||
@@ -9,6 +9,10 @@ const scheduleSearchFieldKey = ValueKey<String>('schedule-search-field');
|
||||
const scheduleFilterKey = ValueKey<String>('schedule-filter');
|
||||
const scheduleRefreshKey = ValueKey<String>('schedule-refresh');
|
||||
|
||||
/// The strip width (inside its padding) from which the field, filter and
|
||||
/// count share one row.
|
||||
const double kScheduleToolbarRowWidth = 520;
|
||||
|
||||
/// Refresh for the list, as a bar action: the platform's activity indicator
|
||||
/// in the same touch target while a read is in flight.
|
||||
class ScheduleRefreshAction extends StatelessWidget {
|
||||
@@ -36,9 +40,12 @@ class ScheduleRefreshAction extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// Search and the enabled filter, and the count; the refresh control too when
|
||||
/// no bar above carries it ([onRefresh] null leaves it to the bar). The list
|
||||
/// floats it as a glass strip under the page's bar.
|
||||
/// Search and the enabled filter, with the count as a muted label; the
|
||||
/// refresh control too when no bar above carries it ([onRefresh] null leaves
|
||||
/// it to the bar). The list floats it as a glass strip under the page's bar.
|
||||
///
|
||||
/// On a strip at least [kScheduleToolbarRowWidth] wide everything shares one
|
||||
/// row; narrower, the field takes its own row above the filter and count.
|
||||
class ScheduleListToolbar extends StatelessWidget {
|
||||
const ScheduleListToolbar({
|
||||
super.key,
|
||||
@@ -55,57 +62,60 @@ class ScheduleListToolbar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
|
||||
child: _search(context),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 480),
|
||||
child: _filter(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (onRefresh case final refresh?) ...[
|
||||
const SizedBox(width: 8),
|
||||
ScheduleRefreshAction(
|
||||
controller: controller,
|
||||
cupertino: cupertino,
|
||||
onRefresh: refresh,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
if (controller.hasLoaded)
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(12, 8, 12, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(controller.countLabel, style: _metaStyle(context)),
|
||||
Text(
|
||||
'Saved run configurations, not pipeline definitions.',
|
||||
style: _metaStyle(context),
|
||||
),
|
||||
],
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final refresh = switch (onRefresh) {
|
||||
final refresh? => ScheduleRefreshAction(
|
||||
controller: controller,
|
||||
cupertino: cupertino,
|
||||
onRefresh: refresh,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
null => null,
|
||||
};
|
||||
if (constraints.maxWidth >= kScheduleToolbarRowWidth) {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(child: _search(context)),
|
||||
const SizedBox(width: 12),
|
||||
_filter(context),
|
||||
const SizedBox(width: 12),
|
||||
Flexible(child: _count(context)),
|
||||
if (refresh != null) ...[const SizedBox(width: 8), refresh],
|
||||
],
|
||||
);
|
||||
}
|
||||
// Narrow: the count follows the filter, and wraps under it when
|
||||
// large text leaves no room beside it.
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_search(context),
|
||||
const SizedBox(height: 8),
|
||||
Wrap(
|
||||
spacing: 12,
|
||||
runSpacing: 8,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [_filter(context), _count(context), ?refresh],
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// The count, muted; empty space until the first read lands so the
|
||||
/// strip keeps its size.
|
||||
Widget _count(BuildContext context) => Text(
|
||||
controller.hasLoaded ? controller.countLabel : '',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: _metaStyle(context),
|
||||
);
|
||||
|
||||
Widget _search(BuildContext context) => AppSearchField(
|
||||
fieldKey: scheduleSearchFieldKey,
|
||||
controller: searchController,
|
||||
@@ -150,10 +160,11 @@ class ScheduleListToolbar extends StatelessWidget {
|
||||
}
|
||||
|
||||
TextStyle? _metaStyle(BuildContext context) => cupertino
|
||||
? CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith(
|
||||
? CupertinoTheme.of(context).textTheme.textStyle.copyWith(
|
||||
fontSize: 15,
|
||||
color: CupertinoColors.secondaryLabel.resolveFrom(context),
|
||||
)
|
||||
: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,9 +13,13 @@ const scheduleListKey = ValueKey<String>('schedule-list');
|
||||
const scheduleRetryKey = ValueKey<String>('schedule-retry');
|
||||
const scheduleToolbarKey = ValueKey<String>('schedule-toolbar');
|
||||
|
||||
/// The widest the search and filter strip grows on a wide window.
|
||||
/// The widest the search and filter strip grows on a wide window. The rows
|
||||
/// share its width, so a row's time ends under the strip's trailing edge.
|
||||
const double kScheduleToolbarMaxWidth = 720;
|
||||
|
||||
/// The widest a row grows: the strip plus its 12px leading inset.
|
||||
const double kScheduleListMaxWidth = kScheduleToolbarMaxWidth + 12;
|
||||
|
||||
/// Platform-adaptive list body. It owns no navigation chrome; the shell frames
|
||||
/// it as the Schedules destination.
|
||||
///
|
||||
@@ -74,7 +78,12 @@ class SchedulesListView extends StatelessWidget {
|
||||
return BelowTopBar(child: _loadingState(context));
|
||||
}
|
||||
if (controller.schedules.isEmpty) {
|
||||
return BelowTopBar(child: _emptyState('No schedules yet.'));
|
||||
return BelowTopBar(
|
||||
child: _emptyState(
|
||||
'No schedules yet.',
|
||||
detail: 'Saved run configurations, not pipeline definitions.',
|
||||
),
|
||||
);
|
||||
}
|
||||
final content = controller.visibleSchedules.isEmpty
|
||||
? BelowTopBar(child: _emptyState(controller.emptyMessage))
|
||||
@@ -100,14 +109,20 @@ class SchedulesListView extends StatelessWidget {
|
||||
itemCount: schedules.length,
|
||||
itemBuilder: (context, index) {
|
||||
final schedule = schedules[index];
|
||||
return ScheduleListRow(
|
||||
key: ValueKey<String>(
|
||||
'schedule-row-$index-${schedule.id ?? 'unknown'}',
|
||||
return Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: kScheduleListMaxWidth),
|
||||
child: ScheduleListRow(
|
||||
key: ValueKey<String>(
|
||||
'schedule-row-$index-${schedule.id ?? 'unknown'}',
|
||||
),
|
||||
schedule: schedule,
|
||||
cupertino: cupertino,
|
||||
divider: index < schedules.length - 1,
|
||||
onOpen: () => onOpen(schedule),
|
||||
),
|
||||
),
|
||||
schedule: schedule,
|
||||
cupertino: cupertino,
|
||||
divider: index < schedules.length - 1,
|
||||
onOpen: () => onOpen(schedule),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -132,11 +147,28 @@ class SchedulesListView extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _emptyState(String message) {
|
||||
Widget _emptyState(String message, {String? detail}) {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Text(message, textAlign: TextAlign.center),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(message, textAlign: TextAlign.center),
|
||||
if (detail != null)
|
||||
Builder(
|
||||
builder: (context) => Text(
|
||||
detail,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -143,38 +143,56 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
// it, learning the bar's height as its bottom media padding. Neither
|
||||
// scaffold's structure depends on the width, so resizing never
|
||||
// remounts a destination.
|
||||
final bar = FloatingDestinationBar(
|
||||
cupertino: widget.cupertino,
|
||||
currentIndex: index,
|
||||
onTap: (value) => _select(AppDestination.values[value]),
|
||||
items: _destinationItems(),
|
||||
//
|
||||
// While the tab shows its list beside an open item, the bar floats
|
||||
// over the list pane only (judging its placement on that width), so
|
||||
// it never covers the item or stacks on the item's own composer.
|
||||
final split = _bar.split(_selected);
|
||||
final bar = ListPaneWidth(
|
||||
split: split,
|
||||
alignment: AlignmentDirectional.bottomStart,
|
||||
child: FloatingDestinationBar(
|
||||
cupertino: widget.cupertino,
|
||||
currentIndex: index,
|
||||
onTap: (value) => _select(AppDestination.values[value]),
|
||||
items: _destinationItems(),
|
||||
),
|
||||
);
|
||||
// Destinations reach the top edge and scroll behind the floating top
|
||||
// bar too: each learns the bar's height as its top media padding and
|
||||
// pads its own lists by it (see withTopBarClearance).
|
||||
final topBar = _ListPaneBar(
|
||||
split: _bar.split(_selected),
|
||||
split: split,
|
||||
bar: _segmentedBar(spec, details.label),
|
||||
);
|
||||
// The scaffolds below swap the system insets for their bars'
|
||||
// heights; panes beside a list read the real ones from here.
|
||||
final system = MediaQuery.paddingOf(context);
|
||||
if (widget.cupertino) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: topBar,
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: FloatingBarOverlay(
|
||||
bar: bar,
|
||||
child: _destinationStack(contents, index),
|
||||
return ShellSystemInsets(
|
||||
padding: system,
|
||||
child: CupertinoPageScaffold(
|
||||
navigationBar: topBar,
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: FloatingBarOverlay(
|
||||
bar: bar,
|
||||
child: _destinationStack(contents, index),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: topBar,
|
||||
body: _destinationStack(contents, index),
|
||||
extendBody: true,
|
||||
bottomNavigationBar: bar,
|
||||
return ShellSystemInsets(
|
||||
padding: system,
|
||||
child: Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: topBar,
|
||||
body: _destinationStack(contents, index),
|
||||
extendBody: true,
|
||||
bottomNavigationBar: bar,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -277,19 +295,9 @@ class _ListPaneBar extends StatelessWidget
|
||||
bar.shouldFullyObstruct(context);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final width = split
|
||||
? listDetailListWidth(
|
||||
MediaQuery.sizeOf(context).width,
|
||||
constraints.maxWidth,
|
||||
)
|
||||
: constraints.maxWidth;
|
||||
return Align(
|
||||
alignment: AlignmentDirectional.topStart,
|
||||
heightFactor: 1,
|
||||
child: SizedBox(width: width, child: bar),
|
||||
);
|
||||
},
|
||||
Widget build(BuildContext context) => ListPaneWidth(
|
||||
split: split,
|
||||
alignment: AlignmentDirectional.topStart,
|
||||
child: bar,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../ui/adaptive/host.dart';
|
||||
import 'destination.dart';
|
||||
|
||||
/// The detail pane beside a list before anything is chosen: the
|
||||
/// destination's own icon above one short muted line, centred. One look for
|
||||
/// Runs, Chat and Pipelines.
|
||||
class EmptyDetailPane extends StatelessWidget {
|
||||
const EmptyDetailPane({
|
||||
super.key,
|
||||
required this.destination,
|
||||
required this.message,
|
||||
});
|
||||
|
||||
final AppDestination destination;
|
||||
final String message;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final details = destinationDetails(destination);
|
||||
final color = cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
cupertino ? details.cupertinoIcon : details.icon,
|
||||
size: 32,
|
||||
color: color,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
message,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: color),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -36,14 +36,75 @@ double listDetailBodyWidth(double window, double available) {
|
||||
double listDetailListWidth(double window, double available) =>
|
||||
math.max(0, available - 1 - listDetailBodyWidth(window, available));
|
||||
|
||||
/// The system's own insets (status bar, navigation bar) as the shell saw
|
||||
/// them, before its scaffold replaced them with its bars' heights.
|
||||
///
|
||||
/// A Material [Scaffold] with an app bar and a bottom bar removes the top and
|
||||
/// bottom padding *and* view padding from its body, so a pane beside the list
|
||||
/// cannot recover the status-bar inset from its own [MediaQuery]. The shell
|
||||
/// publishes the insets here; outside a shell the view padding stands in.
|
||||
class ShellSystemInsets extends InheritedWidget {
|
||||
const ShellSystemInsets({
|
||||
super.key,
|
||||
required this.padding,
|
||||
required super.child,
|
||||
});
|
||||
|
||||
final EdgeInsets padding;
|
||||
|
||||
static EdgeInsets of(BuildContext context) =>
|
||||
context
|
||||
.dependOnInheritedWidgetOfExactType<ShellSystemInsets>()
|
||||
?.padding ??
|
||||
MediaQuery.viewPaddingOf(context);
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(ShellSystemInsets oldWidget) =>
|
||||
padding != oldWidget.padding;
|
||||
}
|
||||
|
||||
/// Narrows a shell bar to the list pane while [split] (the tab shows its list
|
||||
/// beside an open item), placing it at the pane's [alignment]; otherwise the
|
||||
/// bar keeps the whole width it is given. The bar keeps its place in the tree
|
||||
/// either way, so a split never remounts it.
|
||||
class ListPaneWidth extends StatelessWidget {
|
||||
const ListPaneWidth({
|
||||
super.key,
|
||||
required this.split,
|
||||
required this.alignment,
|
||||
required this.child,
|
||||
});
|
||||
|
||||
final bool split;
|
||||
final AlignmentGeometry alignment;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final width = split
|
||||
? listDetailListWidth(
|
||||
MediaQuery.sizeOf(context).width,
|
||||
constraints.maxWidth,
|
||||
)
|
||||
: constraints.maxWidth;
|
||||
return Align(
|
||||
alignment: alignment,
|
||||
heightFactor: 1,
|
||||
child: SizedBox(width: width, child: child),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// One body-priority policy for all destinations, derived from the full window
|
||||
/// and actual available space after navigation. No fixed pixel pane widths.
|
||||
///
|
||||
/// Under the shell, the list keeps the shell's bar (narrowed to the list pane
|
||||
/// through [ShellPaneSplit]) and the open item owns the rest of the top row:
|
||||
/// the detail starts at the top edge with only the system inset as its top
|
||||
/// padding, and its own tabs float at its top ([PageTabsEdge]) so they never
|
||||
/// stack on the shell's tab bar at the bottom.
|
||||
/// Under the shell, the list keeps the shell's bars (both narrowed to the list
|
||||
/// pane through [ShellPaneSplit], see [ListPaneWidth]) and the open item owns
|
||||
/// the rest of the window: the detail starts at the top edge and reaches the
|
||||
/// bottom edge with only the system insets ([ShellSystemInsets]) as its
|
||||
/// padding, and its own tabs float at its bottom, as on a phone.
|
||||
class ListDetailPanes extends StatelessWidget {
|
||||
const ListDetailPanes({super.key, required this.list, required this.detail});
|
||||
|
||||
@@ -69,13 +130,20 @@ class ListDetailPanes extends StatelessWidget {
|
||||
);
|
||||
Widget body = detail;
|
||||
if (split) {
|
||||
// Beside the list the item is not under the shell's bar: it keeps
|
||||
// only the system's own inset and draws its bar at the top edge.
|
||||
// Beside the list the item is under neither of the shell's bars
|
||||
// (both stay over the list pane): it keeps only the system's own
|
||||
// insets, so its bar sits just below the status bar at the top
|
||||
// edge, and its tabs or composer own the pane's bottom edge,
|
||||
// floating just above the system inset.
|
||||
final system = ShellSystemInsets.of(context);
|
||||
body = MediaQuery(
|
||||
data: media.copyWith(
|
||||
padding: media.padding.copyWith(top: media.viewPadding.top),
|
||||
padding: media.padding.copyWith(
|
||||
top: system.top,
|
||||
bottom: system.bottom,
|
||||
),
|
||||
),
|
||||
child: PageTabsEdge(edge: FloatingBarEdge.top, child: body),
|
||||
child: PageTabsEdge(edge: FloatingBarEdge.bottom, child: body),
|
||||
);
|
||||
}
|
||||
return Row(
|
||||
|
||||
@@ -112,19 +112,19 @@ class SliverFloatingBarClearance extends StatelessWidget {
|
||||
|
||||
/// The edge a page's own floating tab bar sits at.
|
||||
enum FloatingBarEdge {
|
||||
/// Above the bottom safe area: a phone page, or a page covering the shell.
|
||||
/// Above the bottom safe area: a phone page, a page covering the shell,
|
||||
/// or a detail pane beside a list (the shell's tab bar stays over the
|
||||
/// list pane).
|
||||
bottom,
|
||||
|
||||
/// Just below the page's top bar: a detail pane beside a list, where the
|
||||
/// shell's own tab bar already floats at the bottom.
|
||||
/// Just below the page's top bar, for a surface whose bottom is taken.
|
||||
top,
|
||||
}
|
||||
|
||||
/// Where the pages' own tab bars float in this subtree ([FloatingBarEdge]).
|
||||
///
|
||||
/// A detail pane beside a list says [FloatingBarEdge.top], so an open item's
|
||||
/// tabs never stack on the shell's tab bar; everywhere else they float at the
|
||||
/// bottom.
|
||||
/// Pages float their tabs at the bottom (the default), including a detail
|
||||
/// pane beside a list, whose bottom the shell leaves free.
|
||||
class PageTabsEdge extends InheritedWidget {
|
||||
const PageTabsEdge({super.key, required this.edge, required super.child});
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
/// The widest a detail's reading body (a run or pipeline Summary, a stage
|
||||
/// page's sections) grows on a wide window, so its text, trailing copy
|
||||
/// buttons and facts stay within reach of the title instead of stretching
|
||||
/// to the window's far edge.
|
||||
const double kReadingMaxWidth = 840;
|
||||
|
||||
/// Caps [child] at [maxWidth] from the leading edge, where the detail's bar
|
||||
/// pieces, header strip and tabs start. It passes the full height through
|
||||
/// unchanged, so a scrollable child fills the height as before; only its
|
||||
/// width is capped.
|
||||
class ReadingWidth extends StatelessWidget {
|
||||
const ReadingWidth({
|
||||
super.key,
|
||||
required this.child,
|
||||
this.maxWidth = kReadingMaxWidth,
|
||||
});
|
||||
|
||||
final Widget child;
|
||||
final double maxWidth;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => LayoutBuilder(
|
||||
// One structure at every width, so resizing across the cap never
|
||||
// remounts the body (its scroll offset and open sections stay).
|
||||
builder: (context, constraints) {
|
||||
return Align(
|
||||
alignment: AlignmentDirectional.topStart,
|
||||
child: SizedBox(
|
||||
width: math.min(maxWidth, constraints.maxWidth),
|
||||
height: constraints.hasBoundedHeight ? constraints.maxHeight : null,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user