Skip to content

Commit 43882cd

Browse files
committed
added user class and a database class and did required changes in LoginForm. COmmented(landing page)
1 parent 5fdf317 commit 43882cd

File tree

2 files changed

+100
-7
lines changed

2 files changed

+100
-7
lines changed

lib/bookingdetails.dart

Lines changed: 95 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import 'package:flutter/material.dart';
22

33
class BookingDetails extends StatelessWidget{
4-
const BookingDetails(this.date, this.starttime, this.endtime, {Key? key}) : super(key: key);
4+
BookingDetails(this.date, this.starttime, this.endtime, {Key? key}) : super(key: key);
55
final String date;
66
final String starttime;
77
final String endtime;
8+
List<String> carpools = ["Ishaan Jalan", "Rudransh Dixit", "hewwo", "manda", "ramesh", "mukesh", "sukesh", "nilesh"] ;
89

910
@override
1011
Widget build(BuildContext context) {
@@ -32,7 +33,7 @@ class BookingDetails extends StatelessWidget{
3233
),
3334
heroTag: "button1",
3435
onPressed: (){
35-
// TODO: Add Navigator pop
36+
Navigator.pop(context);
3637
},
3738
backgroundColor: Colors.black,
3839
child:Row(
@@ -61,8 +62,98 @@ class BookingDetails extends StatelessWidget{
6162
color: Colors.white,
6263
)
6364
),
64-
// body:
65+
body: ListView(
66+
scrollDirection: Axis.vertical,
67+
shrinkWrap: true,
68+
padding: EdgeInsets.all(5),
69+
children: <Widget>[
70+
const ListTile(
71+
title: Center(
72+
child: Text(
73+
"Details",
74+
style: TextStyle(color: Colors.blue, fontFamily: 'Helvetica', fontSize: 22, fontWeight: FontWeight.bold),
75+
),
76+
),
77+
tileColor: Colors.black,
78+
),
79+
ListTile(
80+
leading: const Icon(
81+
Icons.calendar_today_sharp,
82+
color: Colors.blue,
83+
size: 22,
84+
),
85+
title: Text(
86+
"Date: $date",
87+
style: const TextStyle(color: Colors.white, fontFamily: 'Helvetica', fontSize: 15),
88+
),
89+
tileColor: Colors.black,
90+
),
91+
ListTile(
92+
leading: const Icon(
93+
Icons.lock_clock,
94+
color: Colors.blue,
95+
size: 22,
96+
),
97+
title: Text(
98+
"Time Slot: $starttime Hours to $endtime Hours",
99+
style: const TextStyle(color: Colors.white, fontFamily: 'Helvetica', fontSize: 15),
100+
),
101+
tileColor: Colors.black,
102+
),
103+
const ListTile(
104+
title: Center(
105+
child: Text(
106+
"Available Carpools",
107+
style: TextStyle(color: Colors.blue, fontFamily: 'Helvetica', fontSize: 22, fontWeight: FontWeight.bold),
108+
),
109+
),
110+
tileColor: Colors.black,
111+
),
112+
avlblcarpools(),
113+
],
114+
),
65115
);
66116
}
67-
117+
118+
Widget avlblcarpools(){
119+
Widget temp;
120+
if(carpools.length!=0){
121+
temp = ListView.builder(
122+
scrollDirection: Axis.vertical,
123+
shrinkWrap: true,
124+
padding:const EdgeInsets.all(5),
125+
itemCount: carpools.length,
126+
itemBuilder: (BuildContext context, int index) {
127+
String name = carpools[index];
128+
return ListTile(
129+
leading: const Icon(
130+
Icons.person,
131+
color: Colors.blue,
132+
size: 22,
133+
),
134+
title: Text(
135+
name,
136+
style: const TextStyle(color: Colors.white, fontFamily: 'Helvetica', fontSize: 15),
137+
),
138+
tileColor: Colors.black,
139+
shape: RoundedRectangleBorder(
140+
borderRadius: BorderRadius.circular(12),
141+
),
142+
);
143+
},
144+
);
145+
}
146+
else{
147+
temp = const ListTile(
148+
title: Center(
149+
child: Text(
150+
"Sorry, there are no carpools available in your time slot",
151+
style: TextStyle(color: Colors.white, fontFamily: 'Helvetica', fontSize: 15),
152+
),
153+
),
154+
tileColor: Colors.black,
155+
);
156+
}
157+
return temp;
158+
}
68159
}

lib/home.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ class Homepage extends State<Home>{
4141
shape: RoundedRectangleBorder(
4242
borderRadius: BorderRadius.circular(14),
4343
),
44-
title: const Text(
45-
"Information about the booking",
44+
title: const Center(
45+
child: Text(
46+
"Booking Options",
4647
style: TextStyle(color: Colors.white, fontSize: 18),
4748
),
49+
),
4850
children: <Widget>[
4951
SimpleDialogOption(
5052
onPressed: (){Navigator.pop(context,Options.ShowDetails);},
@@ -85,7 +87,7 @@ class Homepage extends State<Home>{
8587
{
8688
case Options.ShowDetails:
8789
// Let's go.
88-
Navigator.push(context, MaterialPageRoute(builder: (context) => const BookingDetails("11-02-2022", "2:00", "3:00")));
90+
Navigator.push(context, MaterialPageRoute(builder: (context) => BookingDetails("11-02-2022", "2:00", "3:00")));
8991
print("show details clicked");
9092
break;
9193
case Options.Remove:

0 commit comments

Comments
 (0)