import 'package:flutter/material.dart'; import '../theme/ranks.dart'; /// نشانِ رتبه (برنز/نقره/طلا/الماس/پادشاه) با رنگ و برچسبِ فارسی از سرور. class RankBadge extends StatelessWidget { final String tier; // bronze..king final int? points; // در صورت نمایش امتیاز final double size; const RankBadge({super.key, required this.tier, this.points, this.size = 16}); @override Widget build(BuildContext context) { final label = rankLabel(tier); final colors = rankGradient(tier); return Container( padding: EdgeInsets.symmetric(horizontal: size * 0.6, vertical: size * 0.25), decoration: BoxDecoration( gradient: LinearGradient(colors: colors), borderRadius: BorderRadius.circular(size), boxShadow: const [BoxShadow(color: Colors.black54, blurRadius: 4)], ), child: Row(mainAxisSize: MainAxisSize.min, children: [ Image.asset( 'assets/images/badge/$tier.png', width: size * 1.5, height: size * 1.5, errorBuilder: (_, __, ___) => Icon(Icons.military_tech, color: Colors.white, size: size * 1.1), ), SizedBox(width: size * 0.3), Text( points == null ? label : '$label · $points', style: TextStyle( color: Colors.white, fontSize: size * 0.85, fontWeight: FontWeight.bold, ), ), ]), ); } }