import 'package:flutter/material.dart';
import 'package:solaragent/router.dart';
class AgentNavigation extends StatefulWidget {
const AgentNavigation({super.key});
static const List<(String, NavigationDestination)> destinations = [
('/', NavigationDestination(icon: Icon(Icons.explore), label: 'Explore')),
('/notifications', NavigationDestination(icon: Icon(Icons.notifications), label: 'Notifications')),
('/account', NavigationDestination(icon: Icon(Icons.account_circle), label: 'Account')),
];
@override
State<AgentNavigation> createState() => _AgentNavigationState();
}
class _AgentNavigationState extends State<AgentNavigation> {
int currentPage = 0;
void initState() {
super.initState();
Widget build(BuildContext context) {
return NavigationBar(
selectedIndex: currentPage,
destinations: AgentNavigation.destinations
.map(((String, NavigationDestination) e) => e.$2)
.toList(),
onDestinationSelected: (index) {
router.go(AgentNavigation.destinations[index].$1);
setState(() => currentPage = index);
},
);