Added: user settings screen, Several changes in main.lib
This commit is contained in:
parent
6ebb49252e
commit
f39324e814
@ -3,6 +3,7 @@ import 'screens/home_screen.dart';
|
|||||||
import 'screens/add_screen.dart';
|
import 'screens/add_screen.dart';
|
||||||
import 'screens/vehicles_screen.dart';
|
import 'screens/vehicles_screen.dart';
|
||||||
import 'screens/history_screen.dart';
|
import 'screens/history_screen.dart';
|
||||||
|
import 'screens/user_settings.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(FuelStatsApp());
|
runApp(FuelStatsApp());
|
||||||
@ -12,9 +13,9 @@ class FuelStatsApp extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Fuel Stats',
|
|
||||||
theme: ThemeData.dark(),
|
theme: ThemeData.dark(),
|
||||||
themeMode: ThemeMode.dark,
|
themeMode: ThemeMode.dark,
|
||||||
|
debugShowCheckedModeBanner: false,
|
||||||
home: MainNavigation(),
|
home: MainNavigation(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -35,20 +36,42 @@ class _MainNavigationState extends State<MainNavigation> {
|
|||||||
AddScreen(),
|
AddScreen(),
|
||||||
VehiclesScreen(),
|
VehiclesScreen(),
|
||||||
HistoryScreen(),
|
HistoryScreen(),
|
||||||
|
UserSettingsScreen(),
|
||||||
|
];
|
||||||
|
|
||||||
|
final List<Widget> titles = [
|
||||||
|
Text("Fuel Stats"),
|
||||||
|
Text("Add record"),
|
||||||
|
Text("Vehicles"),
|
||||||
|
Text("History"),
|
||||||
];
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
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],
|
body: _screens[_currentIndex],
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
currentIndex: _currentIndex,
|
currentIndex: _currentIndex <= 3 ? _currentIndex : 0,
|
||||||
onTap: (index) => setState(() => _currentIndex = index),
|
onTap: (index) => setState(() => _currentIndex = index),
|
||||||
backgroundColor: Colors.grey[900],
|
backgroundColor: Colors.grey[900],
|
||||||
selectedItemColor: Colors.white,
|
selectedItemColor: Colors.white,
|
||||||
unselectedItemColor: Colors.grey,
|
unselectedItemColor: Colors.grey,
|
||||||
|
items: const [
|
||||||
items: [
|
|
||||||
BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
|
BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
|
||||||
BottomNavigationBarItem(icon: Icon(Icons.add), label: 'Add'),
|
BottomNavigationBarItem(icon: Icon(Icons.add), label: 'Add'),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
|
@ -23,7 +23,6 @@ class _AddScreenState extends State<AddScreen> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: Text('Add Entry')),
|
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: Form(
|
child: Form(
|
||||||
|
@ -3,9 +3,6 @@ import 'package:flutter/material.dart';
|
|||||||
class HistoryScreen extends StatelessWidget {
|
class HistoryScreen extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(body: Center(child: Text('History Screen Content')));
|
||||||
appBar: AppBar(title: Text('History')),
|
|
||||||
body: Center(child: Text('History Screen Content')),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ class HomeScreen extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: Text('Fuel Stats')),
|
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
32
lib/screens/user_settings.dart
Normal file
32
lib/screens/user_settings.dart
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class UserSettingsScreen extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(title: Text('User settings')),
|
||||||
|
body: Center(
|
||||||
|
child: Column(
|
||||||
|
spacing: 20.0,
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
"Test User",
|
||||||
|
style: TextStyle(fontSize: 32, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
ElevatedButton.icon(
|
||||||
|
onPressed: () {
|
||||||
|
// TODO: Add sign-out logic here
|
||||||
|
},
|
||||||
|
icon: Icon(Icons.logout),
|
||||||
|
label: Text("Sign Out"),
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.redAccent,
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -79,7 +79,6 @@ class _VehiclesScreenState extends State<VehiclesScreen> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: Text('Vehicles')),
|
|
||||||
body:
|
body:
|
||||||
_vehicles.isEmpty
|
_vehicles.isEmpty
|
||||||
? Center(child: Text('No vehicles added yet.'))
|
? Center(child: Text('No vehicles added yet.'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user