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 warningMessages(Object? value) => value is List ? value .whereType() .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 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), ), ], ); }