Files
hackathon-innovaflow5.0-cdf…/recolecta_app/lib/features/home/main_shell.dart

39 lines
1.0 KiB
Dart

import 'package:flutter/material.dart';
import '../../core/widgets/app_widgets.dart';
import 'citizen_home_screen.dart';
import '../alerts/alerts_screen.dart';
import 'house_screen.dart';
import '../profile/profile_screen.dart';
class MainShell extends StatefulWidget {
const MainShell({super.key});
@override
State<MainShell> createState() => _MainShellState();
}
class _MainShellState extends State<MainShell> {
int _currentIndex = 0;
static const List<Widget> _screens = [
CitizenHomeScreen(),
AlertsScreen(),
MyHouseScreen(),
ProfileScreen(),
];
@override
Widget build(BuildContext context) {
return Scaffold(
// Renderiza únicamente la pantalla activa para desmontar vistas nativas
// (p. ej. FlutterMap) cuando la pestaña no está activa, evitando que
// queden superpuestas sobre la UI de otras pestañas.
body: _screens[_currentIndex],
bottomNavigationBar: AppBottomNav(
currentIndex: _currentIndex,
onTap: (i) => setState(() => _currentIndex = i),
),
);
}
}