- gen-l10n setup (flutter_localizations, intl, l10n.yaml, ARB en/fr) - localeProvider (persisted) wired into MaterialApp - language selector in the System page (alongside the color palette) - all user-facing strings across screens moved to AppLocalizations Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
134 lines
4.9 KiB
Dart
134 lines
4.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../../domain/entities/pokemon.dart';
|
|
import '../../../l10n/app_localizations.dart';
|
|
|
|
/// Écran inférieur du détail : stats de base, description et éléments décoratifs.
|
|
class PokemonStatsPanel extends StatelessWidget {
|
|
final Pokemon pokemon;
|
|
const PokemonStatsPanel({super.key, required this.pokemon});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final l = AppLocalizations.of(context)!;
|
|
return Container(
|
|
margin: const EdgeInsets.symmetric(horizontal: 16),
|
|
padding: const EdgeInsets.all(8),
|
|
decoration: BoxDecoration(color: const Color(0xFF1B2333), borderRadius: BorderRadius.circular(8)),
|
|
child: Container(
|
|
color: const Color(0xFFC8D1D8),
|
|
padding: const EdgeInsets.all(16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(l.baseStats, style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold, letterSpacing: 2)),
|
|
Text("MODEL: DS-01", style: TextStyle(fontSize: 12, color: Colors.grey[700], fontWeight: FontWeight.bold)),
|
|
],
|
|
),
|
|
const Divider(color: Colors.black38, thickness: 2, height: 20),
|
|
_StatBar(label: "HP", value: pokemon.hp, color: const Color(0xFFE53935)),
|
|
_StatBar(label: "ATK", value: pokemon.atk, color: const Color(0xFFFB8C00)),
|
|
_StatBar(label: "DEF", value: pokemon.def, color: const Color(0xFFFDD835)),
|
|
_StatBar(label: "SPD", value: pokemon.spd, color: const Color(0xFF1E88E5)),
|
|
const SizedBox(height: 24),
|
|
Container(
|
|
width: double.infinity,
|
|
padding: const EdgeInsets.all(12),
|
|
decoration: BoxDecoration(color: const Color(0xFFE2EBF0), border: Border.all(color: Colors.grey[400]!)),
|
|
child: Text(
|
|
pokemon.description != null && pokemon.description!.isNotEmpty
|
|
? '"${pokemon.description!}"'
|
|
: '"${l.noDescription}"',
|
|
style: const TextStyle(fontSize: 16, height: 1.5),
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
const _DecorativeLights(),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Barre d'une statistique (libellé, jauge proportionnelle, valeur).
|
|
class _StatBar extends StatelessWidget {
|
|
final String label;
|
|
final int value;
|
|
final Color color;
|
|
const _StatBar({required this.label, required this.value, required this.color});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final ratio = (value / 255).clamp(0.0, 1.0); // stat de base max supposée = 255
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
|
child: Row(
|
|
children: [
|
|
SizedBox(width: 50, child: Text(label, style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18))),
|
|
Expanded(
|
|
child: Container(
|
|
height: 14,
|
|
decoration: BoxDecoration(color: Colors.grey[400]),
|
|
child: Row(
|
|
children: [
|
|
Expanded(flex: (ratio * 100).toInt(), child: Container(color: color)),
|
|
Expanded(flex: 100 - (ratio * 100).toInt(), child: Container()),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(width: 16),
|
|
SizedBox(
|
|
width: 40,
|
|
child: Text(value.toString(),
|
|
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18), textAlign: TextAlign.right),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Petites diodes décoratives en bas du panneau (purement cosmétiques).
|
|
class _DecorativeLights extends StatelessWidget {
|
|
const _DecorativeLights();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Row(
|
|
children: [
|
|
Container(
|
|
width: 24,
|
|
height: 24,
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFF1E88E5),
|
|
shape: BoxShape.circle,
|
|
border: Border.all(color: const Color(0xFF1565C0), width: 2),
|
|
),
|
|
),
|
|
const SizedBox(width: 8),
|
|
Container(
|
|
width: 24,
|
|
height: 24,
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFFFFB300),
|
|
shape: BoxShape.circle,
|
|
border: Border.all(color: const Color(0xFFF57C00), width: 2),
|
|
),
|
|
),
|
|
const Spacer(),
|
|
Row(
|
|
children: [
|
|
Container(height: 6, width: 30, decoration: BoxDecoration(color: Colors.grey[500], borderRadius: BorderRadius.circular(3))),
|
|
const SizedBox(width: 4),
|
|
Container(height: 6, width: 30, decoration: BoxDecoration(color: Colors.grey[500], borderRadius: BorderRadius.circular(3))),
|
|
],
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|