Added: user settings screen, Several changes in main.lib

This commit is contained in:
2025-05-03 17:08:46 +02:00
parent 6ebb49252e
commit f39324e814
6 changed files with 60 additions and 11 deletions

View File

@@ -3,6 +3,7 @@ import 'screens/home_screen.dart';
import 'screens/add_screen.dart';
import 'screens/vehicles_screen.dart';
import 'screens/history_screen.dart';
import 'screens/user_settings.dart';
void main() {
runApp(FuelStatsApp());
@@ -12,9 +13,9 @@ class FuelStatsApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Fuel Stats',
theme: ThemeData.dark(),
themeMode: ThemeMode.dark,
debugShowCheckedModeBanner: false,
home: MainNavigation(),
);
}
@@ -35,20 +36,42 @@ class _MainNavigationState extends State<MainNavigation> {
AddScreen(),
VehiclesScreen(),
HistoryScreen(),
UserSettingsScreen(),
];
final List<Widget> titles = [
Text("Fuel Stats"),
Text("Add record"),
Text("Vehicles"),
Text("History"),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: _currentIndex <= 3 ? titles[_currentIndex] : Text("Fuel Stats"),
actions: [
IconButton(
icon: const Icon(Icons.person),
tooltip: "User settings",
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => UserSettingsScreen()),
);
},
),
],
),
body: _screens[_currentIndex],
bottomNavigationBar: BottomNavigationBar(
currentIndex: _currentIndex,
currentIndex: _currentIndex <= 3 ? _currentIndex : 0,
onTap: (index) => setState(() => _currentIndex = index),
backgroundColor: Colors.grey[900],
selectedItemColor: Colors.white,
unselectedItemColor: Colors.grey,
items: [
items: const [
BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
BottomNavigationBarItem(icon: Icon(Icons.add), label: 'Add'),
BottomNavigationBarItem(