feat(app): glass viewer bars, graph controls and immersive image viewer
Review findings F12, F13, F25 and F1 for viewers: the artifact viewer's actions/pager and the Changes pager float as glass pills over content, file facts move to the top bar, graph overlay controls are one glass pill (duplicate fullscreen glyph removed), the image viewer is immersive, and diff/artifact/graph views let content pass behind the bar. Implemented by pipeline run #204 (Terra); its Review stopped after three rejections, the last being an empty glass bar for a single unresolved artifact, which the manager fixed here with a regression test.
This commit is contained in:
@@ -10,6 +10,8 @@ import 'change_style.dart';
|
||||
import 'file_diff_viewer.dart';
|
||||
import 'visit_pager.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/adaptive/glass_pill.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
|
||||
/// The run's Changes surface: an honest final-state summary followed by the
|
||||
/// recorded stage/visit captures, with changed-filename filtering and the
|
||||
@@ -105,12 +107,24 @@ class _ChangesViewerState extends State<ChangesViewer> {
|
||||
);
|
||||
final note = showSummary ? runChangesNote(run) : '';
|
||||
final visit = captures.isEmpty ? null : captures[_visitIndex];
|
||||
return Column(
|
||||
final hasVisitPager = !widget.finalOnly && captures.length > 1;
|
||||
final pager = hasVisitPager
|
||||
? ChangesVisitPager(
|
||||
index: _visitIndex,
|
||||
count: captures.length,
|
||||
onPrevious: () => _stepVisit(-1),
|
||||
onNext: () => _stepVisit(1),
|
||||
)
|
||||
: null;
|
||||
final content = Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
if (showSummary)
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 8),
|
||||
padding: withTopBarClearance(
|
||||
context,
|
||||
const EdgeInsets.fromLTRB(16, 16, 16, 8),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -149,7 +163,7 @@ class _ChangesViewerState extends State<ChangesViewer> {
|
||||
Expanded(
|
||||
child: run.files.isEmpty
|
||||
? SingleChildScrollView(
|
||||
padding: withFloatingBarClearance(
|
||||
padding: withTopBarClearance(
|
||||
context,
|
||||
const EdgeInsets.all(16),
|
||||
),
|
||||
@@ -175,10 +189,9 @@ class _ChangesViewerState extends State<ChangesViewer> {
|
||||
Expanded(
|
||||
child: visit == null
|
||||
? SingleChildScrollView(
|
||||
padding: withFloatingBarClearance(
|
||||
context,
|
||||
const EdgeInsets.all(16),
|
||||
),
|
||||
padding: pager == null
|
||||
? withTopBarClearance(context, const EdgeInsets.all(16))
|
||||
: withBarClearance(context, const EdgeInsets.all(16)),
|
||||
child: Text(noChangeDetail(run)),
|
||||
)
|
||||
: SingleChildScrollView(
|
||||
@@ -187,7 +200,9 @@ class _ChangesViewerState extends State<ChangesViewer> {
|
||||
key: ValueKey<String>(
|
||||
'changes-visit-${visit.stage}-${visit.sequence}',
|
||||
),
|
||||
padding: withFloatingBarClearance(context, EdgeInsets.zero),
|
||||
padding: hasVisitPager
|
||||
? withBarClearance(context, EdgeInsets.zero)
|
||||
: withTopBarClearance(context, EdgeInsets.zero),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
@@ -208,15 +223,19 @@ class _ChangesViewerState extends State<ChangesViewer> {
|
||||
),
|
||||
),
|
||||
),
|
||||
// Previous/next visit sit at the bottom right, under the visit.
|
||||
if (!widget.finalOnly && visit != null)
|
||||
ChangesVisitPager(
|
||||
index: _visitIndex,
|
||||
count: captures.length,
|
||||
onPrevious: () => _stepVisit(-1),
|
||||
onNext: () => _stepVisit(1),
|
||||
),
|
||||
],
|
||||
);
|
||||
if (pager == null) return content;
|
||||
return FloatingBarOverlay(
|
||||
bar: Align(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
heightFactor: 1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: GlassPill(cupertino: usesCupertinoHost(context), child: pager),
|
||||
),
|
||||
),
|
||||
child: content,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../../ui/navigation/chevron_pager.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/adaptive/glass_pill.dart';
|
||||
import '../domain/change_kind.dart';
|
||||
import '../domain/change_wording.dart';
|
||||
import '../domain/file_change.dart';
|
||||
@@ -20,13 +22,22 @@ import 'raw_patch_view.dart';
|
||||
/// bytes) and Close. Binary/truncated/mode-only/no-patch entries show an honest
|
||||
/// reason instead of a fabricated diff.
|
||||
class FileDiffViewer extends StatefulWidget {
|
||||
const FileDiffViewer({super.key, required this.file, this.onClose});
|
||||
const FileDiffViewer({
|
||||
super.key,
|
||||
required this.file,
|
||||
this.onClose,
|
||||
this.floatBehindTopBar = false,
|
||||
});
|
||||
|
||||
final FileChange file;
|
||||
|
||||
/// Called by the Close control. Defaults to popping the enclosing route.
|
||||
final VoidCallback? onClose;
|
||||
|
||||
/// The full-page presentation clears its floating navigation bar while the
|
||||
/// diff content still occupies the page edge behind it.
|
||||
final bool floatBehindTopBar;
|
||||
|
||||
@override
|
||||
State<FileDiffViewer> createState() => _FileDiffViewerState();
|
||||
}
|
||||
@@ -44,15 +55,6 @@ class _FileDiffViewerState extends State<FileDiffViewer> {
|
||||
|
||||
void _selectForm(DiffForm value) => setState(() => _form = value);
|
||||
|
||||
void _close() {
|
||||
final close = widget.onClose;
|
||||
if (close != null) {
|
||||
close();
|
||||
} else {
|
||||
Navigator.of(context).maybePop();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _copy() async {
|
||||
final patch = widget.file.patch;
|
||||
if (patch == null) return;
|
||||
@@ -84,7 +86,12 @@ class _FileDiffViewerState extends State<FileDiffViewer> {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 8, 8),
|
||||
padding: widget.floatBehindTopBar
|
||||
? withTopBarClearance(
|
||||
context,
|
||||
const EdgeInsets.fromLTRB(16, 12, 16, 8),
|
||||
)
|
||||
: const EdgeInsets.fromLTRB(16, 12, 16, 8),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -142,7 +149,6 @@ class _FileDiffViewerState extends State<FileDiffViewer> {
|
||||
),
|
||||
),
|
||||
),
|
||||
closeDiffControl(context, _close),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -277,6 +283,7 @@ class _FileDiffPageState extends State<FileDiffPage> {
|
||||
final viewer = FileDiffViewer(
|
||||
key: ValueKey<String>('file-diff-${file.path}'),
|
||||
file: file,
|
||||
floatBehindTopBar: true,
|
||||
);
|
||||
final pager = count < 2
|
||||
? null
|
||||
@@ -293,26 +300,30 @@ class _FileDiffPageState extends State<FileDiffPage> {
|
||||
final body = ArrowKeyPager(
|
||||
onPrevious: _index > 0 ? () => _step(-1) : null,
|
||||
onNext: _index < count - 1 ? () => _step(1) : null,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Expanded(child: viewer),
|
||||
?pager,
|
||||
],
|
||||
child: FloatingBarOverlay(
|
||||
bar: pager == null
|
||||
? const SizedBox.shrink()
|
||||
: Align(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
heightFactor: 1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: GlassPill(cupertino: cupertino, child: pager),
|
||||
),
|
||||
),
|
||||
child: viewer,
|
||||
),
|
||||
);
|
||||
if (cupertino) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: SegmentedBar(cupertino: true, title: name),
|
||||
child: SafeArea(
|
||||
child: Theme(data: hostTextTheme(context), child: body),
|
||||
),
|
||||
child: Theme(data: hostTextTheme(context), child: body),
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: SegmentedBar(cupertino: false, title: name),
|
||||
body: SafeArea(child: body),
|
||||
body: body,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user