import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; import '../l10n/l10n.dart'; /// Inline warning shown at the top of repeater screens while the companion /// radio is disconnected. Renders nothing while connected. class RadioDisconnectedBanner extends StatelessWidget { const RadioDisconnectedBanner({super.key}); @override Widget build(BuildContext context) { final connected = context.select( (c) => c.isConnected, ); if (connected) return const SizedBox.shrink(); final scheme = Theme.of(context).colorScheme; final textTheme = Theme.of(context).textTheme; return Semantics( liveRegion: true, child: Material( color: scheme.errorContainer, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), child: Row( children: [ Icon(Icons.link_off, size: 24, color: scheme.onErrorContainer), const SizedBox(width: 12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ Text( context.l10n.repeater_radioDisconnected, style: textTheme.titleSmall?.copyWith( color: scheme.onErrorContainer, fontWeight: FontWeight.w700, ), ), const SizedBox(height: 2), Text( context.l10n.repeater_radioDisconnectedHint, style: textTheme.bodyMedium?.copyWith( color: scheme.onErrorContainer, ), ), ], ), ), ], ), ), ), ); } }