fix: filtre par choix de gun, switch sticky
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user