fix: filtre par choix de gun, switch sticky

This commit is contained in:
qguillaume
2026-06-20 21:13:26 +02:00
parent a102bfd5ef
commit beb20074f2
2 changed files with 89 additions and 54 deletions

View File

@@ -15,25 +15,29 @@ class MainNavigationHolder extends StatefulWidget {
class _MainNavigationHolderState extends State<MainNavigationHolder> {
int _selectedIndex = 0;
final List<Widget> _screens = [
const HomeScreen(),
const HistoryScreen(),
const StatisticsScreen(),
const WeaponListScreen(),
];
// Incrémenté à chaque ouverture de l'onglet Stats pour forcer le rechargement
// (l'écran est gardé vivant par l'IndexedStack et ne se rafraîchit pas seul).
int _statsTick = 0;
void _onItemTapped(int index) {
setState(() {
_selectedIndex = index;
if (index == 2) _statsTick++;
});
}
@override
Widget build(BuildContext context) {
final screens = [
const HomeScreen(),
const HistoryScreen(),
StatisticsScreen(refreshTick: _statsTick),
const WeaponListScreen(),
];
return Scaffold(
body: IndexedStack(
index: _selectedIndex,
children: _screens,
children: screens,
),
bottomNavigationBar: Container(
decoration: BoxDecoration(