Files
RUSwipeShare/lib/home.dart
NATHANIEL ENDICK f6aa8340f5 Bottom nav bar
2023-02-25 16:57:18 -05:00

78 lines
1.9 KiB
Dart

import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
return const StatefulHome();
}
}
class StatefulHome extends StatefulWidget {
const StatefulHome({super.key});
@override
State<StatefulHome> createState() => _StatefulHomeState();
}
class _StatefulHomeState extends State<StatefulHome> {
int _selectedIndex = 0;
void _onItemTapped(int index) {
setState(() {
_selectedIndex = index;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('FlutterFire UI'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('You are logged in!'),
ElevatedButton(
onPressed: () {
FirebaseAuth.instance.signOut();
},
child: const Text('Sign out'),
),
],
),
),
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
backgroundColor: Colors.red,
selectedItemColor: Colors.black,
unselectedItemColor: Colors.black54,
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.shopping_cart),
label: 'Buy',
),
BottomNavigationBarItem(
icon: Icon(Icons.attach_money),
label: 'Sell',
),
BottomNavigationBarItem(
icon: Icon(Icons.person),
label: 'Profile',
),
BottomNavigationBarItem(
icon: Icon(Icons.settings),
label: 'Settings',
),
],
currentIndex: _selectedIndex,
onTap: _onItemTapped,
),
);
}
}