Files
pipelines/app/lib/ui/layout/warnings_section.dart
alan a5912d9a1e Remove Cupertino branches from layout widgets
Keep the public cupertino parameters for existing callers while making the layout widgets and focused tests Material-only. Remove unreachable Cupertino imports, helpers, widgets, and test variants without changing the Material path.
2026-11-11 16:35:38 +00:00

42 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
import 'section_heading.dart';
/// Protocol warning arrays contain human-readable strings. Ignore malformed
/// entries rather than displaying map/list representations as diagnostics.
List<String> warningMessages(Object? value) => value is List
? value
.whereType<String>()
.map((message) => message.trim())
.where((message) => message.isNotEmpty)
.toList(growable: false)
: const [];
/// A visible, selectable group of server diagnostics; no collapsed disclosure
/// hides a warning from the operator reading the summary.
class WarningsSection extends StatelessWidget {
const WarningsSection({
super.key,
required this.messages,
this.title = 'Warnings',
});
final List<String> messages;
final String title;
@override
Widget build(BuildContext context) => messages.isEmpty
? const SizedBox.shrink()
: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SectionHeading(title: title, header: true),
for (final message in messages)
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 16, 8),
child: SelectableText(message),
),
],
);
}