// Standalone browser fixture for the floating glass tab bar in the shell. // // Build and capture (from app/): // flutter build web --target tool/floating_tabs_probe_entry.dart \ // -o build/probe-floating-tabs // python3 -I -m http.server 0 --bind 127.0.0.1 \ // --directory build/probe-floating-tabs // Chrome --headless=new --window-size=W,H --screenshot=OUT \ // 'http://127.0.0.1:PORT/?platform=cupertino&theme=dark' // // Query: platform=cupertino (else Material), theme=dark, tab=runs|chat|... // The destinations are long local lists, so the capture shows content passing // behind the bar and the last row clearing it. No server is involved. import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:pipelines_app/shell/adaptive_shell.dart'; import 'package:pipelines_app/shell/destination.dart'; import 'package:pipelines_app/shell/shell_bar.dart'; void main() { final params = Uri.base.queryParameters; final cupertino = params['platform'] == 'cupertino'; final dark = params['theme'] == 'dark'; final tab = AppDestination.values.firstWhere( (value) => value.name == params['tab'], orElse: () => AppDestination.pipelines, ); final end = params['end'] == '1'; runApp(_Probe(cupertino: cupertino, dark: dark, tab: tab, end: end)); } class _Probe extends StatelessWidget { const _Probe({ required this.cupertino, required this.dark, required this.tab, required this.end, }); final bool cupertino; final bool dark; final AppDestination tab; /// Starts every list scrolled to its end, to show the last row at rest. final bool end; Widget _list(String noun, {required int count}) => _ProbeList(noun: noun, count: count, cupertino: cupertino, end: end); @override Widget build(BuildContext context) { final shell = AdaptiveShell( cupertino: cupertino, destination: tab, attentionCount: 3, destinationBodies: { AppDestination.pipelines: (_) => _list('Pipeline', count: 40), AppDestination.runs: (_) => ShellBadge( kind: ShellBadgeKind.running, count: 2, child: _list('Run', count: 40), ), AppDestination.chat: (_) => ShellBadge( kind: ShellBadgeKind.unread, count: 1, child: _list('Chat', count: 12), ), }, ); if (cupertino) { return CupertinoApp( debugShowCheckedModeBanner: false, theme: CupertinoThemeData( brightness: dark ? Brightness.dark : Brightness.light, ), home: shell, ); } return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( brightness: dark ? Brightness.dark : Brightness.light, colorSchemeSeed: Colors.indigo, ), home: shell, ); } } class _ProbeList extends StatefulWidget { const _ProbeList({ required this.noun, required this.count, required this.cupertino, required this.end, }); final String noun; final int count; final bool cupertino; final bool end; @override State<_ProbeList> createState() => _ProbeListState(); } class _ProbeListState extends State<_ProbeList> { final _scroll = ScrollController(); @override void initState() { super.initState(); if (widget.end) { WidgetsBinding.instance.addPostFrameCallback((_) { if (_scroll.hasClients) { _scroll.jumpTo(_scroll.position.maxScrollExtent); } }); } } @override void dispose() { _scroll.dispose(); super.dispose(); } @override Widget build(BuildContext context) { // No explicit padding: the list pads itself by the media insets, which // include the floating bar's height. return ListView.builder( controller: _scroll, itemCount: widget.count, itemBuilder: (context, index) { final title = '${widget.noun} ${index + 1}'; final subtitle = index.isEven ? 'Succeeded · 2m 05s' : 'Running · started 1m ago'; if (widget.cupertino) { return CupertinoListTile( leading: const Icon(CupertinoIcons.circle_fill, size: 12), title: Text(title), subtitle: Text(subtitle), ); } return ListTile( leading: Icon( index.isEven ? Icons.check_circle_outline : Icons.timelapse, ), title: Text(title), subtitle: Text(subtitle), ); }, ); } }