import 'package:flutter/material.dart'; import 'scoring_page.dart'; import 'settings_page.dart'; class MainNavigationPage extends StatefulWidget { const MainNavigationPage({super.key}); @override State createState() => _MainNavigationPageState(); } class _MainNavigationPageState extends State { int _selectedIndex = 0; final List _pages = [ const ScoringPage(), const SettingsPage(), ]; final List _pageTitles = [ 'Main (Scorer)', 'Settings', ]; void _onNavigationItemSelected(int index) { setState(() { _selectedIndex = index; }); Navigator.pop(context); // Close drawer } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(_pageTitles[_selectedIndex]), backgroundColor: Theme.of(context).colorScheme.inversePrimary, ), body: _pages[_selectedIndex], drawer: Drawer( child: ListView( padding: EdgeInsets.zero, children: [ DrawerHeader( decoration: BoxDecoration( color: Theme.of(context).colorScheme.inversePrimary, ), child: const Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.end, children: [ Text( 'Archery Bookkeeper', style: TextStyle( color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold, ), ), SizedBox(height: 8), Text( 'Alpha 0.1', style: TextStyle( color: Colors.white70, fontSize: 16, ), ), ], ), ), ListTile( leading: const Icon(Icons.sports), title: const Text('Main (Scorer)'), selected: _selectedIndex == 0, onTap: () => _onNavigationItemSelected(0), ), ListTile( leading: const Icon(Icons.settings), title: const Text('Settings'), selected: _selectedIndex == 1, onTap: () => _onNavigationItemSelected(1), ), const Divider(), const Padding( padding: EdgeInsets.all(16.0), child: Text( 'Professional archery scoring with sophisticated end interaction system.', style: TextStyle( fontSize: 12, color: Colors.grey, ), ), ), ], ), ), ); } }