home_page.dart (1781B)
1 // import 'package:firebase_auth/firebase_auth.dart'; 2 import 'package:flutter/material.dart'; 3 import 'package:penny/pages/collection_page.dart'; 4 import 'package:penny/pages/leaderboard_page.dart'; 5 import 'package:penny/pages/profile_page.dart'; 6 import 'package:penny/pages/search_page.dart'; 7 8 class HomePage extends StatefulWidget { 9 const HomePage({super.key}); 10 11 @override 12 State<HomePage> createState() => _HomePageState(); 13 } 14 15 class _HomePageState extends State<HomePage> { 16 int _selectedIndex = 0; 17 18 final List<Widget> _pages = [ 19 const SearchScreen(), 20 const CollectionScreen(), 21 // const CameraScreen(), 22 const LeaderboardScreen(), 23 const ProfileScreen(), 24 ]; 25 26 void _onItemTapped(int index) { 27 setState(() { 28 _selectedIndex = index; 29 }); 30 } 31 32 @override 33 Widget build(BuildContext context) { 34 return Scaffold( 35 body: _pages[_selectedIndex], 36 bottomNavigationBar: BottomNavigationBar( 37 selectedItemColor: Colors.black, 38 unselectedItemColor: Colors.black, 39 currentIndex: _selectedIndex, 40 onTap: _onItemTapped, 41 items: const <BottomNavigationBarItem>[ 42 BottomNavigationBarItem( 43 icon: Icon(Icons.search), 44 label: 'Home', 45 ), 46 BottomNavigationBarItem( 47 icon: Icon(Icons.backpack), 48 label: 'Collection', 49 ), 50 // BottomNavigationBarItem( 51 // icon: Icon(Icons.photo_camera), 52 // label: 'Camera', 53 // ), 54 BottomNavigationBarItem( 55 icon: Icon(Icons.leaderboard), 56 label: 'Leaderboard', 57 ), 58 BottomNavigationBarItem( 59 icon: Icon(Icons.person), 60 label: 'Profile', 61 ), 62 ], 63 ), 64 ); 65 } 66 }