72 lines
1.6 KiB
Dart
72 lines
1.6 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'package:ontime_haulers/screens/home_screen.dart';
|
||
|
import 'package:ontime_haulers/screens/quote_screen.dart';
|
||
|
import 'package:ontime_haulers/screens/track_screen.dart';
|
||
|
import 'package:ontime_haulers/screens/login_screen.dart';
|
||
|
import 'package:ontime_haulers/screens/setup_screen.dart';
|
||
|
|
||
|
void main() {
|
||
|
runApp(const MyApp());
|
||
|
}
|
||
|
|
||
|
class MyApp extends StatefulWidget {
|
||
|
const MyApp({super.key});
|
||
|
|
||
|
@override
|
||
|
State<MyApp> createState() => _MyAppState();
|
||
|
}
|
||
|
|
||
|
class _MyAppState extends State<MyApp> {
|
||
|
int _selectedIndex = 0;
|
||
|
|
||
|
void _onItemTapped(int index) {
|
||
|
setState(() {
|
||
|
_selectedIndex = index;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
_setScreen() {
|
||
|
switch (_selectedIndex) {
|
||
|
case 0:
|
||
|
return HomeScreen(
|
||
|
selectedIndex: _selectedIndex,
|
||
|
onItemTapped: _onItemTapped
|
||
|
);
|
||
|
case 1:
|
||
|
return QuoteScreen(
|
||
|
selectedIndex: _selectedIndex,
|
||
|
onItemTapped: _onItemTapped
|
||
|
);
|
||
|
case 2:
|
||
|
return TrackScreen(
|
||
|
selectedIndex: _selectedIndex,
|
||
|
onItemTapped: _onItemTapped
|
||
|
);
|
||
|
case 3:
|
||
|
return LoginScreen(
|
||
|
selectedIndex: _selectedIndex,
|
||
|
onItemTapped: _onItemTapped
|
||
|
|
||
|
);
|
||
|
case 4:
|
||
|
return SetupScreen(
|
||
|
selectedIndex: _selectedIndex,
|
||
|
onItemTapped: _onItemTapped
|
||
|
|
||
|
);
|
||
|
default:
|
||
|
return HomeScreen(
|
||
|
selectedIndex: _selectedIndex,
|
||
|
onItemTapped: _onItemTapped
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return MaterialApp(
|
||
|
debugShowCheckedModeBanner: false,
|
||
|
home: _setScreen(),
|
||
|
);
|
||
|
}
|
||
|
}
|