import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:pipelines_app/core/api_gateway.dart'; import 'package:pipelines_app/features/schedules/screen.dart'; /// Isolated browser fixture for the read-only schedules list. /// /// Run with: /// flutter build web -t tool/schedules_list_probe_app.dart /// and open `/?theme=cupertino&scale=2`. void main() { final parameters = Uri.base.queryParameters; final cupertino = parameters['theme'] == 'cupertino'; final dark = parameters['brightness'] == 'dark'; final scale = double.tryParse(parameters['scale'] ?? '') ?? 1.0; final screen = SchedulesScreen(gateway: _FixtureGateway(), onOpen: (_) {}); Widget media(BuildContext context, Widget? app) => MediaQuery( data: MediaQuery.of(context).copyWith(textScaler: TextScaler.linear(scale)), child: app!, ); if (cupertino) { runApp( CupertinoApp( debugShowCheckedModeBanner: false, builder: media, home: CupertinoPageScaffold(child: SafeArea(child: screen)), ), ); return; } runApp( MaterialApp( debugShowCheckedModeBanner: false, theme: dark ? ThemeData(brightness: Brightness.dark) : null, builder: media, home: Scaffold( appBar: AppBar(title: const Text('Schedules')), body: screen, ), ), ); } class _FixtureGateway implements ApiGateway { @override Future call(String type, [JsonMap fields = const {}]) async { if (type != 'list_schedules') { throw StateError('The schedules list fixture only lists schedules.'); } return { 'type': 'schedules', 'schedules': [ { 'id': 8, 'revision': 3, 'name': 'Research batteries', 'pipeline_id': 4, 'version': 2, 'enabled': true, 'input': {'prompt': 'Find battery chemistry sources'}, 'workspace': '/srv/research', 'rule': { 'every': '24h', 'days': ['mon', 'wed'], 'timezone': 'Europe/London', }, 'next_due': '2026-10-22T09:00:00Z', }, { 'id': 9, 'revision': 1, 'name': 'Nightly report', 'pipeline_id': 7, 'version': 5, 'enabled': false, 'input': {'prompt': 'Summarise the open issues'}, 'workspace': '/srv/reports', 'rule': { 'times': ['10:00', '18:30'], 'days': [], 'timezone': 'Local', }, }, { 'id': 10, 'revision': 2, 'name': 'Weekly digest', 'pipeline_id': 12, 'version': 1, 'enabled': true, 'input': {'prompt': 'Collect the week’s changes'}, 'workspace': '/srv/digest', 'rule': {'every': '168h', 'days': []}, 'next_due': '2026-10-26T08:30:00+01:00', }, { 'id': 11, 'revision': 1, 'name': 'Sparse server record', 'enabled': false, 'input': {}, 'rule': {}, }, ], }; } @override Stream get frames => const Stream.empty(); }