import 'package:flutter/material.dart';


class BalanceCopyableField extends StatelessWidget {
  final String label;
  final bool canCopy;
  final VoidCallback? onCopy;

  const BalanceCopyableField({
    super.key,
    required this.label,
    required this.canCopy,
    required this.onCopy,
  });

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    final colorScheme = theme.colorScheme;

    return Container(
      decoration: BoxDecoration(
        color: colorScheme.onSecondary,
        borderRadius: BorderRadius.circular(12),
        border: Border.all(color: colorScheme.primaryFixed, width: 0.6),
      ),
      child: InkWell(
        onTap: canCopy ? onCopy : null,
        borderRadius: BorderRadius.circular(12),
        child: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
          child: Row(
            mainAxisSize: MainAxisSize.min,
            children: [
              Icon(
                Icons.copy_rounded,
                size: 16,
                color: canCopy
                    ? colorScheme.primaryFixed
                    : colorScheme.primary.withValues(alpha: 0.35),
              ),
              const SizedBox(width: 6),
              Flexible(
                child: Text(
                  label,
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                  style: theme.textTheme.labelMedium?.copyWith(
                    color: canCopy
                        ? colorScheme.primaryFixed
                        : colorScheme.primary.withValues(alpha: 0.45),
                    fontWeight: FontWeight.normal,
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
