import 'package:flutter/material.dart';


const kVersionBucketOrder = ['4K', '2K', '1080P', '其他'];


String versionBucketOf(String? resolutionLabel) {
  switch (resolutionLabel) {
    case '4K':
    case '2K':
    case '1080P':
      return resolutionLabel!;
    default:
      return '其他';
  }
}


class VersionFilterChip extends StatelessWidget {
  final String label;
  final bool selected;
  final bool showDot;
  final VoidCallback onTap;

  const VersionFilterChip({
    super.key,
    required this.label,
    required this.selected,
    required this.onTap,
    this.showDot = false,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
        decoration: BoxDecoration(
          color: selected
              ? Colors.white.withValues(alpha: 0.18)
              : Colors.white.withValues(alpha: 0.06),
          borderRadius: BorderRadius.circular(999),
          border: Border.all(
            color: Colors.white.withValues(alpha: selected ? 0.5 : 0.15),
          ),
        ),
        child: Row(
          mainAxisSize: MainAxisSize.min,
          children: [
            if (showDot) ...[
              Container(
                width: 6,
                height: 6,
                decoration: const BoxDecoration(
                  color: Color(0xFF4F8DFF),
                  shape: BoxShape.circle,
                ),
              ),
              const SizedBox(width: 6),
            ],
            Text(
              label,
              style: TextStyle(
                fontSize: 13,
                color: Colors.white.withValues(alpha: selected ? 1 : 0.7),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
