1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
import 'package:carpool/drawer.dart';
import 'package:carpool/ride_request.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'firebase_options.dart';
import 'routes.dart';
import 'login.dart';
// import 'cart.dart';
import 'payement_order.dart';
import 'signup.dart';
import 'order_history.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Carpool App',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: HomePage(),
routes: {
'/signup': (context) => const SignUpPage(),
'/login': (context) => const LoginPage(),
'/routes': (context) => RoutesPage(),
'/order_history': (context) => OrderHistoryPage(),
'/payment': (context) => PaymentOrderTrackingPage(),
'/request_ride': (context) => RequestRidePage(
selectedRide: Ride(
name: "",
startLocation: "",
endLocation: "",
carModel: "",
carBrand: "",
carColor: "",
plateNumber: "",
status: "",
orderTime: DateTime.now())),
},
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Home'),
),
drawer: CustomDrawer(),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
const SizedBox(height: 20),
const Text(
'Hello there',
style: TextStyle(
fontSize: 48,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 20),
const Text(
'Welcome to Carpool',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 20),
Image.asset(
'assets/logo.png',
width: 200,
height: 200,
),
const SizedBox(height: 40),
ElevatedButton(
onPressed: () {
Navigator.pushNamed(context, '/login');
},
style: ElevatedButton.styleFrom(
primary: Colors.blue,
),
child: const Padding(
padding: EdgeInsets.symmetric(horizontal: 40, vertical: 16),
child: Text(
'Login',
style: TextStyle(
fontSize: 18,
color: Colors.white,
),
),
),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
Navigator.pushNamed(context, '/signup');
},
style: ElevatedButton.styleFrom(
primary: Colors.green,
),
child: const Padding(
padding: EdgeInsets.symmetric(horizontal: 40, vertical: 16),
child: Text(
'Signup',
style: TextStyle(
fontSize: 18,
color: Colors.white,
),
),
),
),
],
),
),
);
}
Widget _buildDrawerItem({
required IconData icon,
required String text,
required VoidCallback onTap,
}) {
return ListTile(
leading: Icon(icon),
title: Text(text),
onTap: onTap,
);
}
}
|