import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; class AgentNavigation extends StatefulWidget { const AgentNavigation({super.key, required this.router}); final GoRouter router; static const items = [ NavigationDestination( icon: Icon(Icons.home), label: 'Dashboard', ), NavigationDestination( icon: Icon(Icons.account_circle), label: 'Account', ) ]; static const destinations = ["/", "/account"]; @override State createState() => _AgentNavigationState(); } class _AgentNavigationState extends State { int _selected = 0; @override Widget build(BuildContext context) { return NavigationBar( selectedIndex: _selected, labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected, destinations: AgentNavigation.items, onDestinationSelected: (index) { widget.router.push(AgentNavigation.destinations[index]); setState(() { _selected = index; }); }, ); } }