feat(app): artifact viewer controls float over the content and hide when idle

This commit is contained in:
2026-10-23 19:31:42 +01:00
parent 7b0a1a721f
commit 5acf2145ff
2 changed files with 217 additions and 58 deletions
@@ -0,0 +1,43 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_body.dart';
void main() {
testWidgets('controls float over the content, hide when idle and return on '
'touch', (tester) async {
var opened = 0;
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: ArtifactControlsOverlay(
controls: [
TextButton(onPressed: () => opened++, child: const Text('Open')),
],
child: const SizedBox.expand(child: Text('content')),
),
),
),
);
double opacity() => tester
.widget<AnimatedOpacity>(
find.byKey(const Key('artifact-viewer-controls')),
)
.opacity;
// Shown on open, on top of the content without scrolling.
expect(opacity(), 1);
await tester.tap(find.text('Open'));
expect(opened, 1);
await tester.pump(const Duration(seconds: 4));
await tester.pumpAndSettle();
expect(opacity(), 0);
// Hidden controls take no taps.
await tester.tap(find.text('Open'), warnIfMissed: false);
expect(opened, 1);
await tester.tap(find.text('content'));
await tester.pump();
expect(opacity(), 1);
});
}