wifi udp stream activity indicator added

This commit is contained in:
Constantin Leue
2026-07-31 10:50:41 +02:00
parent cb91436fe4
commit ee97a7cb9a
2 changed files with 76 additions and 0 deletions
@@ -143,6 +143,7 @@ class _WifiPanelState extends ConsumerState<_WifiPanel> {
Widget build(BuildContext context) {
final linkState = ref.watch(wifiLinkStateProvider).value;
final errorReason = ref.watch(wifiLinkErrorReasonProvider);
final isReceiving = ref.watch(wifiStreamActivityProvider);
final connectionSettings = ref.watch(connectionSettingsProvider).value;
final log = ref.watch(wifiConnectionLogProvider);
final packetCount = ref.watch(wifiConnectionLogProvider.notifier).packetCount;
@@ -163,6 +164,8 @@ class _WifiPanelState extends ConsumerState<_WifiPanel> {
children: [
Text('WiFi (UDP)', style: Theme.of(context).textTheme.titleSmall),
const Spacer(),
_StreamActivityPill(isReceiving: isReceiving),
const SizedBox(width: 6),
_StatePill(state: linkState),
],
),
@@ -459,6 +462,32 @@ class _BluetoothPanel extends ConsumerWidget {
}
}
/// Zeigt neben [_StatePill], ob gerade UDP-Pakete ankommen ("receiving") -
/// unabhaengig vom Verbindungszustand, der Socket kann offen sein, ohne
/// dass die Gegenstelle sendet (siehe wifiStreamActivityProvider).
class _StreamActivityPill extends StatelessWidget {
const _StreamActivityPill({required this.isReceiving});
final bool isReceiving;
@override
Widget build(BuildContext context) {
final color = isReceiving ? DmcColors.liveGreen : Colors.grey;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
decoration: BoxDecoration(
color: color.withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: color),
),
child: Text(
isReceiving ? 'Receiving' : 'Not receiving',
style: TextStyle(color: color, fontSize: 12),
),
);
}
}
class _StatePill extends StatelessWidget {
const _StatePill({required this.state});