import 'package:flutter/material.dart';

import '../../app/theme.dart';

/// Dot verde + etichetta COLLEGATO.
class ConnectedBadge extends StatelessWidget {
  const ConnectedBadge({
    super.key,
    this.connected = true,
    this.label,
  });

  final bool connected;
  final String? label;

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    final color = connected ? AppTheme.successGreen : AppTheme.textSecondary;
    return Row(
      mainAxisSize: MainAxisSize.min,
      children: [
        Container(
          width: 8,
          height: 8,
          decoration: BoxDecoration(
            color: color,
            shape: BoxShape.circle,
          ),
        ),
        const SizedBox(width: 6),
        Text(
          label ?? (connected ? 'COLLEGATO' : 'DISCONNESSO'),
          style: theme.textTheme.labelLarge?.copyWith(
            color: color,
            fontSize: 12,
          ),
        ),
      ],
    );
  }
}
