import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/artifacts/ui/artifact_external_open.dart'; import 'package:pipelines_app/features/chat/data/directory_listing.dart'; import 'package:pipelines_app/features/chat/files/files_details.dart'; const _entry = DirectoryEntry( name: 'report.txt', path: '/home/report.txt', isDir: false, isGitRepo: false, hidden: false, size: 1024, modified: '2026-01-02T03:04:05Z', ); Widget _app() { return MaterialApp( home: Scaffold( body: Builder( builder: (context) => TextButton( onPressed: () => showFileDetails( context, entry: _entry, urls: null, download: null, openExternal: ((_) async => false) as ArtifactExternalOpen, ), child: const Text('Details'), ), ), ), ); } void _size(WidgetTester tester, Size size) { tester.view.physicalSize = size; tester.view.devicePixelRatio = 1; addTearDown(tester.view.reset); } void main() { testWidgets('wide file details use a dialog', (tester) async { _size(tester, const Size(1280, 800)); await tester.pumpWidget(_app()); await tester.tap(find.text('Details')); await tester.pumpAndSettle(); expect(find.byType(Dialog), findsOneWidget); expect(find.byType(BottomSheet), findsNothing); expect(find.text('report.txt'), findsOneWidget); }); testWidgets('phone file details use a bottom sheet', (tester) async { _size(tester, const Size(430, 900)); await tester.pumpWidget(_app()); await tester.tap(find.text('Details')); await tester.pumpAndSettle(); expect(find.byType(BottomSheet), findsOneWidget); expect(find.byType(Dialog), findsNothing); }); }