64 lines
1.6 KiB
Dart
64 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'screens/home_screen.dart';
|
|
import 'screens/add_screen.dart';
|
|
import 'screens/vehicles_screen.dart';
|
|
import 'screens/history_screen.dart';
|
|
|
|
void main() {
|
|
runApp(FuelStatsApp());
|
|
}
|
|
|
|
class FuelStatsApp extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Fuel Stats',
|
|
theme: ThemeData.dark(),
|
|
themeMode: ThemeMode.dark,
|
|
home: MainNavigation(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class MainNavigation extends StatefulWidget {
|
|
const MainNavigation({super.key});
|
|
|
|
@override
|
|
_MainNavigationState createState() => _MainNavigationState();
|
|
}
|
|
|
|
class _MainNavigationState extends State<MainNavigation> {
|
|
int _currentIndex = 0;
|
|
|
|
final List<Widget> _screens = [
|
|
HomeScreen(),
|
|
AddScreen(),
|
|
VehiclesScreen(),
|
|
HistoryScreen(),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: _screens[_currentIndex],
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
currentIndex: _currentIndex,
|
|
onTap: (index) => setState(() => _currentIndex = index),
|
|
backgroundColor: Colors.grey[900],
|
|
selectedItemColor: Colors.white,
|
|
unselectedItemColor: Colors.grey,
|
|
|
|
items: [
|
|
BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
|
|
BottomNavigationBarItem(icon: Icon(Icons.add), label: 'Add'),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.directions_car),
|
|
label: 'Vehicles',
|
|
),
|
|
BottomNavigationBarItem(icon: Icon(Icons.history), label: 'History'),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|