import 'package:flutter/material.dart';
import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/views/shared/cached_svg.dart';

import '../../core/config/app_config.dart';

class Flag extends StatelessWidget {
  const Flag({required this.countryCode, super.key});

  final String countryCode;

  @override
  Widget build(BuildContext context) {
    return ClipRRect(
      borderRadius: BorderRadius.circular(6),
      child: CachedSvg(
        url:
            countryCode.isNotEmpty
                ? '${AppConfig.flagUrl}$countryCode'
                : '${AppConfig.flagUrl}EU',
        width: 32.0.w(),
        height: 21.0.h(),
        fit: BoxFit.cover,
      ),
    );
  }
}
