b60ad6d98f
Keep the probe suite on the Material composition so browser fixtures and capture drivers no longer render or select Cupertino hosts. Record the final residual legacy arguments and implementation checks for the delivery gate.
114 lines
3.3 KiB
Dart
114 lines
3.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:pipelines_app/features/attention/domain/attention_models.dart';
|
|
import 'package:pipelines_app/features/attention/ui/needs_you_bell.dart';
|
|
|
|
/// Browser capture entrypoint for the reusable `Needs you` bell and sheet.
|
|
///
|
|
/// The fixture owns the entries and records the callbacks in plain text, so a
|
|
/// browser drive can prove the bell label, both native sheets, the empty state
|
|
/// and that a dismissal/clear names a real identity. Nothing here opens a
|
|
/// socket, reads storage or asks for notification permission.
|
|
const _longDetail =
|
|
'Stage 3 stopped at the export archive step because the credential it '
|
|
'needs is no longer configured on this server.';
|
|
|
|
List<AttentionEntry> _entries() => [
|
|
attentionEntryFor({
|
|
'id': 7,
|
|
'name': 'release',
|
|
'title': 'Approve the release candidate',
|
|
'status': 'waiting',
|
|
'created_at': '2026-10-21T09:00:00Z',
|
|
'finished_at': '',
|
|
})!,
|
|
attentionEntryFor({
|
|
'id': 8,
|
|
'name': 'nightly-audit',
|
|
'title': 'Nightly audit with a label long enough to wrap at 320 logical px',
|
|
'status': 'failed',
|
|
'diagnostic': _longDetail,
|
|
'created_at': '2026-10-21T08:00:00Z',
|
|
'finished_at': '2026-10-21T08:30:00Z',
|
|
})!,
|
|
];
|
|
|
|
void main() {
|
|
final params = Uri.base.queryParameters;
|
|
final scale = double.tryParse(params['scale'] ?? '') ?? 1;
|
|
final empty = params['mode'] == 'empty';
|
|
final brightness = params['theme'] == 'light'
|
|
? Brightness.light
|
|
: Brightness.dark;
|
|
Widget scaled(BuildContext context, Widget? app) => MediaQuery(
|
|
data: MediaQuery.of(context).copyWith(textScaler: TextScaler.linear(scale)),
|
|
child: app!,
|
|
);
|
|
final home = _ProbeHome(entries: empty ? const [] : _entries());
|
|
runApp(
|
|
MaterialApp(
|
|
theme: ThemeData(
|
|
platform: TargetPlatform.android,
|
|
brightness: brightness,
|
|
),
|
|
builder: scaled,
|
|
home: home,
|
|
),
|
|
);
|
|
}
|
|
|
|
class _ProbeHome extends StatefulWidget {
|
|
const _ProbeHome({required this.entries});
|
|
|
|
final List<AttentionEntry> entries;
|
|
|
|
@override
|
|
State<_ProbeHome> createState() => _ProbeHomeState();
|
|
}
|
|
|
|
class _ProbeHomeState extends State<_ProbeHome> {
|
|
late List<AttentionEntry> _entries = [...widget.entries];
|
|
String _event = 'Nothing raised yet';
|
|
|
|
void _open(AttentionEntry entry) {
|
|
setState(() => _event = 'Opened ${entry.key}');
|
|
}
|
|
|
|
void _dismiss(AttentionEntry entry) {
|
|
setState(() {
|
|
_entries = _entries.where((item) => item.key != entry.key).toList();
|
|
_event = 'Dismissed ${entry.key}';
|
|
});
|
|
}
|
|
|
|
void _clearAll(List<AttentionEntry> snapshot) {
|
|
final keys = snapshot.map((entry) => entry.key).toSet();
|
|
setState(() {
|
|
_entries = _entries.where((entry) => !keys.contains(entry.key)).toList();
|
|
_event = 'Cleared ${keys.length} of the open snapshot';
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final bell = NeedsYouBell(
|
|
entries: _entries,
|
|
onOpen: _open,
|
|
onDismiss: _dismiss,
|
|
onClearAll: _clearAll,
|
|
);
|
|
final body = ListView(
|
|
padding: const EdgeInsets.all(16),
|
|
children: [
|
|
Text(_event),
|
|
const SizedBox(height: 12),
|
|
Text('${_entries.length} needing attention now'),
|
|
],
|
|
);
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('Runs'), actions: [bell]),
|
|
body: SafeArea(child: body),
|
|
);
|
|
}
|
|
}
|