Float glass tab bars everywhere the app has bottom tabs
One floating frosted tab bar (host NavigationBar / CupertinoTabBar in the shared GlassPill) replaces the NavigationRail, the Cupertino sidebar and the run detail, stage page and pipeline detail tab strips. Below 600px it spans the width minus 16px margins; wider it is sized to its tabs at the right edge. Content keeps the full width, scrolls behind the bar and learns its height as bottom media padding; lists pad their end clear of it and FABs sit above it. The bar now sizes itself from its own constraints instead of the screen size, which fixes the widget_test failure where a MediaQuery without a size gave it negative width constraints.
This commit is contained in:
@@ -9,6 +9,7 @@ import 'artifact_record_row.dart';
|
||||
import 'artifact_tile.dart';
|
||||
import 'artifact_viewer_fetch.dart';
|
||||
import 'artifact_row_labels.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
|
||||
export 'artifact_row_labels.dart'
|
||||
show
|
||||
@@ -141,7 +142,10 @@ class _ArtifactVisitListState extends State<ArtifactVisitList> {
|
||||
);
|
||||
}
|
||||
}
|
||||
return CustomScrollView(slivers: slivers);
|
||||
// Clear of a floating tab bar when the gallery is a tab.
|
||||
return CustomScrollView(
|
||||
slivers: [...slivers, const SliverFloatingBarClearance()],
|
||||
);
|
||||
}
|
||||
|
||||
/// One collapsible section: its title stays pinned at the top while its
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'capture_section.dart';
|
||||
import 'change_style.dart';
|
||||
import 'file_diff_viewer.dart';
|
||||
import 'visit_pager.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
|
||||
/// The run's Changes surface: an honest final-state summary followed by the
|
||||
/// recorded stage/visit captures, with changed-filename filtering and the
|
||||
@@ -148,7 +149,10 @@ class _ChangesViewerState extends State<ChangesViewer> {
|
||||
Expanded(
|
||||
child: run.files.isEmpty
|
||||
? SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: withFloatingBarClearance(
|
||||
context,
|
||||
const EdgeInsets.all(16),
|
||||
),
|
||||
child: Text(noChangeDetail(run)),
|
||||
)
|
||||
: ListView(
|
||||
@@ -171,7 +175,10 @@ class _ChangesViewerState extends State<ChangesViewer> {
|
||||
Expanded(
|
||||
child: visit == null
|
||||
? SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: withFloatingBarClearance(
|
||||
context,
|
||||
const EdgeInsets.all(16),
|
||||
),
|
||||
child: Text(noChangeDetail(run)),
|
||||
)
|
||||
: SingleChildScrollView(
|
||||
@@ -180,6 +187,7 @@ class _ChangesViewerState extends State<ChangesViewer> {
|
||||
key: ValueKey<String>(
|
||||
'changes-visit-${visit.stage}-${visit.sequence}',
|
||||
),
|
||||
padding: withFloatingBarClearance(context, EdgeInsets.zero),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'chat_sessions_body.dart';
|
||||
import 'session_actions.dart';
|
||||
import 'session_row_content.dart';
|
||||
import 'session_row_style.dart';
|
||||
import '../../../../ui/adaptive/floating_bar_layout.dart';
|
||||
|
||||
class CupertinoSessionList extends StatelessWidget {
|
||||
const CupertinoSessionList({
|
||||
@@ -47,7 +48,10 @@ class CupertinoSessionList extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView(
|
||||
padding: const EdgeInsets.only(bottom: 24),
|
||||
padding: withFloatingBarClearance(
|
||||
context,
|
||||
const EdgeInsets.only(bottom: 24),
|
||||
),
|
||||
children: [
|
||||
for (final section in sections) ..._section(section),
|
||||
if (emptyMessage != null)
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../graph/domain/graph_definition.dart';
|
||||
import '../../graph/widgets/stage_definition_view.dart';
|
||||
import '../pipeline_models.dart';
|
||||
@@ -100,11 +101,10 @@ class _PipelineDetailPanelState extends State<PipelineDetailPanel> {
|
||||
final panel = LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final headerLimit = _headerLimit(constraints);
|
||||
// On a phone the tabs are a bottom bar, as in the run detail.
|
||||
final bottomTabs = constraints.maxWidth < 600;
|
||||
// The tabs float over the bottom of the tab body, as in the run
|
||||
// detail: full width on a phone, at the right edge of a wide pane.
|
||||
final tabs = PipelineDetailTabs(
|
||||
selected: _tab,
|
||||
bottom: bottomTabs,
|
||||
onSelected: (tab) => setState(() => _tab = tab),
|
||||
);
|
||||
return Column(
|
||||
@@ -130,7 +130,6 @@ class _PipelineDetailPanelState extends State<PipelineDetailPanel> {
|
||||
message: _controller.detailError!,
|
||||
onRetry: _controller.retryDetail,
|
||||
),
|
||||
if (!bottomTabs) tabs,
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -139,36 +138,40 @@ class _PipelineDetailPanelState extends State<PipelineDetailPanel> {
|
||||
// scroll their own content; the graph fills the slot so its canvas
|
||||
// is never asked for an unbounded extent inside a scroll view.
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: switch (_tab) {
|
||||
PipelineDetailTab.summary => _scrolling(
|
||||
PipelineSummaryView(
|
||||
controller: _controller,
|
||||
detail: detail,
|
||||
gateway: widget.gateway,
|
||||
),
|
||||
child: FloatingBarOverlay(
|
||||
bar: tabs,
|
||||
child: Builder(
|
||||
builder: (context) => Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: switch (_tab) {
|
||||
PipelineDetailTab.summary => _scrolling(
|
||||
PipelineSummaryView(
|
||||
controller: _controller,
|
||||
detail: detail,
|
||||
gateway: widget.gateway,
|
||||
),
|
||||
),
|
||||
PipelineDetailTab.graph => PipelineGraphTab(
|
||||
detail: detail,
|
||||
selectedStage: _graphSelection,
|
||||
onSelected: (stageKey) =>
|
||||
_openGraphStage(context, detail, stageKey),
|
||||
),
|
||||
PipelineDetailTab.source => _source(context, detail),
|
||||
},
|
||||
),
|
||||
PipelineDetailTab.graph => PipelineGraphTab(
|
||||
detail: detail,
|
||||
selectedStage: _graphSelection,
|
||||
onSelected: (stageKey) =>
|
||||
_openGraphStage(context, detail, stageKey),
|
||||
// Run and Runs float over the content, above the tabs.
|
||||
PositionedDirectional(
|
||||
end: 16,
|
||||
bottom: 16 + MediaQuery.paddingOf(context).bottom,
|
||||
child: _fabs(context, detail),
|
||||
),
|
||||
PipelineDetailTab.source => _source(context, detail),
|
||||
},
|
||||
],
|
||||
),
|
||||
// Run and Runs float over the content, above the tabs.
|
||||
PositionedDirectional(
|
||||
end: 16,
|
||||
bottom: 16,
|
||||
child: _fabs(context, detail),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (bottomTabs) SafeArea(top: false, child: tabs),
|
||||
],
|
||||
);
|
||||
},
|
||||
@@ -391,7 +394,7 @@ class _PipelineDetailPanelState extends State<PipelineDetailPanel> {
|
||||
|
||||
Widget _source(BuildContext context, PipelineDetail detail) {
|
||||
return ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: withFloatingBarClearance(context, const EdgeInsets.all(16)),
|
||||
children: [
|
||||
if (detail.source.isEmpty)
|
||||
Text('No source recorded.', style: pipelineMutedStyle(context))
|
||||
|
||||
@@ -1,150 +1,45 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../../ui/adaptive/floating_destination_bar.dart';
|
||||
import 'pipeline_controls.dart';
|
||||
import 'pipeline_detail_tab.dart';
|
||||
|
||||
export 'pipeline_detail_tab.dart';
|
||||
|
||||
/// Platform tabs: a Material segmented button or a Cupertino segmented control.
|
||||
/// The pipeline detail's tabs: the app's floating glass tab bar, full width on
|
||||
/// a phone and sized to its tabs at the right edge of a wide pane.
|
||||
///
|
||||
/// Keep the native control at every width. Horizontal scrolling gives scaled
|
||||
/// labels their intrinsic width instead of squeezing or replacing the control.
|
||||
/// Float it over the tab body with `FloatingBarOverlay`. The whole bar is
|
||||
/// keyed `pipeline-detail-tabs`, each tab `pipeline-detail-tab-<name>`.
|
||||
class PipelineDetailTabs extends StatelessWidget {
|
||||
const PipelineDetailTabs({
|
||||
super.key,
|
||||
required this.selected,
|
||||
required this.onSelected,
|
||||
this.bottom = false,
|
||||
});
|
||||
|
||||
/// The phone layout: a full-width bar under the content, with icons.
|
||||
final bool bottom;
|
||||
|
||||
final PipelineDetailTab selected;
|
||||
final ValueChanged<PipelineDetailTab> onSelected;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = useCupertinoControls(context);
|
||||
if (bottom) {
|
||||
final divider = cupertino
|
||||
? CupertinoColors.separator.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.outlineVariant;
|
||||
return DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(top: BorderSide(color: divider, width: 0.5)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: KeyedSubtree(
|
||||
key: const Key('pipeline-detail-tabs'),
|
||||
child: cupertino ? _cupertinoControl() : _materialControl(),
|
||||
const tabs = PipelineDetailTab.values;
|
||||
return KeyedSubtree(
|
||||
key: const Key('pipeline-detail-tabs'),
|
||||
child: FloatingDestinationBar(
|
||||
cupertino: cupertino,
|
||||
currentIndex: tabs.indexOf(selected),
|
||||
onTap: (value) => onSelected(tabs[value]),
|
||||
items: [
|
||||
for (final tab in tabs)
|
||||
FloatingDestinationItem(
|
||||
key: ValueKey('pipeline-detail-tab-${tab.name}'),
|
||||
icon: Icon(cupertino ? tab.cupertinoIcon : tab.icon),
|
||||
label: tab.label,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: _ScrollWhenOverflowing(
|
||||
child: KeyedSubtree(
|
||||
key: const Key('pipeline-detail-tabs'),
|
||||
child: cupertino ? _cupertinoControl() : _materialControl(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _materialControl() {
|
||||
return SegmentedButton<PipelineDetailTab>(
|
||||
segments: [
|
||||
for (final tab in PipelineDetailTab.values)
|
||||
ButtonSegment(value: tab, label: _label(tab)),
|
||||
],
|
||||
selected: {selected},
|
||||
showSelectedIcon: false,
|
||||
expandedInsets: bottom ? EdgeInsets.zero : null,
|
||||
onSelectionChanged: (selection) => onSelected(selection.single),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _cupertinoControl() {
|
||||
return CupertinoSegmentedControl<PipelineDetailTab>(
|
||||
// The strip already insets 16; the control's default inset would push
|
||||
// the tabs out of line with the content.
|
||||
padding: EdgeInsets.zero,
|
||||
groupValue: selected,
|
||||
onValueChanged: onSelected,
|
||||
children: {
|
||||
for (final tab in PipelineDetailTab.values)
|
||||
tab: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: _label(tab),
|
||||
),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _label(PipelineDetailTab tab) {
|
||||
// One line, and let the control size the segment to the whole word rather
|
||||
// than wrapping inside it when scaled text is wider than the pane.
|
||||
final text = Text(tab.label, maxLines: 1, softWrap: false);
|
||||
if (!bottom) return text;
|
||||
return FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Builder(
|
||||
builder: (context) => Icon(
|
||||
useCupertinoControls(context) ? tab.cupertinoIcon : tab.icon,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
text,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Gives [child] the full available width as a minimum, then scrolls instead of
|
||||
/// squeezing it below its content width.
|
||||
class _ScrollWhenOverflowing extends StatelessWidget {
|
||||
const _ScrollWhenOverflowing({required this.child});
|
||||
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
if (!constraints.hasBoundedWidth) return child;
|
||||
return ScrollConfiguration(
|
||||
// Desktop pointer scrolling is vertical only, so allow dragging the
|
||||
// tab row with a mouse as well as touch and trackpad.
|
||||
behavior: ScrollConfiguration.of(context).copyWith(
|
||||
dragDevices: const {
|
||||
PointerDeviceKind.touch,
|
||||
PointerDeviceKind.mouse,
|
||||
PointerDeviceKind.stylus,
|
||||
PointerDeviceKind.invertedStylus,
|
||||
PointerDeviceKind.trackpad,
|
||||
},
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(minWidth: constraints.maxWidth),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'run_field_body.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/layout/sticky_section.dart';
|
||||
import '../../../ui/text/monospace.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
|
||||
/// The Summary tab: the run's identity, the recorded facts as key/value rows,
|
||||
/// the stored original prompt with its copy control and the collapsible Input
|
||||
@@ -99,6 +100,7 @@ Widget runDetailSummaryTab({
|
||||
),
|
||||
),
|
||||
const SliverToBoxAdapter(child: SizedBox(height: 16)),
|
||||
const SliverFloatingBarClearance(),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -198,6 +200,7 @@ Widget runDetailFieldTab({
|
||||
if (cupertino) {
|
||||
return ListView(
|
||||
key: Key('run-detail-tab-body-$tabKey'),
|
||||
// Clear of a floating tab bar (the list pads its media insets itself).
|
||||
children: [
|
||||
CupertinoListSection.insetGrouped(
|
||||
backgroundColor: AppColors.groupedBackground,
|
||||
@@ -206,10 +209,12 @@ Widget runDetailFieldTab({
|
||||
],
|
||||
);
|
||||
}
|
||||
return ListView(
|
||||
key: Key('run-detail-tab-body-$tabKey'),
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [body],
|
||||
return Builder(
|
||||
builder: (context) => ListView(
|
||||
key: Key('run-detail-tab-body-$tabKey'),
|
||||
padding: withFloatingBarClearance(context, const EdgeInsets.all(16)),
|
||||
children: [body],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../../ui/adaptive/floating_destination_bar.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import 'run_detail_tab.dart';
|
||||
|
||||
/// The tabs the strip renders, in the web's order: Summary first so it is the
|
||||
/// default, then the run Graph and the Timeline. Input and Output are
|
||||
/// collapsible Summary sections now, so their stable enum keys stay available
|
||||
/// for old routes but they are not separate tabs.
|
||||
/// The graph is a preview on Summary that opens full screen, so it has no tab
|
||||
/// of its own; the run's artifacts and changes do.
|
||||
/// default, then the Timeline, the run's Artifacts and its Changes. Input and
|
||||
/// Output are collapsible Summary sections now, so their stable enum keys stay
|
||||
/// available for old routes but they are not separate tabs. The graph is a
|
||||
/// preview on Summary that opens full screen, so it has no tab of its own.
|
||||
const List<RunDetailTab> renderedRunDetailTabs = [
|
||||
RunDetailTab.summary,
|
||||
RunDetailTab.timeline,
|
||||
@@ -18,20 +16,19 @@ const List<RunDetailTab> renderedRunDetailTabs = [
|
||||
RunDetailTab.changes,
|
||||
];
|
||||
|
||||
/// The run detail's platform tab strip: a Material segmented button or a
|
||||
/// Cupertino segmented control, in the web's Summary/Graph/Timeline order.
|
||||
/// The run detail's tabs: the app's floating glass tab bar, full width on a
|
||||
/// phone and sized to its tabs at the right edge of a wide pane.
|
||||
///
|
||||
/// The native control keeps every label at its intrinsic width: a narrow pane
|
||||
/// or scaled text scrolls the strip horizontally instead of squeezing or
|
||||
/// wrapping the words. A tab selected by the Graph (not tapped in the strip)
|
||||
/// is scrolled into view, so the operator can see which section is selected.
|
||||
class RunDetailTabStrip extends StatefulWidget {
|
||||
/// Float it over the tab body with `FloatingBarOverlay`; every tab is always
|
||||
/// visible, so a tab selected by the Graph is shown selected without
|
||||
/// scrolling. The whole bar is keyed `run-detail-tabs`, each tab
|
||||
/// `run-detail-tab-<name>`.
|
||||
class RunDetailTabStrip extends StatelessWidget {
|
||||
const RunDetailTabStrip({
|
||||
super.key,
|
||||
required this.selected,
|
||||
required this.onSelected,
|
||||
this.tabs = renderedRunDetailTabs,
|
||||
this.bottom = false,
|
||||
});
|
||||
|
||||
final RunDetailTab selected;
|
||||
@@ -40,162 +37,25 @@ class RunDetailTabStrip extends StatefulWidget {
|
||||
/// The tabs this run offers, in [renderedRunDetailTabs] order.
|
||||
final List<RunDetailTab> tabs;
|
||||
|
||||
/// The phone layout: a full-width bar under the content instead of a compact
|
||||
/// strip under the header.
|
||||
final bool bottom;
|
||||
|
||||
@override
|
||||
State<RunDetailTabStrip> createState() => _RunDetailTabStripState();
|
||||
}
|
||||
|
||||
class _RunDetailTabStripState extends State<RunDetailTabStrip> {
|
||||
final Map<RunDetailTab, GlobalKey> _labels = {
|
||||
for (final tab in renderedRunDetailTabs) tab: GlobalKey(),
|
||||
};
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant RunDetailTabStrip oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.selected == widget.selected) return;
|
||||
// The Graph can select Timeline without a strip tap. Wait for the new
|
||||
// segment to be laid out, then reveal it inside the strip's own scroll.
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!mounted) return;
|
||||
final context = _labels[widget.selected]?.currentContext;
|
||||
if (context == null) return;
|
||||
Scrollable.ensureVisible(
|
||||
context,
|
||||
alignment: 0.5,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
if (widget.bottom) {
|
||||
final divider = cupertino
|
||||
? CupertinoColors.separator.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.outlineVariant;
|
||||
return DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(top: BorderSide(color: divider, width: 0.5)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: KeyedSubtree(
|
||||
key: const Key('run-detail-tabs'),
|
||||
child: cupertino ? _cupertinoControl() : _materialControl(),
|
||||
final index = tabs.indexOf(selected);
|
||||
return KeyedSubtree(
|
||||
key: const Key('run-detail-tabs'),
|
||||
child: FloatingDestinationBar(
|
||||
cupertino: cupertino,
|
||||
currentIndex: index < 0 ? 0 : index,
|
||||
onTap: (value) => onSelected(tabs[value]),
|
||||
items: [
|
||||
for (final tab in tabs)
|
||||
FloatingDestinationItem(
|
||||
key: ValueKey('run-detail-tab-${tab.name}'),
|
||||
icon: Icon(cupertino ? tab.cupertinoIcon : tab.icon),
|
||||
label: tab.label,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: ScrollWhenOverflowing(
|
||||
child: KeyedSubtree(
|
||||
key: const Key('run-detail-tabs'),
|
||||
child: cupertino ? _cupertinoControl() : _materialControl(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _materialControl() => SegmentedButton<RunDetailTab>(
|
||||
segments: [
|
||||
for (final tab in widget.tabs)
|
||||
ButtonSegment(value: tab, label: _label(tab)),
|
||||
],
|
||||
selected: {widget.selected},
|
||||
showSelectedIcon: false,
|
||||
// The bottom bar spans the width; the header strip keeps its content size.
|
||||
expandedInsets: widget.bottom ? EdgeInsets.zero : null,
|
||||
onSelectionChanged: (selection) => widget.onSelected(selection.single),
|
||||
);
|
||||
|
||||
Widget _cupertinoControl() => CupertinoSegmentedControl<RunDetailTab>(
|
||||
// The strip already insets 16; the control's own default inset would put
|
||||
// the tabs out of line with the header and body text.
|
||||
padding: EdgeInsets.zero,
|
||||
groupValue: widget.selected,
|
||||
onValueChanged: widget.onSelected,
|
||||
children: {
|
||||
for (final tab in widget.tabs)
|
||||
tab: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: _label(tab),
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
Widget _label(RunDetailTab tab) => KeyedSubtree(
|
||||
key: _labels[tab],
|
||||
child: KeyedSubtree(
|
||||
key: ValueKey('run-detail-tab-${tab.name}'),
|
||||
// A full-width bar shrinks a long label rather than overflowing it,
|
||||
// and shows the tab's glyph above its name.
|
||||
child: widget.bottom
|
||||
? FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
usesCupertinoHost(context) ? tab.cupertinoIcon : tab.icon,
|
||||
size: 18,
|
||||
),
|
||||
Text(tab.label, maxLines: 1, softWrap: false),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Text(tab.label, maxLines: 1, softWrap: false),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Gives [child] at least the pane width, then scrolls instead of squeezing it
|
||||
/// below its content width.
|
||||
///
|
||||
/// The run detail's tab strips both use this, so the pointer-drag rule and the
|
||||
/// minimum-width rule live in one place.
|
||||
class ScrollWhenOverflowing extends StatelessWidget {
|
||||
const ScrollWhenOverflowing({super.key, required this.child});
|
||||
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
if (!constraints.hasBoundedWidth) return child;
|
||||
return ScrollConfiguration(
|
||||
// Desktop pointer scrolling is vertical only, so a mouse can drag
|
||||
// the tab row as well as touch and trackpad.
|
||||
behavior: ScrollConfiguration.of(context).copyWith(
|
||||
dragDevices: const {
|
||||
PointerDeviceKind.touch,
|
||||
PointerDeviceKind.mouse,
|
||||
PointerDeviceKind.stylus,
|
||||
PointerDeviceKind.invertedStylus,
|
||||
PointerDeviceKind.trackpad,
|
||||
},
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: ConstrainedBox(
|
||||
// Content width, not the pane width: the web's tabs are compact
|
||||
// and left-aligned, not a full-width segmented bar. The scroll
|
||||
// view still reveals every segment on a narrow pane.
|
||||
constraints: const BoxConstraints(),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/adaptive/segmented_bar.dart';
|
||||
import 'dart:math' as math;
|
||||
|
||||
@@ -28,11 +29,8 @@ import 'run_search_selection.dart';
|
||||
/// reserve keeps its bounded canvas positive at 320px with 2x text.
|
||||
const double kRunDetailMinContentHeight = 240;
|
||||
|
||||
/// Below this width (a phone) the run detail's tabs sit at the bottom.
|
||||
const double kRunDetailBottomTabsWidth = 600;
|
||||
|
||||
/// The run detail's tabbed body: the host-built header and platform tab strip
|
||||
/// above the bounded selected tab.
|
||||
/// The run detail's tabbed body: the host-built header above the bounded
|
||||
/// selected tab, with the floating tab bar over the bottom of the tab.
|
||||
///
|
||||
/// The Graph tab fills its slot with [RunGraphView] from the run's own pinned
|
||||
/// graph and recorded steps. A visited stage click selects that stage's latest
|
||||
@@ -369,14 +367,6 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final headerLimit = _headerLimit(constraints);
|
||||
// On a phone the tabs are a bottom bar, under the content they switch.
|
||||
final bottomTabs = constraints.maxWidth < kRunDetailBottomTabsWidth;
|
||||
final strip = RunDetailTabStrip(
|
||||
tabs: tabs,
|
||||
selected: shown,
|
||||
bottom: bottomTabs,
|
||||
onSelected: (tab) => setState(() => _tab = tab),
|
||||
);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
@@ -384,20 +374,24 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
|
||||
constraints: BoxConstraints(maxHeight: headerLimit),
|
||||
child: SingleChildScrollView(
|
||||
key: ValueKey('run-detail-header-${widget.run['id']}'),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [widget.header, if (!bottomTabs) strip],
|
||||
),
|
||||
child: widget.header,
|
||||
),
|
||||
),
|
||||
// Every tab gets the bounded remaining height. The scrolling tabs
|
||||
// own their content; the Graph tab fills the slot so its canvas is
|
||||
// never asked for an unbounded extent.
|
||||
// never asked for an unbounded extent. The tabs float over the
|
||||
// bottom of it, and the tab learns their height as bottom padding.
|
||||
Expanded(
|
||||
key: ValueKey('run-detail-body-${widget.run['id']}'),
|
||||
child: _body(shown),
|
||||
child: FloatingBarOverlay(
|
||||
bar: RunDetailTabStrip(
|
||||
tabs: tabs,
|
||||
selected: shown,
|
||||
onSelected: (tab) => setState(() => _tab = tab),
|
||||
),
|
||||
child: _body(shown),
|
||||
),
|
||||
),
|
||||
if (bottomTabs) SafeArea(top: false, child: strip),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
||||
import '../../../ui/status/run_status_icon.dart';
|
||||
import '../domain/run_models.dart';
|
||||
import 'run_detail_content.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
|
||||
/// The Timeline tab's recorded visits, one native row per visit.
|
||||
///
|
||||
@@ -33,7 +34,7 @@ class RunTimelineList extends StatelessWidget {
|
||||
if (visits.isEmpty) {
|
||||
return ListView(
|
||||
key: const Key('run-detail-tab-body-timeline'),
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: withFloatingBarClearance(context, const EdgeInsets.all(16)),
|
||||
children: const [Text('No visits recorded.')],
|
||||
);
|
||||
}
|
||||
@@ -63,7 +64,10 @@ class RunTimelineList extends StatelessWidget {
|
||||
}
|
||||
return ListView(
|
||||
key: const Key('run-detail-tab-body-timeline'),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
padding: withFloatingBarClearance(
|
||||
context,
|
||||
const EdgeInsets.symmetric(vertical: 8),
|
||||
),
|
||||
children: rows,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import 'run_detail_content.dart';
|
||||
import 'run_detail_visit_facts.dart';
|
||||
@@ -105,26 +106,26 @@ class _RunVisitPaneState extends State<RunVisitPane> {
|
||||
),
|
||||
),
|
||||
),
|
||||
// The sections are floating tabs over the bottom of what they
|
||||
// show; the section learns their height as bottom padding.
|
||||
Expanded(
|
||||
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,
|
||||
),
|
||||
),
|
||||
// The sections are tabs at the bottom, under what they show.
|
||||
SafeArea(
|
||||
top: false,
|
||||
child: RunVisitSectionStrip(
|
||||
selected: _section,
|
||||
onSelected: (section) => setState(() => _section = section),
|
||||
child: FloatingBarOverlay(
|
||||
bar: RunVisitSectionStrip(
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/floating_destination_bar.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../changes/changes.dart';
|
||||
import 'run_detail_tab_bodies.dart';
|
||||
@@ -12,6 +13,7 @@ import 'run_detail_visit_artifacts.dart';
|
||||
import 'run_detail_visit_definition.dart';
|
||||
import 'run_detail_visit_facts.dart';
|
||||
import 'run_detail_visit_session.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
|
||||
/// The visit pane's recorded sections, in the Android audit order the web
|
||||
/// client follows: the turn's Input and Output, its Artifacts, the files this
|
||||
@@ -43,9 +45,10 @@ enum RunVisitSection {
|
||||
final IconData cupertinoIcon;
|
||||
}
|
||||
|
||||
/// The visit pane's native tab strip: a Material segmented button or a Cupertino
|
||||
/// segmented control. It scrolls instead of squeezing the labels when a narrow
|
||||
/// pane or scaled text cannot fit them.
|
||||
/// The stage page's tabs: the app's floating glass tab bar, full width on a
|
||||
/// phone and sized to its tabs at the right edge of a wide pane. Float it over
|
||||
/// the section with `FloatingBarOverlay`. The whole bar is keyed
|
||||
/// `run-visit-tabs`, each tab `run-visit-tab-<name>`.
|
||||
class RunVisitSectionStrip extends StatelessWidget {
|
||||
const RunVisitSectionStrip({
|
||||
super.key,
|
||||
@@ -59,72 +62,24 @@ class RunVisitSectionStrip extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
// A full-width bar under the section, as the run's own tabs on a phone.
|
||||
final divider = cupertino
|
||||
? CupertinoColors.separator.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.outlineVariant;
|
||||
return DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(top: BorderSide(color: divider, width: 0.5)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 8, 8, 8),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: KeyedSubtree(
|
||||
key: const Key('run-visit-tabs'),
|
||||
child: cupertino ? _cupertinoControl() : _materialControl(),
|
||||
),
|
||||
),
|
||||
final index = shownVisitSections.indexOf(visitTabFor(selected));
|
||||
return KeyedSubtree(
|
||||
key: const Key('run-visit-tabs'),
|
||||
child: FloatingDestinationBar(
|
||||
cupertino: cupertino,
|
||||
currentIndex: index < 0 ? 0 : index,
|
||||
onTap: (value) => onSelected(shownVisitSections[value]),
|
||||
items: [
|
||||
for (final section in shownVisitSections)
|
||||
FloatingDestinationItem(
|
||||
key: ValueKey('run-visit-tab-${section.name}'),
|
||||
icon: Icon(cupertino ? section.cupertinoIcon : section.icon),
|
||||
label: section.label,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _materialControl() => SegmentedButton<RunVisitSection>(
|
||||
segments: [
|
||||
for (final section in shownVisitSections)
|
||||
ButtonSegment(value: section, label: _label(section)),
|
||||
],
|
||||
selected: {selected},
|
||||
showSelectedIcon: false,
|
||||
expandedInsets: EdgeInsets.zero,
|
||||
onSelectionChanged: (selection) => onSelected(selection.single),
|
||||
);
|
||||
|
||||
Widget _cupertinoControl() => CupertinoSegmentedControl<RunVisitSection>(
|
||||
// The strip already insets 16; the control's default inset would push
|
||||
// the tabs out of line with the content.
|
||||
padding: EdgeInsets.zero,
|
||||
groupValue: selected,
|
||||
onValueChanged: onSelected,
|
||||
children: {
|
||||
for (final section in shownVisitSections)
|
||||
section: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 2),
|
||||
child: _label(section),
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
Widget _label(RunVisitSection section) => KeyedSubtree(
|
||||
key: ValueKey('run-visit-tab-${section.name}'),
|
||||
// Six sections share the width; a long label shrinks rather than clips.
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Builder(
|
||||
builder: (context) => Icon(
|
||||
usesCupertinoHost(context) ? section.cupertinoIcon : section.icon,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
Text(section.label, maxLines: 1, softWrap: false),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// The stage page's tabs: Summary (Input and Output), Artifacts, Changes and
|
||||
@@ -298,6 +253,7 @@ class _VisitSummaryState extends State<_VisitSummary> {
|
||||
slivers: [
|
||||
_section('Input', widget.input, visitEmptyInput),
|
||||
_section('Output', widget.output, visitEmptyOutput),
|
||||
const SliverFloatingBarClearance(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import '../actions/session_export_repair_action.dart';
|
||||
import 'run_detail_visit_recorded.dart';
|
||||
import 'run_detail_visit_documents.dart';
|
||||
import 'run_detail_visit_session_state.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
|
||||
/// The visit's recorded session pointer, its recorded export state and, when
|
||||
/// the visit exported one, a read-only external open of that document.
|
||||
@@ -133,7 +134,7 @@ class _RunVisitSessionState extends State<RunVisitSession> {
|
||||
}
|
||||
return ListView(
|
||||
key: const Key('run-visit-body-session'),
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: withFloatingBarClearance(context, const EdgeInsets.all(16)),
|
||||
children: _spaced(children),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,9 @@ class _SearchScreenState extends State<SearchScreen> {
|
||||
}
|
||||
|
||||
Widget _materialScreen() {
|
||||
// Results scroll behind a floating tab bar; the list clears it itself.
|
||||
final body = SafeArea(
|
||||
bottom: false,
|
||||
child: SearchArtifactScope(
|
||||
gateway: widget.gateway,
|
||||
onOpen: widget.onOpen,
|
||||
@@ -192,6 +194,7 @@ class _SearchScreenState extends State<SearchScreen> {
|
||||
|
||||
Widget _cupertinoScreen() {
|
||||
final body = SafeArea(
|
||||
bottom: false,
|
||||
child: SearchArtifactScope(
|
||||
gateway: widget.gateway,
|
||||
onOpen: widget.onOpen,
|
||||
|
||||
@@ -5,6 +5,7 @@ import '../../../core/api_gateway.dart';
|
||||
import '../domain/search_controller.dart';
|
||||
import '../domain/search_row.dart';
|
||||
import 'search_result_view.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
|
||||
/// The Cupertino search view: native search/kind controls and grouped list rows
|
||||
/// in one scroll view, with standard activity and retry controls.
|
||||
@@ -35,6 +36,7 @@ class CupertinoSearchBody extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
..._content(context),
|
||||
const SliverFloatingBarClearance(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import '../../../core/api_gateway.dart';
|
||||
import '../domain/search_controller.dart';
|
||||
import '../domain/search_row.dart';
|
||||
import 'search_result_view.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
|
||||
/// The Material search view: the controls header and a flat native result list
|
||||
/// in one scroll view, so text scaling can never clip the controls or a row.
|
||||
@@ -29,6 +30,7 @@ class MaterialSearchBody extends StatelessWidget {
|
||||
if (controller.showProgress)
|
||||
const SliverToBoxAdapter(child: LinearProgressIndicator()),
|
||||
..._content(context),
|
||||
const SliverFloatingBarClearance(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import 'settings_templates_section.dart';
|
||||
import 'server_connections.dart';
|
||||
import 'saved_servers_section.dart';
|
||||
import 'managed_connection_section.dart';
|
||||
import '../../ui/adaptive/floating_bar_layout.dart';
|
||||
|
||||
/// The Settings destination: the server connection and the server-side
|
||||
/// workspace, in native Material (native platforms) or Cupertino (iOS) controls.
|
||||
@@ -134,15 +135,21 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// The content scrolls behind a floating tab bar and pads its end clear of
|
||||
// it (or of the system inset on its own page).
|
||||
final content = SafeArea(
|
||||
bottom: false,
|
||||
child: SingleChildScrollView(
|
||||
// Web `.settings` page insets: 20 above the title, 16 at the sides and
|
||||
// a clear 32 below the last section.
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||
settingsPageSidePadding,
|
||||
settingsPageTopPadding,
|
||||
settingsPageSidePadding,
|
||||
settingsPageBottomPadding,
|
||||
padding: withFloatingBarClearance(
|
||||
context,
|
||||
const EdgeInsetsDirectional.fromSTEB(
|
||||
settingsPageSidePadding,
|
||||
settingsPageTopPadding,
|
||||
settingsPageSidePadding,
|
||||
settingsPageBottomPadding,
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: ConstrainedBox(
|
||||
|
||||
Reference in New Issue
Block a user